diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-11-04 15:12:55 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-11-04 15:12:55 +0000 |
commit | dec5edaa7fcf561f5538ca3ba0af07e402a6b55e (patch) | |
tree | 91d9f298d4568c87e8a0c3f4211e229dc80f2b13 /nuttx/arch/rgmp/src/x86 | |
parent | 9c2462da3c765755e63a15e85050e92a9d873a6c (diff) | |
download | px4-nuttx-dec5edaa7fcf561f5538ca3ba0af07e402a6b55e.tar.gz px4-nuttx-dec5edaa7fcf561f5538ca3ba0af07e402a6b55e.tar.bz2 px4-nuttx-dec5edaa7fcf561f5538ca3ba0af07e402a6b55e.zip |
RGMP 4.0 update from Qiang Yu
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5305 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/rgmp/src/x86')
-rw-r--r-- | nuttx/arch/rgmp/src/x86/arch_nuttx.c | 29 | ||||
-rw-r--r-- | nuttx/arch/rgmp/src/x86/com.c | 6 | ||||
-rw-r--r-- | nuttx/arch/rgmp/src/x86/sigentry.S | 4 |
3 files changed, 17 insertions, 22 deletions
diff --git a/nuttx/arch/rgmp/src/x86/arch_nuttx.c b/nuttx/arch/rgmp/src/x86/arch_nuttx.c index c7b7577f3..04b8fa8c8 100644 --- a/nuttx/arch/rgmp/src/x86/arch_nuttx.c +++ b/nuttx/arch/rgmp/src/x86/arch_nuttx.c @@ -37,7 +37,7 @@ * ****************************************************************************/ -#include <rgmp/pmap.h> +#include <rgmp/mmu.h> #include <rgmp/string.h> #include <rgmp/arch/fpu.h> @@ -75,32 +75,27 @@ void up_initial_state(_TCB *tcb) { struct Trapframe *tf; - if (tcb->pid != 0) { - tf = (struct Trapframe *)tcb->adj_stack_ptr-1; - memset(tf, 0, sizeof(struct Trapframe)); - tf->tf_fpu = rgmp_fpu_init_regs; - tf->tf_eflags = 0x00000202; - tf->tf_cs = GD_KT; - tf->tf_ds = GD_KD; - tf->tf_es = GD_KD; - tf->tf_eip = (uint32_t)tcb->start; - tcb->xcp.tf = tf; + if (tcb->pid) { + tf = (struct Trapframe *)tcb->adj_stack_ptr - 1; + rgmp_setup_context(&tcb->xcp.ctx, tf, tcb->start, 1); } + else + rgmp_setup_context(&tcb->xcp.ctx, NULL, NULL, 0); } void push_xcptcontext(struct xcptcontext *xcp) { - xcp->save_eip = xcp->tf->tf_eip; - xcp->save_eflags = xcp->tf->tf_eflags; + xcp->save_eip = xcp->ctx.tf->tf_eip; + xcp->save_eflags = xcp->ctx.tf->tf_eflags; // set up signal entry with interrupts disabled - xcp->tf->tf_eip = (uint32_t)up_sigentry; - xcp->tf->tf_eflags = 0; + xcp->ctx.tf->tf_eip = (uint32_t)up_sigentry; + xcp->ctx.tf->tf_eflags = 0; } void pop_xcptcontext(struct xcptcontext *xcp) { - xcp->tf->tf_eip = xcp->save_eip; - xcp->tf->tf_eflags = xcp->save_eflags; + xcp->ctx.tf->tf_eip = xcp->save_eip; + xcp->ctx.tf->tf_eflags = xcp->save_eflags; } diff --git a/nuttx/arch/rgmp/src/x86/com.c b/nuttx/arch/rgmp/src/x86/com.c index 6a136ac7d..7983bb1bc 100644 --- a/nuttx/arch/rgmp/src/x86/com.c +++ b/nuttx/arch/rgmp/src/x86/com.c @@ -57,7 +57,6 @@ #include <arch/com.h> #include <rgmp/trap.h> -#include <rgmp/arch/console.h> /**************************************************************************** * Pre-processor Definitions @@ -129,7 +128,7 @@ static int up_setup(struct uart_dev_s *dev); static void up_shutdown(struct uart_dev_s *dev); static int up_attach(struct uart_dev_s *dev); static void up_detach(struct uart_dev_s *dev); -static irqreturn_t up_com_int_handler(struct Trapframe *tf, void *dev_id); +static irqreturn_t up_com_int_handler(int irq, void *dev_id); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_receive(struct uart_dev_s *dev, unsigned int *status); static void up_rxint(struct uart_dev_s *dev, bool enable); @@ -345,7 +344,7 @@ static void up_detach(struct uart_dev_s *dev) * ****************************************************************************/ -static irqreturn_t up_com_int_handler(struct Trapframe *tf, void *dev_id) +static irqreturn_t up_com_int_handler(int irq, void *dev_id) { struct uart_dev_s *dev = dev_id; struct up_dev_s *priv = dev->priv; @@ -622,6 +621,7 @@ void up_serialinit(void) * writes * ****************************************************************************/ +extern void cons_putc(int c); int up_putc(int ch) { diff --git a/nuttx/arch/rgmp/src/x86/sigentry.S b/nuttx/arch/rgmp/src/x86/sigentry.S index 98891c026..77214e811 100644 --- a/nuttx/arch/rgmp/src/x86/sigentry.S +++ b/nuttx/arch/rgmp/src/x86/sigentry.S @@ -39,11 +39,11 @@ .globl up_sigentry up_sigentry: - subl $172, %esp # 172 is the size of TrapFrame + subl $172, %esp # 172 is the size of Trapframe without cross ring part pushl %esp movl %esp, %eax call up_sigdeliver - addl $8, %esp # skip parameter and current_task + addl $8, %esp # skip parameter and tf_curregs frstor 0(%esp) addl $108, %esp popal |