Hello, I've (at last) successfully created basic of os - software interrupts in ring 3. Now I am aiming to crate hardware handling for for ex. PIT interrupt. I get back to user mode switch code and pushed corrected eflags on to stack, so the iret will pop ant set the register. After doing this my code fails.
Code:
.global usermode_switch
.type usermode_switch, @function
usermode_switch:
#Data segment setup
mov $0x13, %ax
mov %ax, %ds
mov %ax, %gs
mov %ax, %fs
mov %ax, %es
#Stack save
mov %esp, %eax
#stack setup for iret and user space return
pushl $0x13
pushl %eax
pushf
#enable ints after switch to ring 3
pop %eax
or $0x200, %eax
pushl %eax
#CS selector
pushl $0x0b
pushl $end_switch
iret
.extern upperKernelCode
end_switch:
call upperKernelCode
bochs log says only :
Code:
interrupt(): gate descriptor is not valid sys seg (vector=0x08)
and the two more faults.
Edit: I should mention that
Code:
call upperKernelCode
generates GPF