diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-08 01:24:42 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-08 01:24:42 +0000 |
commit | 2d3bbda678e4a4613303e32b53c4b652232e0dca (patch) | |
tree | f6c2781c153a3ee1335aeff948f4d99f40296ef2 /nuttx/arch/x86/src/i486 | |
parent | 8f66f424602e26f0a43a62beaa3c2aec7775c890 (diff) | |
download | px4-nuttx-2d3bbda678e4a4613303e32b53c4b652232e0dca.tar.gz px4-nuttx-2d3bbda678e4a4613303e32b53c4b652232e0dca.tar.bz2 px4-nuttx-2d3bbda678e4a4613303e32b53c4b652232e0dca.zip |
misc QEMU fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3351 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/x86/src/i486')
-rw-r--r-- | nuttx/arch/x86/src/i486/i486_utils.S | 26 | ||||
-rw-r--r-- | nuttx/arch/x86/src/i486/up_initialstate.c | 8 |
2 files changed, 22 insertions, 12 deletions
diff --git a/nuttx/arch/x86/src/i486/i486_utils.S b/nuttx/arch/x86/src/i486/i486_utils.S index eae168fbd..9010b5a71 100644 --- a/nuttx/arch/x86/src/i486/i486_utils.S +++ b/nuttx/arch/x86/src/i486/i486_utils.S @@ -52,6 +52,8 @@ # define SYMBOL(s) s #endif +#define KSEG 0x10 + /**************************************************************************** * Nasm ****************************************************************************/ @@ -84,12 +86,12 @@ SYMBOL(gdt_flush): mov eax, [esp+4] /* Get the pointer to the GDT, passed as a parameter */ lgdt [eax] /* Load the new GDT pointer */ - mov ax, 0x10 /* 0x10 is the offset in the GDT to our data segment */ - mov ds, ax /* Load all data segment selectors */ - mov es, ax - mov fs, ax - mov gs, ax - mov ss, ax + mov $KSEG, ax /* KSEG is the offset in the GDT to our data segment */ + mov ax, ds /* Load all data segment selectors */ + mov ax, es + mov ax, fs + mov ax, gs + mov ax, ss jmp 0x08:.gflush /* 0x08 is the offset to our code segment: Far jump! */ .gflush: ret @@ -135,12 +137,12 @@ SYMBOL(gdt_flush): movl %eax, 4(%esp) /* Get the pointer to the GDT, passed as a parameter */ lgdt (%eax) /* Load the new GDT pointer */ - mov %ax, 0x10 /* 0x10 is the offset in the GDT to our data segment */ - mov %ds, %ax /* Load all data segment selectors */ - mov %es, %ax - mov %fs, %ax - mov %gs, %ax - mov %ss, %ax + mov $KSEG, %ax /* KSEG is the offset in the GDT to our data segment */ + mov %ax, %ds /* Load all data segment selectors */ + mov %ax, %es + mov %ax, %fs + mov %ax, %gs + mov %ax, %ss jmp $0x08, $.Lgflush /* 0x08 is the offset to our code segment: Far jump! */ .Lgflush: ret diff --git a/nuttx/arch/x86/src/i486/up_initialstate.c b/nuttx/arch/x86/src/i486/up_initialstate.c index 6e7417d5c..1a13b8991 100644 --- a/nuttx/arch/x86/src/i486/up_initialstate.c +++ b/nuttx/arch/x86/src/i486/up_initialstate.c @@ -93,6 +93,14 @@ void up_initial_state(_TCB *tcb) xcp->regs[REG_EIP] = (uint32_t)tcb->start; + /* Set up the segment registers... assume the same segment as the caller. + * That is not a good assumption in the long run. + */ + + xcp->regs[REG_DS] = up_getds(); + xcp->regs[REG_CS] = up_getcs(); + xcp->regs[REG_SS] = up_getss(); + /* Enable or disable interrupts, based on user configuration. If the IF * bit is set, maskable interrupts will be enabled. */ |