I have a weird little kernel experiment going on... I'm compiling my .c source files using the standard VC compiler (cl.exe), I generate my multiboot header and external assembly functions using NASM and I link the entire thing together using the GNU linker (ld.exe - MinGW version).
The reason I decided to go with the microsoft compiler, is because I like the MS way of doing inline assembly as well as other certain aspects of C. It also allows me to use my favorite IDE (Visual Studio 2005 pro). I decided to use the GNU linker because I like the way how it can be scripted. Besides all of that, I find it interesting to explore the possibility of using parts of different toolsets in one project.
But anyway... to get to my question: I borrowd some GDT code from a tutorial and at a certain point in my kernel I'm trying to install a new GDT table.
Code: Select all
global _gdt_flush ; Allows the C code to link to this
extern _gp ; Says that '_gp' is in another file
_gdt_flush:
lgdt [_gp] ; Load the GDT with our '_gp' which is a special pointer
mov ax, 0x10 ; 0x10 is the offset in the GDT to our data segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:flush2 ; 0x08 is the offset to our code segment: Far jump!
flush2:
ret ; Returns back to the C code!
Code: Select all
Exception(): 3rd (13) exception with no resolution
I'm a pretty experienced developer, but very new to OS development so be gentle with me
![Wink :wink:](./images/smilies/icon_wink.gif)