this is my first operating system project, im planning to make an os with some jewish fetures hence the name ShabbOS - (the shabbos/shabbat/sabbath is the jewish religeous day)
used for learning os design
this is my first operating system project, im planning to make an os with some jewish fetures hence the name ShabbOS - (the shabbos/shabbat/sabbath is the jewish religeous day)
used for learning os design
this is a very cool feature of the cpu.
imagine you accidentally overflow your stack. what now?
well, a page fault exception is likely to occur!
but what if you do not have a page fault exception handler yet?
the answer: the double fault. its kind of a catch all statement that catches all exceptions that their handler is not present. or there was an error while handlinfg a certain exception.
so back to out stack overflow example, if our stack is full now and a double fault was triggered, how will we to to the handler function if we do not have a stack to push the data into? (return addr register data etc..)
we need to preform what is called a stack switch, we switch the stack to a predifeind valid one before each time we enter a double fault handler!
the new stack addr is stored in a data structure called the ist inside the tss inside the gdt (a lot of acronyms lol)
im not gonna explain these data structures but just know they contain crucial data for the operating system proper operation
and (bonus fact) in x86 times (32 bit) the gdt was the primary source of memory security and memory management (now all of that is passed to the paging mechanism)
the image shown here is an example of a propper kernel panic after a double fault! if i didnt handle it properlly the cpu would trigger a triple fault which most cpus just treat by rebooting the machine
Log in to leave a comment
i created a virtual buffer thats mapped to the vga buffer to write ascii to and created print! println! and dbg! macros
i have setup a bare bones testing environment with a custom print_serial! function that (only in testing) prints output from the kernel straight to my console
Log in to leave a comment