This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: : several questions


张 亮 <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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]