Code: Select all
mov edx, dword [esp+4]
Code: Select all
pop edx
Code: Select all
mov edx, dword [esp+4]
Code: Select all
pop edx
I am aware! Popped was the wrong word to use I was still accessing the parameter; not the return address. Thanks anyways.nexos wrote:You're still violating the ABI . You should be doing this:Right now, you're accessing the function return address (not the first parameter) if you just didCode: Select all
mov edx, dword [esp+4]
Code: Select all
pop edx
Code: Select all
check_exception old: 0xffffffff new 0xd
0: v=0d e=0010 i=0 cpl=0 IP=0008:0010001b pc=0010001b SP=0010:00301fb4 env->regs[R_EAX]=00000010
Code: Select all
GDT DefaultGDT = {
{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
{0x8000, 0x0, 0x0, 0x9A, 0x0, 0xC, 0x0},
{0x8000, 0x0, 0x0, 0x92, 0x0, 0xC, 0x0},
{0x8000, 0x0, 0x0, 0xFA, 0x0, 0xC, 0x0},
{0x8000, 0x0, 0x0, 0xF2, 0x0, 0xC, 0x0}
};
Why is this address 17 megabytes above the start of your kernel? How big is your kernel, anyway?YDeeps1 wrote:I have also logged the address of the GDT offset + size table address (decimal 18874372) which matches up with the EDX register, removing some possibilities.
I was about to answer that. My kernel is actually only a few kilobytes maximum but to avoid any possibility such as my stack doing something to the GDT like accidentally overwriting it due to some other critical mistake I have instead stored it in my heap which I set to be about 20M above to remove this doubt.Octocontrabass wrote:Why is this address 17 megabytes above the start of your kernel? How big is your kernel, anyway?YDeeps1 wrote:I have also logged the address of the GDT offset + size table address (decimal 18874372) which matches up with the EDX register, removing some possibilities.
Code: Select all
;C interface: void load_gdt(const void *gdt, size_t sz);
global load_gdt
load_gdt:
sub esp, 8
mov eax, [esp+12]
mov cx, [esp+16] ; if this exceeds 2 bytes, you have a problem, anyway
dec cx
mov [esp+4], eax
mov [esp+2], cx
lgdt [esp+2]
add esp, 8
ret