installing own GDT using gdt_flush() why jmp 0x08:flush2
Posted: Wed Jan 30, 2008 12:53 pm
hello friends,
i have been following the OS tutorial by bran and have been currently studying the topic GDT. What i am finding difficult to understand is the use of the instruction jmp 0x08:flush2 to load the cs with the appropriate value. i understand that 0x08 is the location for the kernel code in the GDT created to be installed, but i don't understand how the jmp statement is loading the code segment with the base address of the kernel code.
the code is,
global _gdt_flush
extern _gp
_gdt_flush:
lgdt [_gp]
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:flush2
flush2:
ret
thank you for your time. any help and suggestion will be extremely appreciated.
i have been following the OS tutorial by bran and have been currently studying the topic GDT. What i am finding difficult to understand is the use of the instruction jmp 0x08:flush2 to load the cs with the appropriate value. i understand that 0x08 is the location for the kernel code in the GDT created to be installed, but i don't understand how the jmp statement is loading the code segment with the base address of the kernel code.
the code is,
global _gdt_flush
extern _gp
_gdt_flush:
lgdt [_gp]
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:flush2
flush2:
ret
thank you for your time. any help and suggestion will be extremely appreciated.