aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunsup Lee <yunsup@cs.berkeley.edu>2010-10-26 02:20:44 -0700
committerYunsup Lee <yunsup@cs.berkeley.edu>2010-10-26 02:20:44 -0700
commit9fe7d4f656dd3c6bfe6be17d2e48eacb59ad00f5 (patch)
tree1a433c0148d3751fa90109da5632420fd9b4e152
parent6ba19295c02fc04ddba539ef13fb411d3587a799 (diff)
downloadriscv-pk-9fe7d4f656dd3c6bfe6be17d2e48eacb59ad00f5.zip
riscv-pk-9fe7d4f656dd3c6bfe6be17d2e48eacb59ad00f5.tar.gz
riscv-pk-9fe7d4f656dd3c6bfe6be17d2e48eacb59ad00f5.tar.bz2
[pk,sim,xcc] get rid of at register, introduce tp register
-rw-r--r--pk/entry.S10
-rw-r--r--pk/pk.c10
-rw-r--r--pk/pk.h1
-rw-r--r--pk/syscall.c8
4 files changed, 11 insertions, 18 deletions
diff --git a/pk/entry.S b/pk/entry.S
index b128e93..628ecd5 100644
--- a/pk/entry.S
+++ b/pk/entry.S
@@ -49,7 +49,7 @@ save_tf: # write the trap frame onto the stack
mfpcr $x2,ASM_CR(PCR_K0)
STORE $x2,31*REGBYTES($x1) # $ra is actually in $PCR_K0
- # get sr, epc, badvaddr, cause, cr29 (tid)
+ # get sr, epc, badvaddr, cause
mfpcr $x2,ASM_CR(PCR_SR) # sr
STORE $x2,32*REGBYTES($x1)
mfpcr $x3,ASM_CR(PCR_EPC) # epc
@@ -58,13 +58,11 @@ save_tf: # write the trap frame onto the stack
STORE $x2,34*REGBYTES($x1)
mfpcr $x2,ASM_CR(PCR_CAUSE) # cause
STORE $x2,35*REGBYTES($x1)
- mfcr $x2,ASM_CR(29) # cr29 (tid)
- STORE $x2,36*REGBYTES($x1)
# get insn
and $x3,$x3,~3
lw $x2,0($x3)
- STORE $x2, 37*REGBYTES($x1)
+ STORE $x2, 36*REGBYTES($x1)
jr $ra
.end save_tf
@@ -111,10 +109,6 @@ pop_tf: # write the trap frame onto the stack
LOAD $x30,30*REGBYTES($x1)
LOAD $x31,31*REGBYTES($x1)
- # restore cr29 (tid)
- LOAD $x2,35*REGBYTES($x1)
- mtcr $x2,ASM_CR(29)
-
# gtfo!
LOAD $x2,33*REGBYTES($x1)
mtpcr $x2,ASM_CR(PCR_EPC)
diff --git a/pk/pk.c b/pk/pk.c
index c3be3a2..636fa40 100644
--- a/pk/pk.c
+++ b/pk/pk.c
@@ -105,10 +105,10 @@ void sprintk(char* out, const char* s, ...)
void dump_tf(trapframe_t* tf)
{
static const char* regnames[] = {
- "z ", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "a4", "a5", "a6", "a7", "t4", "t5", "t6", "t7",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
+ "z ", "tp", "v0", "v1", "a0", "a1", "a2", "a3",
+ "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3",
+ "t4", "t5", "t6", "t7", "s0", "s1", "s2", "s3",
+ "s4", "s5", "s6", "s7", "s8", "fp", "sp", "ra"
};
tf->gpr[0] = 0;
@@ -126,7 +126,7 @@ void init_tf(trapframe_t* tf, long pc, long sp)
{
memset(tf,0,sizeof(*tf));
tf->sr = mfpcr(PCR_SR) & ~(SR_PS | SR_ET);
- tf->gpr[29] = USER_MEM_SIZE-USER_MAINVARS_SIZE;
+ tf->gpr[30] = USER_MEM_SIZE-USER_MAINVARS_SIZE;
tf->epc = USER_START;
}
diff --git a/pk/pk.h b/pk/pk.h
index 4e3e687..0e56fcc 100644
--- a/pk/pk.h
+++ b/pk/pk.h
@@ -10,7 +10,6 @@ typedef struct
long epc;
long badvaddr;
long cause;
- long cr29;
long insn;
} trapframe_t;
diff --git a/pk/syscall.c b/pk/syscall.c
index 790f32d..d303324 100644
--- a/pk/syscall.c
+++ b/pk/syscall.c
@@ -109,7 +109,7 @@ void handle_syscall(trapframe_t* tf)
};
syscall_t p;
- unsigned long n = tf->gpr[1];
+ unsigned long n = tf->gpr[2];
if(n >= sizeof(syscall_table)/sizeof(void*) || !syscall_table[n])
{
dump_tf(tf);
@@ -118,9 +118,9 @@ void handle_syscall(trapframe_t* tf)
else
p = (syscall_t)syscall_table[n];
- sysret_t ret = p(tf->gpr[3],tf->gpr[4],tf->gpr[5],tf->gpr[6],n);
- tf->gpr[1] = ret.result;
- tf->gpr[2] = ret.result == -1 ? ret.err : 0;
+ sysret_t ret = p(tf->gpr[4],tf->gpr[5],tf->gpr[6],tf->gpr[7],n);
+ tf->gpr[2] = ret.result;
+ tf->gpr[3] = ret.result == -1 ? ret.err : 0;
//printk("syscall %d (%x,%x,%x,%x) from %x == %d\n",n,tf->gpr[4],tf->gpr[5],tf->gpr[6],tf->gpr[7],tf->gpr[31],tf->gpr[2]);