This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: : several questions
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: 张 亮 <johnsonest at hotmail dot com>
- Cc: ecos-discuss at sources dot redhat dot com, gary at chez-thomas dot org
- Date: 16 Aug 2004 10:23:28 +0100
- Subject: Re: [ECOS]: several questions
- References: <BAY14-F3241xbt3a6jT00059a4d@hotmail.com>
张 亮 <johnsonest@hotmail.com> writes:
> Dear all,
> I have several question about ecos2.0 on ARM achitecture:
> 1)It seemed that all threads(including user threads)
> runing in SVC mode.because ecos
> init thread context' CPSR as SVC mode with interrupt
> enabled,when resume it, it will run in SVC mode.I feel it is
> not reasnable, user may be destroy system mode.
eCos is for embedded use and is not a multi-user operating system. It
does not support memory protection and running in USR mode provides no
additional protection. It would simply make it harder to execute
privileged operations and would make the ARM HAL radically different
from all the other architectures we support.
> 2) handle_IRQ_or_FIQ:
>
> mrs r4,cpsr // switch to Supervisor Mode
> bic r4,r4,#CPSR_MODE_BITS
> orr r4,r4,#CPSR_SUPERVISOR_MODE
> msr cpsr,r4 /********here, enable interrupt! if at this
> point, new interrupt occurs, context
> destroyed,right?************************?/
Why do you believe that this enables interrupts? Only the CPU mode
field of the CPSR is changed here.
> 3)
>
> FUNC_START_ARM(hal_thread_load_context, r2)
> ldr fp,[r0] // get context to restore
> mrs r0,cpsr // disable IRQ's
> orr r0,r0,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
> msr cpsr,r0
> ldr r0,[fp,#armreg_cpsr]
> msr spsr,r0
> ldmfd fp,{r0-r10,fp,ip,sp,lr}
> #ifdef __thumb__
> mrs r1,spsr // r1 is scratch
> // [r0 holds initial thread arg]
> msr cpsr,r1 // hopefully no mode switch
> here!*****************if mode swtiched, system down!
> RIGHT?****************************/
What makes you think there would be a mode switch here? As we have
already established, eCos runs in SVC mode.
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com/ The eCos and RedBoot experts
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss