gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > bug in GDB arm emulator

#11224 - MattyMatt - Mon Sep 29, 2003 3:35 pm

I've found what looks like a bug in the ARM emulator (arm mode) in the gdb with DKA-r5-b3. Can someone confirm this before I submit it to GNU?

<addr> mov lr,pc

after this instruction, pc is set to <addr+4> as expected but lr is <addr+8>

#11225 - tepples - Mon Sep 29, 2003 4:27 pm

This is expected. Because of the ARM pipeline that executes an instruction two cycles after it's fetched, a mov from pc actually uses the address of the second instruction after the instruction. This would be pc+4 in thumb mode or pc+8 in ARM mode.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.