On 04/14/2011 03:18 AM, Philip Pemberton wrote:
> On 13/04/11 15:08, Lars-Peter Clausen wrote:
>> In my opinion one bit is enough. Kernel mode or user mode. Any other
>> setting
>> is unlikely to be used.
> 
> Fair enough -- as I said, the "pure" ARM only has two privilege levels.
> It's only really x86 and some MIPS implementations which have 4-level
> privilege separation.
> 
>> That is a bad assumption. For example: Interrupt during syscall or
>> debug break
>> during interrupt and even interrupt nesting can cause an exception while
>> another is already running.
> 
> I was under the impression that you couldn't have nested exceptions --
> doesn't a syscall disable interrupts?

syscall disables interrupts, but you can enable them again.
And there is also the concept of blocking syscalls, so the current task can get
suspended and another tasks resumes.
The suspended task could be a userspace task while the resumed task could be
kernel task. Or a another userspace task which was waiting on a blocking 
syscall.
So you really need to store the current privilege level when entering an
interrupt/syscall/exception context and restore it again when leaving.

> 
> Although I may be wrong about this -- in which case, let's have two
> privilege levels (one bit), and a 4-level stack. This way we're only
> using one nibble, but we can handle a situation where we have this
> nesting pattern:
>   Syscall ==> Interrupt ==> Debug Break
> 
> As I understand it, this is the deepest nesting pattern possible.
> 

This won't work for the case where you switch tasks. A software solution for
managing this is really the the way to go.

- Lars
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode
Twitter: www.twitter.com/milkymistvj
Ideas? http://milkymist.uservoice.com

Reply via email to