help me with these codes.
Posted: Tue Jun 03, 2008 8:09 am
Hi, I was reading the articles at http://www.jamesmolloy.co.uk/tutorial_h ... 20IDT.html.
And I saw a piece of code like this:
I can not understand two lines:
1) mov eax, [esp+4]. I usually use ebp register to access a parameter in a function. But there use esp register to do this job. I can not imagine what's the current stack like at this time.
2)jmp 0x08:.flush. I do not know where the instruction will jmp to.
Can any one give me some tips?Thanks.
And I saw a piece of code like this:
Code: Select all
[GLOBAL gdt_flush] ; Allows the C code to call gdt_flush().
gdt_flush:
mov eax, [esp+4] ; Get the pointer to the GDT, passed as a parameter.
lgdt [eax] ; Load the new GDT pointer
mov ax, 0x10 ; 0x10 is the offset in the GDT to our data segment
mov ds, ax ; Load all data segment selectors
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:.flush ; 0x08 is the offset to our code segment: Far jump!
.flush:
ret
1) mov eax, [esp+4]. I usually use ebp register to access a parameter in a function. But there use esp register to do this job. I can not imagine what's the current stack like at this time.
2)jmp 0x08:.flush. I do not know where the instruction will jmp to.
Can any one give me some tips?Thanks.