ISR error in c++ kernel, c kernel works fine
Posted: Thu Jul 26, 2007 2:50 pm
Hi, all.
This is the first time I had to resort to posting, because i always found a solution on this forum before.
Anyway, the story so far is this:
I started with Bran's kernel development tutorial and then added a PMM and a VMM. Then I decided to start version 0.02 of my OS, because the code had become to complex and i needed to clean it up. At that time I decided to rewrite the whole thing using c++ because I prefer the OO approach.
I have the PMM, VMM, GDT and IDT classes and they work fine. I also have the ISR class which installs the routines and my isr_common_stub calls a void fault_handler function that is not in the ISR class.
I install the isrs, enable interrupts and then generate a divide by zero exception. In the fault handler I print out the register contents on the stack:
As you can see, the problem is in the int_no and err_code. I allwys get int_no=8 and err_code=gibberish, but in the C kernel this worked fine (and I enabled paging before anything else, just like now).
So my question is this:
Does c++ do something differently or do I have to implement support fo exceptions for this to work?
Thanks all
This is the first time I had to resort to posting, because i always found a solution on this forum before.
Anyway, the story so far is this:
I started with Bran's kernel development tutorial and then added a PMM and a VMM. Then I decided to start version 0.02 of my OS, because the code had become to complex and i needed to clean it up. At that time I decided to rewrite the whole thing using c++ because I prefer the OO approach.
I have the PMM, VMM, GDT and IDT classes and they work fine. I also have the ISR class which installs the routines and my isr_common_stub calls a void fault_handler function that is not in the ISR class.
I install the isrs, enable interrupts and then generate a divide by zero exception. In the fault handler I print out the register contents on the stack:
Code: Select all
gs: 0x10 fs: 0x10 es: 0x10 ds: 0x480010
edi: 0x2ca44 esi: 0x2ca43 ebp: 0x487fe8 esp: 0x487fac
eax: 0x8 ebx: 0x2c8e0 ecx: 0xb8000 edx: 0x4881ec
eip: 0x8 cs: 0x206 eflg: 0x4008ed esp3: 0x2c8e0
ss: 0x2badb002
int_no: 8 err_code: 4197307
So my question is this:
Does c++ do something differently or do I have to implement support fo exceptions for this to work?
Thanks all