Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global loadGDT
- //void _stdcall loadGDT(struct gdtp* ptr);
- loadGDT:
- mov $0x4(%esp), %eax ; Load argument
- mov $smallMod, %ebx ; This is for the code manipulation coming up
- mov %eax, $0x1(%ebx) ;Store it to the address
- .smallMod:
- lgdt $0xBADB002 ;Address gets changed by instruction above
- ;GDT is loaded now
- mov $0x10, %ax
- mov %ax, %ds
- mov %ax, %es
- mov %ax, %fs
- mov %ax, %gs
- mov %ax, %ss
- ljmp $0x8, $.1
- .1:
- /// And the same thing in NASM
- global loadGDT
- ;void _stdcall loadGDT(struct gdtp* ptr);
- loadGDT:
- mov eax, [esp+4]
- mov ebx, [smallMod]
- mov [ebx+1], eax
- smallMod:
- lgdt 0xBADB002 ;Address gets changed by instruction above
- mov ax, 0x10
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov ss, ax
- jmp 0x8:end
- end:
Advertisement
Add Comment
Please, Sign In to add comment