aboutsummaryrefslogtreecommitdiff
path: root/pk
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-09-11 17:07:37 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-09-11 17:07:37 -0700
commite81b125dc425f9f19e25140ea4f29783705fe52e (patch)
tree6c2315e1feb830c88f203d86609eff3a48f9bb46 /pk
parentd2d16a63e273de44889cfa94106ab9bf2b64e604 (diff)
downloadpk-e81b125dc425f9f19e25140ea4f29783705fe52e.zip
pk-e81b125dc425f9f19e25140ea4f29783705fe52e.tar.gz
pk-e81b125dc425f9f19e25140ea4f29783705fe52e.tar.bz2
Fix single-precision FP emulation
Diffstat (limited to 'pk')
-rw-r--r--pk/mtrap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/pk/mtrap.h b/pk/mtrap.h
index 62d0078..32c9c37 100644
--- a/pk/mtrap.h
+++ b/pk/mtrap.h
@@ -135,7 +135,7 @@ typedef uintptr_t (*emulation_func)(uintptr_t, uintptr_t*, insn_t, uintptr_t, ui
#else
# define GET_F64_REG(insn, pos, regs) (((int64_t*)(&(regs)[32]))[((insn) >> (pos)) & 0x1f])
# define SET_F64_REG(insn, pos, regs, val) (GET_F64_REG(insn, pos, regs) = (val))
-# define GET_F32_REG(insn, pos, regs) (*(int32_t*)GET_F64_REG(insn, pos, regs))
+# define GET_F32_REG(insn, pos, regs) (*(int32_t*)&GET_F64_REG(insn, pos, regs))
# define SET_F32_REG(insn, pos, regs, val) (GET_F32_REG(insn, pos, regs) = (val))
# define GET_FCSR() ({ register int tp asm("tp"); tp & 0xFF; })
# define SET_FCSR(value) ({ asm volatile("add tp, x0, %0" :: "rI"((value) & 0xFF)); })