summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2014-11-25 21:18:18 -0800
committerAndrew Waterman <waterman@cs.berkeley.edu>2014-11-25 21:18:35 -0800
commit9be35353ecb3252ec62b86d446c43ba89843b0b4 (patch)
treef8efc82ad83d13c617bfddbbceb7c219e6e1c354
parentcb2f03b341e9b9e2f05e5e0bf999bb7a08904991 (diff)
downloadenv-9be35353ecb3252ec62b86d446c43ba89843b0b4.zip
env-9be35353ecb3252ec62b86d446c43ba89843b0b4.tar.gz
env-9be35353ecb3252ec62b86d446c43ba89843b0b4.tar.bz2
use new calling convention
-rw-r--r--v/entry.S43
-rw-r--r--v/vm.c2
2 files changed, 22 insertions, 23 deletions
diff --git a/v/entry.S b/v/entry.S
index b4d7a92..96f0ca5 100644
--- a/v/entry.S
+++ b/v/entry.S
@@ -54,9 +54,9 @@ save_tf: # write the trap frame onto the stack
STORE x31,31*REGBYTES(x2)
csrr x3,sup0
- STORE x3,1*REGBYTES(x2) # x1 is in PCR_K0
+ STORE x3,1*REGBYTES(x2) # x1 is in sup0
csrr x3,sup1
- STORE x3,2*REGBYTES(x2) # x2 is in PCR_K1
+ STORE x3,2*REGBYTES(x2) # x2 is in sup1
# get sr, epc, badvaddr, cause
csrr x3,status # sr
@@ -80,7 +80,7 @@ save_tf: # write the trap frame onto the stack
STORE x3,36*REGBYTES(x2)
1:
- ret
+ jr x1
.globl pop_tf
pop_tf: # write the trap frame onto the stack
@@ -132,48 +132,47 @@ pop_tf: # write the trap frame onto the stack
.global trap_entry
trap_entry:
- csrw sup0,ra
+ csrw sup0,x1
csrw sup1,x2
# coming from kernel?
- csrr ra,status
- and ra,ra,SR_PS
- bnez ra, 1f
+ csrr x1,status
+ and x1,x1,SR_PS
+ bnez x1, 1f
# no, so start at the top of the stack
la x2,STACK_TOP-SIZEOF_TRAPFRAME_T
- jal save_tf
+ jal x1, save_tf
move sp,x2
csrs status,SR_EI
- move a0,x2
- csrr ra,status
- and ra,ra,SR_EA
- beqz ra,2f
- addi x2,x2,37*REGBYTES
+ move a0,sp
+ csrr t0,status
+ and t0,t0,SR_EA
+ beqz t0,2f
+ addi t0,sp,SIZEOF_TRAPFRAME_T_SCALAR
# rocket currently doesn't support vxcptsave/vxcptrestore natively
csrr x3,impl
li x4,IMPL_ROCKET
bne x3,x4,3f
vgetcfg x4
- STORE x4,0*REGBYTES(x2)
+ STORE x4,0*REGBYTES(t0)
vgetvl x4
- STORE x4,1*REGBYTES(x2)
- addi x2,x2,2*REGBYTES
- vxcptevac x2
+ STORE x4,1*REGBYTES(t0)
+ addi t0,t0,2*REGBYTES
+ vxcptevac t0
j 2f
# native vxcptsave
-3:vxcptsave x2
+3:vxcptsave t0
2:jal handle_trap
# when coming from kernel, continue below its stack
# we assume vector unit wasn't used in kernel
-1:li x2,SIZEOF_TRAPFRAME_T_SCALAR
- sub x2,sp,x2
- jal save_tf
+1:addi x2,sp,-SIZEOF_TRAPFRAME_T_SCALAR
+ jal x1, save_tf
move sp,x2
csrs status,SR_EI
- move a0,x2
+ move a0,sp
jal handle_trap
unimp
diff --git a/v/vm.c b/v/vm.c
index deb46c2..0051963 100644
--- a/v/vm.c
+++ b/v/vm.c
@@ -159,7 +159,7 @@ void handle_trap(trapframe_t* tf)
{
if (tf->cause == CAUSE_SYSCALL)
{
- int n = tf->gpr[18];
+ int n = tf->gpr[10];
for (long i = 1; i < MAX_TEST_PAGES; i++)
evict(i*PGSIZE);