Skip to contentSkip to conversation

add with PC in argument

Qemu-devel claude vittoria 1 participant 1 message Feb 26, 2008

lore
Share & tools
lore
#0 lore raw
Quoted 13 lines · claude vittoria
Quoted 11 lines

So in qemu I don't get the same comportement. The add of lr = pc + 4 gives lr = pc + 8 into qemu.
I think that s->pc += 4 at start of disas_arm_insn alters the result. Could you confirm ?

 0x7c    add    lr, pc, #4
 0x80    ldr    pc, =SystemInterrupt
 0x84    ldr    r3, [sp, #PSR_OFF]  <= never executed in Qemu
 0x88    msr    spsr_cxsf, r3        @ put cpsr in SPSR
 0x8c    ldmia    sp, {r0-r15}^        @ restore Context
Quoted 7 lines

The add lr,pc, #4 will put 0x88 into lr. As Daniel wrote, in ARM mode, when an instruction which address is addr reads the PC, it will read addr + 8.

Given the mutekh link you provide has no source code for ARM (at least I couldn't find it), we can't guess where the ldr pc jumps to.

Thanks for answer.

You are right :
cited of ARM Architecture Reference Manual

"Reading the program counter
When an instruction reads the PC, the value read depends on which instruction set it comes from:
• For an ARM instruction, the value read is the address of the instruction plus 8 bytes. Bits [1:0] of this value are always zero, because ARM instructions are always word-aligned."

Yes MutekH is the new release, I didn't take care of the release. To find the version that I m testing (porting), http://www-asim.lip6.fr/recherche/disydent/, take disydent source and you find a directory oes where are the kernel source.

I taken a short way, I was starting of http://www.ens-lyon.fr/LIP/Pub/Rapports/RR/RR2006/RR2006-12.pdf, source http://perso.ens-lyon.fr/nicolas.fournel/projects/ARM/mutek.html.

The port has been tested with skyeyes, it seems that a bug in source or in skyeyes, I should have read the RM before to post... as often :o)

Thanks a lot again,
Claude