Exception handler of 3rd level privilege task

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Jane1991c
Posts: 22
Joined: Mon Oct 21, 2013 3:48 pm

Exception handler of 3rd level privilege task

Post by Jane1991c »

Hi,
My task is running segments for program/data with DPL=3

Let's say this task executes this code:

Code: Select all

mov cl, 0
div cl
Exception occurs (not executing interrupt handler procedure), but when it's executed by task at 3rd privilege level then bochs crashes, when its done by main task (0 lvl) then all is fine.

What should be done to allow exceptions to be thrown while 3rd lvl task is executed ?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Exception handler of 3rd level privilege task

Post by Combuster »

Jane1991c wrote:then bochs crashes
And you obviously did not bother to read the error log it produced while it did that.

The difference between exceptions from ring 0 and ring 3 is the mandatory stack switch. To find out which part of that is broken is homework for you (and a lesson in reading).
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Jane1991c
Posts: 22
Joined: Mon Oct 21, 2013 3:48 pm

Re: Exception handler of 3rd level privilege task

Post by Jane1991c »

Combuster wrote:
Jane1991c wrote:then bochs crashes
And you obviously did not bother to read the error log it produced while it did that.

The difference between exceptions from ring 0 and ring 3 is the mandatory stack switch. To find out which part of that is broken is homework for you (and a lesson in reading).
Do you mean ESP0/SS0 in TSS are missing ? They are set. Did you have on your mind something else ?

Bochs log:
01638740346e[CPU0 ] stackPrefetch(4): access [0xfffffffc] > SS.limit [0x00009100]
01638740346e[CPU0 ] stackPrefetch(4): access [0xfffffffc] > SS.limit [0x00009100]
01638740346e[CPU0 ] stackPrefetch(4): access [0xfffffffc] > SS.limit [0x00009100]
0x00009100 is my base address of my stack segment
Jane1991c
Posts: 22
Joined: Mon Oct 21, 2013 3:48 pm

Re: Exception handler of 3rd level privilege task

Post by Jane1991c »

Solved it
Post Reply