Implement ASR(1)
Jeffrey Pfau jeffrey@endrift.com
Tue, 16 Apr 2013 23:22:01 -0700
1 files changed,
13 insertions(+),
1 deletions(-)
jump to
M
src/arm/isa-thumb.c
→
src/arm/isa-thumb.c
@@ -127,7 +127,19 @@ cpu->gprs[rd] = ((uint32_t) cpu->gprs[rm]) >> immediate;
} THUMB_NEUTRAL_S( , , cpu->gprs[rd]);) -DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(ASR1, ARM_STUB) +DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(ASR1, + if (!immediate) { + cpu->cpsr.c = ARM_SIGN(cpu->gprs[rm]); + if (cpu->cpsr.c) { + cpu->gprs[rd] = 0xFFFFFFFF; + } else { + cpu->gprs[rd] = 0; + } + } else { + cpu->cpsr.c = cpu->gprs[rm] & (1 << (immediate - 1)); + cpu->gprs[rd] = cpu->gprs[rm] >> immediate; + } + THUMB_NEUTRAL_S( , , cpu->gprs[rd]);) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDR1, cpu->gprs[rd] = cpu->memory->load32(cpu->memory, cpu->gprs[rm] + immediate * 4)) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDRB1, cpu->gprs[rd] = cpu->memory->loadU8(cpu->memory, cpu->gprs[rm] + immediate))