Thanks for the pointer to gdbstub. I just single stepped through the loop and see it behaving "as expected", which leads me to believe the performance issue doesn't show up in the execution of the client code. But it sounds like you are saying you see evidence of it executing at 0x9fffc? Can you elaborate?
Here's what I did, let me know if I'm misunderstanding. I ran
% qemu-system-x86_64 -s -S ./kernel.img
% gdb ./kernel.img
(gdb) target remote localhost:1234
Then set a breakpoint at the spin() function (see source
(gdb) b *0x7e00
At that point I stepped through the loop several times and it behaved as expected. I even "let it rip" with:
(gdb) while 1
> x/i $rip
And it stayed well behaved operating on the "client" code as I'd expect.
My next step would be to step through the emulator itself but it sounds like you are seeing something that would short circuit that labor intensive exercise. Pointers appreciated!