Hi
Suppose Ring0 task is running and we switch to Ring3.
Now we create another task, what will be the priveldge level of that task?
What I did is set up a syscall that creates new task ( loads the program from disk, creates new PCB node and sets up appropriate eip,esp and ebp,puts that node in the end and returns ).
The two task run fine and are prempted by scheduler, BUT as soon as i use qemu to check the CPL it shows 3 for older and 0 for this new task.
I am not able to understand what is wrong with it.
I might be missing something.
Please help?
Ring0 and Ring3?
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: Ring0 and Ring3?
Hi,
The privilege level will be whatever you set it to. You must explicitly set the privilege level for every task you create - that's just part of creating it.Now we create another task, what will be the priveldge level of that task?
Re: Ring0 and Ring3?
Hi,
Cheers,
Brendan
In this case; if the new task is meant to start running CPL=3 code immediately then your kernel probably put the wrong value for "current CS" into the new task's TSS; or, if the new task is meant to start running some kernel/scheduler code before returning to CPL=3 then the kernel probably put the wrong value for "return CS" on the new task's kernel stack.Raven wrote:What I did is set up a syscall that creates new task ( loads the program from disk, creates new PCB node and sets up appropriate eip,esp and ebp,puts that node in the end and returns ).
The two task run fine and are prempted by scheduler, BUT as soon as i use qemu to check the CPL it shows 3 for older and 0 for this new task.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Ring0 and Ring3?
Hi
The interrupt to create a new task is invoked by a task running in CPL=3 and the TSS (only TSS in system) has cs,ds,es,fs and gs set to kernel mode with RPL=3. Within this ISR as said node is created,populated and placed. Now, when i return from that ISR the CPL should be 3, correct ?
Now, i am confused how to set the CPL=3 for new task as this will be scheduled by scheduler.
Should i put a flag in PCB which will tell me whether to push Ring3 CS,DS, etc. on stack so that they be popped by scheduler for new task only?
Please help
The interrupt to create a new task is invoked by a task running in CPL=3 and the TSS (only TSS in system) has cs,ds,es,fs and gs set to kernel mode with RPL=3. Within this ISR as said node is created,populated and placed. Now, when i return from that ISR the CPL should be 3, correct ?
Now, i am confused how to set the CPL=3 for new task as this will be scheduled by scheduler.
Should i put a flag in PCB which will tell me whether to push Ring3 CS,DS, etc. on stack so that they be popped by scheduler for new task only?
Please help