diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-08 18:42:26 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-08 18:42:26 +0000 |
commit | 47ebc42ac1eebdd9b33d22adfd91c56b50016ef9 (patch) | |
tree | ebe748f797b72d262a970379d945a8546a7208fe | |
parent | 2e30a3f65595e997fd3a6648b50a1d07815c39c3 (diff) | |
download | nuttx-47ebc42ac1eebdd9b33d22adfd91c56b50016ef9.tar.gz nuttx-47ebc42ac1eebdd9b33d22adfd91c56b50016ef9.tar.bz2 nuttx-47ebc42ac1eebdd9b33d22adfd91c56b50016ef9.zip |
Add kernel mode hooks and reminders for other architectures
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3484 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/arch/avr/src/avr32/up_initialstate.c | 11 | ||||
-rw-r--r-- | nuttx/arch/sh/src/sh1/sh1_initialstate.c | 20 | ||||
-rw-r--r-- | nuttx/arch/x86/src/i486/up_initialstate.c | 11 |
3 files changed, 42 insertions, 0 deletions
diff --git a/nuttx/arch/avr/src/avr32/up_initialstate.c b/nuttx/arch/avr/src/avr32/up_initialstate.c index c160270d9..48dc6c8eb 100644 --- a/nuttx/arch/avr/src/avr32/up_initialstate.c +++ b/nuttx/arch/avr/src/avr32/up_initialstate.c @@ -108,6 +108,17 @@ void up_initial_state(_TCB *tcb) xcp->regs[REG_PC] = (uint32_t)tcb->start; + /* Set supervisor- or user-mode, depending on how NuttX is configured and + * what kind of thread is being started. Disable FIQs in any event + * + * If the kernel build is not selected, then all threads run in + * supervisor-mode. + */ + +#ifdef CONFIG_NUTTX_KERNEL +# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#endif + /* Enable or disable interrupts, based on user configuration */ # ifdef CONFIG_SUPPRESS_INTERRUPTS diff --git a/nuttx/arch/sh/src/sh1/sh1_initialstate.c b/nuttx/arch/sh/src/sh1/sh1_initialstate.c index 692561e86..94b74c3ab 100644 --- a/nuttx/arch/sh/src/sh1/sh1_initialstate.c +++ b/nuttx/arch/sh/src/sh1/sh1_initialstate.c @@ -99,8 +99,28 @@ void up_initial_state(_TCB *tcb) /* Initialize the initial exception register context structure */ memset(xcp, 0, sizeof(struct xcptcontext)); + + /* Set the initial stack pointer to the "base" of the allocated stack */ + xcp->regs[REG_SP] = (uint32_t)tcb->adj_stack_ptr; + + /* Save the task entry point */ + xcp->regs[REG_PC] = (uint32_t)tcb->start; + + /* Set supervisor- or user-mode, depending on how NuttX is configured and + * what kind of thread is being started. Disable FIQs in any event + * + * If the kernel build is not selected, then all threads run in + * supervisor-mode. + */ + +#ifdef CONFIG_NUTTX_KERNEL +# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#endif + + /* Enable or disable interrupts, based on user configuration */ + #ifdef CONFIG_SUPPRESS_INTERRUPTS xcp->regs[REG_SR] = up_getsr() | 0x000000f0; #else diff --git a/nuttx/arch/x86/src/i486/up_initialstate.c b/nuttx/arch/x86/src/i486/up_initialstate.c index 9ca40feb3..c1bb422da 100644 --- a/nuttx/arch/x86/src/i486/up_initialstate.c +++ b/nuttx/arch/x86/src/i486/up_initialstate.c @@ -104,6 +104,17 @@ void up_initial_state(_TCB *tcb) xcp->regs[REG_CS] = up_getcs(); xcp->regs[REG_SS] = up_getss(); + /* Set supervisor- or user-mode, depending on how NuttX is configured and + * what kind of thread is being started. Disable FIQs in any event + * + * If the kernel build is not selected, then all threads run in + * supervisor-mode. + */ + +#ifdef CONFIG_NUTTX_KERNEL +# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#endif + /* Enable or disable interrupts, based on user configuration. If the IF * bit is set, maskable interrupts will be enabled. */ |