This is my repo: mios. Everything is working ok if this variable is not defined. I used the "cli;hlt" to stop in the function, I set the breakpoint in gdb and send nmi from qemu monitor to continue. The issue is:
Code: Select all
0x0000f3ae: push 0x81d8
0x0000f3b3: push 0xfedf <-- str to print
0x0000f3b8: call 0xdb95
0x0000f3bd: cli
0x0000f3be: hlt
=> 0x0000f3bf: mov ebx,0x81d8
0x0000f3c4: add esp,0x10
I also tried to define big array after this variable (and instead of it) just to see what it does. Did even char bigbuf[10240] = "AAA .... A" and test it with it. Print was not working but gdb dump shows that I didn't have array full of 10240 "A" in memory, just partially. As if even that was overwritten by 0s.
In the linker script I created a signature section to verify that the whole binary is loaded to memory.
When I dumped the memory from gdb I was able to find the string there. It can't be coincidence that it's at 0x1fedf. But I don't understand why. mm.o module is 32b.