UNKNOWN EIP issue
Posted: Fri Apr 24, 2015 12:28 pm
Ok, so I have been writing an ELF loader, when I realized my DEBUG_print(f) somehow changes EIP to 0x80010.
So, I removed that code and did this in my main function:
DisAsm-INTEL (with extra BS):
Just as a way to test, before it is through the loop (ebx says we made it to 0xDBAC8) INT 32 (0x20) is fired.
No this is not the PIT as it is masked in the PIC and if I remove the loop we end up with no issue.
outb():
DisAsm-INTEL:
I see no reference to 0x80010 in the binary
My INT Handler reports:
This has stumped me for days now, anyone have an idea where to look or if I'm just blind and missed something obvious?
It is not Stack overflow as the stack is from 0x109000 - 0x107000.
The kernel ELF is loaded at 0x100000 - 0x10A8A0.
So, I removed that code and did this in my main function:
Code: Select all
for(uint32_t xx = 0; xx < 0xFFFF0 ; xx++)
outb(DEBUG_PORT, (uint8_t) 'a');
Code: Select all
1000ac: bb f0 ff 0f 00 mov ebx,0xffff0
1000b1: c7 04 24 d2 53 10 00 mov DWORD PTR [esp],0x1053d2
1000b8: e8 d3 04 00 00 call 100590 <DEBUG_printf>
1000bd: c7 44 24 04 00 90 10 mov DWORD PTR [esp+0x4],0x109000
1000c4: 00
1000c5: c7 04 24 28 50 10 00 mov DWORD PTR [esp],0x105028
1000cc: e8 bf 04 00 00 call 100590 <DEBUG_printf>
1000d1: 8d b4 26 00 00 00 00 lea esi,[esi+eiz*1+0x0]
1000d8: c7 44 24 04 61 00 00 mov DWORD PTR [esp+0x4],0x61
1000df: 00
1000e0: c7 04 24 e9 00 00 00 mov DWORD PTR [esp],0xe9
1000e7: e8 14 00 00 00 call 100100 <outb>
1000ec: 83 eb 01 sub ebx,0x1
1000ef: 75 e7 jne 1000d8 <kmain+0x98>
No this is not the PIT as it is masked in the PIC and if I remove the loop we end up with no issue.
outb():
Code: Select all
void outb(uint16_t port, uint8_t data)
{
__asm__ __volatile__ ("outb %1, %0" : : "dN" (port), "a" (data));
}
Code: Select all
00100100 <outb>:
100100: 8b 44 24 08 mov eax,DWORD PTR [esp+0x8]
100104: 8b 54 24 04 mov edx,DWORD PTR [esp+0x4]
100108: ee out dx,al
100109: c3 ret
10010a: 8d b6 00 00 00 00 lea esi,[esi+0x0]
My INT Handler reports:
Code: Select all
UNHANDLED INTERRUPT ENCOUNTERED!
INTERRUPT # 32
FATAL ERROR:
EAX = 0x61 EBX = 0xDBAC8 ECX = 0x1F EDX = 0xE9
EDI = 0x26455 ESI = 0x2640D EBP = 0x67EDC ESP = 0x108FC6
GS = 0x10 FS = 0x62600010 ES = 0x62600010 DS = 0x47E80010
EIP = 0x80010 CS = 0x2020000 EFLAGS = 0xE90000 SS = 0x0
USER-ESP = 0x610000 ERROR-CODE = 0xEC0000
EIP RAM DUMP (EIP - 10) - (EIP + 10):
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 [0x0] 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
ESP RAM DUMP (ESP - 10) - (ESP + 10):
0x0 0x0 0x1F 0x0 0x0 0x0 0x61 0x0 0x0 0x0 [0x20] 0x0 0x0 0x0 0x0 0x0 0xEC 0x0 0x10 0x0
It is not Stack overflow as the stack is from 0x109000 - 0x107000.
The kernel ELF is loaded at 0x100000 - 0x10A8A0.