[Vm-dev] [GSoC] Progress on the GdbARMPlugin
Lars
lars.wassermann at googlemail.com
Mon Jul 9 19:28:17 UTC 2012
Hello squeak-dev,
in the last weeks, based on my simple code examples, I tried to copy the
BochsIA32Plugin structures and adapt it to ARMulator/libopcodes. So far,
I am able to run code sequentially with memory bounds checks. The
(copied) test testExecutionTrap and testResetCPU are green. The
testCallTrap might also be green, once I figured out what the
correspondent of the IA32 call opcode in ARM is.
The code for library tests and the c-part of the plugin is accessible on
Github[1].
For these tests, I implemented an alternative memory interface
(armulmem.c). The problem with bounds checking and especially execution
bounds was the prefetching emulation: Whenever an instruction is
executed, the next two words are read from memory, too. Because of that,
it is not possible to quit with the appropriate error code in the memory
interface.
The current solution uses a custom Software Interrupt (0x200000). The
memory interface returns the 'SWI 0x200000' opcode whenever it is asked
for an instruction at an invalid address. This is implemented in
ARMul_ReLoadInstr. For random memory access, the corresponding functions
are GetWord and PutWord, which stop simulation immediately.
An interesting detail about the ARMulator is, that it is also the base
for the ARM-Emulator used in Skyeye, beside being used in gdb. In case
anybody wants to try using my code examples, it is very important to
compile libsim.a with -DMODET (which is default on my system) or
disabling that flag in GdbARMPlugin.h. That little flag took me at least
two days, because it changes multiple offsets in the main struct
ARMul_State.
What still is not included on that site is reporting. The Bochs test
cases show that there should be string-errors. The ARMulator does not
provide those strings, and since so far this is the only error, I put no
additional effort into that.
The next step is getting the testNfib* green. These compute the
Fibonacci function for different arguments. For that, I need to
understand the ARM ABI[2].
I'd be grateful if anybody can recommend a more abstract source for the
ARM ABI.
Enjoy your evening,
Lars
[1] https://github.com/mas7ermind/gdb-arm-tests
https://github.com/mas7ermind/squeakvm-armulator-plugin
[2]
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ihi0036b/index.html
More information about the Vm-dev
mailing list