aboutsummaryrefslogtreecommitdiff
path: root/ci-tests/snippy-tests/boot-code-vf.s
blob: 8c32c0fcbe30ca91c34cbb13a2a402d61491ac5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.option norvc

.global _entry
.global fromhost
.global tohost

.text
_entry:
  la t0, exception_handler
  csrw mtvec, t0
  csrr t1, mstatus
# Setting bit number 9 (mstatus.VS)
  li t2, 1
  slli t2, t2, 9
  or t1, t1, t2
# Setting bit number 13 (mstatus.FS)
  li t3, 1
  slli t3, t3, 13
  or t1, t1, t3
  csrw mstatus, t1
  la t0, SNIPPY_ENTRY
  jalr t0

exception_handler:
  csrr x10, mcause
# In case of breakpoint (Interrupt = 0, Exception code = 3) we finalize.
# Otherwise it's not the expected behavior and we go into an infinite loop.
  li x11, 3
  beq x10, x11, exit
  j infinite_loop

exit:
  li ra, 1
  la sp, tohost
  sd ra, 0(sp)

infinite_loop:
  j infinite_loop

.balign 64
tohost:
.8byte 0x0
.balign 64
fromhost:
.8byte 0x0