In taskSwitchHook, I check if this is a safe task. If so, I write
protect the old task stack space in the page table,
and if unprotect the stack space for new task. But, sometimes I get data
access exception for resons unknown
to me.
I do know that the exception is data access...
Any help for this will be appreciated!
-Umesh
> In taskSwitchHook, I check if this is a safe task. If so, I write
> protect the old task stack space in the page table,
> and if unprotect the stack space for new task. But, sometimes I get
data
> access exception for resons unknown
> to me.
Two things come to mind:
1) Have you taken care of invalidating any TLB entries that may exist?
You don't say which PPC you are using, but even the lowliest of 8xx
members have some TLB entries. If you are changing the access
permissions of pages you need to flush the TLB of any affected entries
to make sure that the new task doesn't see those instead of reading the
translation tables in memory again.
2) If you have your cache in copyback mode, you want to ensure that you
are flushing the lines containing the updated page tables back to memory
since the cache is probably bypassed when a TLB miss occurs.
Hope that helps,
John...
Sent via Deja.com http://www.deja.com/
Before you buy.
Do we know if vxWorks ever writes to a task's stack space? If it does than
that will explain the issue I am seeing.
-Umesh
Disabling the MMU does not cause the TLB to be flushed - any
pre-existing translations will still be there when you switch the MMU
back on. You must explicitly flush it if you change PTEs which may be in
there. The normal symptom of this is that you can still access memory
that should be inaccessible though (since it will be the outgoing task's
accesses that are in the TLB). It is quite possible that you have TLB
entries still after your change, but I don't think that is your
problem...
> Do we know if vxWorks ever writes to a task's stack space? If it does
than
> that will explain the issue I am seeing.
During a context switch the outgoing task's stack is used to run the
scheduling code (including your hook function). You cannot make that
task's stack inaccessible in a hook routine. To achieve what you want to
achieve is actually quite difficult because of this; in fact I'm not
sure it is possible without re-writing a lot of the rescheduling code!
Sorry,