diff options
| author | Chen Gang <gang.chen.5i5j@gmail.com> | 2015-10-04 17:41:14 +0800 |
|---|---|---|
| committer | Richard Henderson <rth@twiddle.net> | 2015-10-07 20:24:04 +1100 |
| commit | fec7daab3d63b7b2ca61581fffc40142b22b2bd5 (patch) | |
| tree | 265ec0eb27679df78f101410447fb1376627a405 /target-tilegx/helper.c | |
| parent | 77b3adc0012153e629b48b710ad19a8b544bb507 (diff) | |
| download | focaccia-qemu-fec7daab3d63b7b2ca61581fffc40142b22b2bd5.tar.gz focaccia-qemu-fec7daab3d63b7b2ca61581fffc40142b22b2bd5.zip | |
target-tilegx: Support iret instruction and related special registers
EX_CONTEXT_0_0 is used for jumping address, and EX_CONTEXT_0_1 is for INTERRUPT_CRITICAL_SECTION, which should only be 0 or 1 in user mode, or it will cause target SIGILL (and the patch doesn't support system mode). Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-tilegx/helper.c')
| -rw-r--r-- | target-tilegx/helper.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/target-tilegx/helper.c b/target-tilegx/helper.c index 36b287f84a..dda821f5cb 100644 --- a/target-tilegx/helper.c +++ b/target-tilegx/helper.c @@ -22,6 +22,7 @@ #include "qemu-common.h" #include "exec/helper-proto.h" #include <zlib.h> /* For crc32 */ +#include "syscall_defs.h" void helper_exception(CPUTLGState *env, uint32_t excp) { @@ -31,6 +32,27 @@ void helper_exception(CPUTLGState *env, uint32_t excp) cpu_loop_exit(cs); } +void helper_ext01_ics(CPUTLGState *env) +{ + uint64_t val = env->spregs[TILEGX_SPR_EX_CONTEXT_0_1]; + + switch (val) { + case 0: + case 1: + env->spregs[TILEGX_SPR_CRITICAL_SEC] = val; + break; + default: +#if defined(CONFIG_USER_ONLY) + env->signo = TARGET_SIGILL; + env->sigcode = TARGET_ILL_ILLOPC; + helper_exception(env, TILEGX_EXCP_SIGNAL); +#else + helper_exception(env, TILEGX_EXCP_OPCODE_UNIMPLEMENTED); +#endif + break; + } +} + uint64_t helper_cntlz(uint64_t arg) { return clz64(arg); |