diff options
author | Yunsup Lee <yunsup@cs.berkeley.edu> | 2010-10-17 14:08:12 -0700 |
---|---|---|
committer | Yunsup Lee <yunsup@cs.berkeley.edu> | 2010-10-17 14:08:12 -0700 |
commit | 9297008e44254848cfa42726272640b641282665 (patch) | |
tree | 026813cd81b607994d156f399d5e725b7952bc7a /pk | |
parent | b4fd490d689415205cf315c02f673b9386ece337 (diff) | |
download | pk-9297008e44254848cfa42726272640b641282665.zip pk-9297008e44254848cfa42726272640b641282665.tar.gz pk-9297008e44254848cfa42726272640b641282665.tar.bz2 |
[pk] zero out fp regs
Diffstat (limited to 'pk')
-rw-r--r-- | pk/fp.c | 36 | ||||
-rw-r--r-- | pk/pk.c | 13 | ||||
-rw-r--r-- | pk/pk.h | 1 |
3 files changed, 50 insertions, 0 deletions
@@ -183,6 +183,42 @@ int emulate_fp(trapframe_t* tf) return 0; } +void init_fpregs() +{ + set_fp_reg(0, 1, 0); + set_fp_reg(1, 1, 0); + set_fp_reg(2, 1, 0); + set_fp_reg(3, 1, 0); + set_fp_reg(4, 1, 0); + set_fp_reg(5, 1, 0); + set_fp_reg(6, 1, 0); + set_fp_reg(7, 1, 0); + set_fp_reg(8, 1, 0); + set_fp_reg(9, 1, 0); + set_fp_reg(10, 1, 0); + set_fp_reg(11, 1, 0); + set_fp_reg(12, 1, 0); + set_fp_reg(13, 1, 0); + set_fp_reg(14, 1, 0); + set_fp_reg(15, 1, 0); + set_fp_reg(16, 1, 0); + set_fp_reg(17, 1, 0); + set_fp_reg(18, 1, 0); + set_fp_reg(19, 1, 0); + set_fp_reg(20, 1, 0); + set_fp_reg(21, 1, 0); + set_fp_reg(22, 1, 0); + set_fp_reg(23, 1, 0); + set_fp_reg(24, 1, 0); + set_fp_reg(25, 1, 0); + set_fp_reg(26, 1, 0); + set_fp_reg(27, 1, 0); + set_fp_reg(28, 1, 0); + set_fp_reg(29, 1, 0); + set_fp_reg(30, 1, 0); + set_fp_reg(31, 1, 0); +} + #define STR(x) XSTR(x) #define XSTR(x) #x @@ -130,6 +130,18 @@ void init_tf(trapframe_t* tf, long pc, long sp) tf->epc = USER_START; } +void init_fp() +{ + if (have_fp) + { + register long sr; + sr = mfpcr(PCR_SR); + mtpcr(sr | SR_EF, PCR_SR); + init_fpregs(); + mtpcr(sr, PCR_SR); + } +} + void bss_init() { extern char edata,end; @@ -146,6 +158,7 @@ void mainvars_init() void jump_usrstart() { + init_fp(); trapframe_t tf; init_tf(&tf, USER_START, USER_MEM_SIZE-USER_MAINVARS_SIZE); pop_tf(&tf); @@ -25,6 +25,7 @@ extern "C" { extern int have_fp; int emulate_fp(trapframe_t*); +void init_fpregs(); void printk(const char* s, ...); void init_tf(trapframe_t*, long pc, long sp); |