misc QEMU fixes

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3351 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-03-08 01:24:42 +00:00
parent 1b8399445b
commit 78f93cf4c7
8 changed files with 84 additions and 32 deletions
+2
View File
@@ -1530,3 +1530,5 @@
reported by Uros Platise). reported by Uros Platise).
* drivers/mtd/ramtron.c - Driver for SPI-based RAMTRON NVRAM devices FM25V10 * drivers/mtd/ramtron.c - Driver for SPI-based RAMTRON NVRAM devices FM25V10
(and others). Contributed by Uros Platise. (and others). Contributed by Uros Platise.
* examples/nsh and tools/mkromfsimg.sh -- Add support for platform-specific
ROMFS-based NSH start-up scripts.
+3 -1
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: March 6, 2011</p> <p>Last Updated: March 7, 2011</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -2154,6 +2154,8 @@ nuttx-5.19 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
reported by Uros Platise). reported by Uros Platise).
* drivers/mtd/ramtron.c - Driver for SPI-based RAMTRON NVRAM devices FM25V10 * drivers/mtd/ramtron.c - Driver for SPI-based RAMTRON NVRAM devices FM25V10
(and others). Contributed by Uros Platise. (and others). Contributed by Uros Platise.
* examples/nsh and tools/mkromfsimg.sh -- Add support for platform-specific
ROMFS-based NSH start-up scripts.
pascal-2.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-2.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+38
View File
@@ -163,6 +163,44 @@ static inline uint32_t up_getsp()
return regval; return regval;
} }
/* Get segment registers */
static inline uint32_t up_getds()
{
uint32_t regval;
asm volatile(
"\tmov %%ds, %0\n"
: "=rm" (regval)
:
: "memory");
return regval;
}
static inline uint32_t up_getcs()
{
uint32_t regval;
asm volatile(
"\tmov %%cs, %0\n"
: "=rm" (regval)
:
: "memory");
return regval;
}
static inline uint32_t up_getss()
{
uint32_t regval;
asm volatile(
"\tmov %%ss, %0\n"
: "=rm" (regval)
:
: "memory");
return regval;
}
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
+14 -12
View File
@@ -52,6 +52,8 @@
# define SYMBOL(s) s # define SYMBOL(s) s
#endif #endif
#define KSEG 0x10
/**************************************************************************** /****************************************************************************
* Nasm * Nasm
****************************************************************************/ ****************************************************************************/
@@ -84,12 +86,12 @@ SYMBOL(gdt_flush):
mov eax, [esp+4] /* Get the pointer to the GDT, passed as a parameter */ mov eax, [esp+4] /* Get the pointer to the GDT, passed as a parameter */
lgdt [eax] /* Load the new GDT pointer */ lgdt [eax] /* Load the new GDT pointer */
mov ax, 0x10 /* 0x10 is the offset in the GDT to our data segment */ mov $KSEG, ax /* KSEG is the offset in the GDT to our data segment */
mov ds, ax /* Load all data segment selectors */ mov ax, ds /* Load all data segment selectors */
mov es, ax mov ax, es
mov fs, ax mov ax, fs
mov gs, ax mov ax, gs
mov ss, ax mov ax, ss
jmp 0x08:.gflush /* 0x08 is the offset to our code segment: Far jump! */ jmp 0x08:.gflush /* 0x08 is the offset to our code segment: Far jump! */
.gflush: .gflush:
ret ret
@@ -135,12 +137,12 @@ SYMBOL(gdt_flush):
movl %eax, 4(%esp) /* Get the pointer to the GDT, passed as a parameter */ movl %eax, 4(%esp) /* Get the pointer to the GDT, passed as a parameter */
lgdt (%eax) /* Load the new GDT pointer */ lgdt (%eax) /* Load the new GDT pointer */
mov %ax, 0x10 /* 0x10 is the offset in the GDT to our data segment */ mov $KSEG, %ax /* KSEG is the offset in the GDT to our data segment */
mov %ds, %ax /* Load all data segment selectors */ mov %ax, %ds /* Load all data segment selectors */
mov %es, %ax mov %ax, %es
mov %fs, %ax mov %ax, %fs
mov %gs, %ax mov %ax, %gs
mov %ss, %ax mov %ax, %ss
jmp $0x08, $.Lgflush /* 0x08 is the offset to our code segment: Far jump! */ jmp $0x08, $.Lgflush /* 0x08 is the offset to our code segment: Far jump! */
.Lgflush: .Lgflush:
ret ret
+8
View File
@@ -93,6 +93,14 @@ void up_initial_state(_TCB *tcb)
xcp->regs[REG_EIP] = (uint32_t)tcb->start; 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 /* Enable or disable interrupts, based on user configuration. If the IF
* bit is set, maskable interrupts will be enabled. * bit is set, maskable interrupts will be enabled.
*/ */
+17 -17
View File
@@ -408,14 +408,14 @@ isr_common:
/* trace 'S' */ /* trace 'S' */
pusha /* Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax */ pusha /* Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax */
mov %ax, %ds /* Lower 16-bits of eax = ds. */ mov %ds, %ax /* Lower 16-bits of eax = ds. */
pushl %eax /* Save the data segment descriptor */ pushl %eax /* Save the data segment descriptor */
mov %ax, KSEG /* Load the kernel data segment descriptor */ mov $KSEG, %ax /* Load the kernel data segment descriptor */
mov %ds, %ax mov %ax, %ds
mov %es, %ax mov %ax, %es
mov %fs, %ax mov %ax, %fs
mov %gs, %ax mov %ax, %gs
/* The current value of the SP points to the beginning of the state save /* The current value of the SP points to the beginning of the state save
* structure. Save that on the stack as the input parameter to isr_handler. * structure. Save that on the stack as the input parameter to isr_handler.
@@ -446,14 +446,14 @@ irq_common:
/* trace 'R' */ /* trace 'R' */
pusha /* Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax */ pusha /* Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax */
mov %ax, %ds /* Lower 16-bits of eax = ds. */ mov %ds, %ax /* Lower 16-bits of eax = ds. */
push %eax /* Save the data segment descriptor */ push %eax /* Save the data segment descriptor */
mov %ax, KSEG /* Load the kernel data segment descriptor */ mov $KSEG, %ax /* Load the kernel data segment descriptor */
mov %ds, %ax mov %ax, %ds
mov %es, %ax mov %ax, %es
mov %fs, %ax mov %ax, %fs
mov %gs, %ax mov %ax, %gs
/* The current value of the SP points to the beginning of the state save /* The current value of the SP points to the beginning of the state save
* structure. Save that on the stack as the input parameter to irq_handler. * structure. Save that on the stack as the input parameter to irq_handler.
@@ -488,13 +488,13 @@ irq_common:
.Lnoswitch: .Lnoswitch:
pop %ebx /* Reload the original data segment descriptor */ pop %ebx /* Reload the original data segment descriptor */
mov %ds, %bx mov %bx, %ds
mov %es, %bx mov %bx, %es
mov %fs, %bx mov %bx, %fs
mov %gs, %bx mov %bx, %gs
popa /* Pops edi,esi,ebp... */ popa /* Pops edi,esi,ebp... */
add %esp, 8 /* Cleans up the pushed error code and pushed ISR number */ add $8, %esp /* Cleans up the pushed error code and pushed ISR number */
sti sti
iret /* Pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP */ iret /* Pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP */
#ifndef __CYGWIN__ #ifndef __CYGWIN__
+1 -1
View File
@@ -33,7 +33,7 @@
* *
****************************************************************************/ ****************************************************************************/
OUTPUT_ARCH(elf_i386) OUTPUT_ARCH(i386)
ENTRY(__start) ENTRY(__start)
SECTIONS SECTIONS
{ {
+1 -1
View File
@@ -42,7 +42,7 @@ if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
# Uncomment and modify the following if you are using anything other # Uncomment and modify the following if you are using anything other
# than the system GCC # than the system GCC
# WD=`pwd` # WD=`pwd`
# export BUILDROOT_BIN="${WD}/../../buildroot/build_i486/staging_dir/bin" # export BUILDROOT_BIN="${WD}/../../../buildroot/build_i486/staging_dir/bin"
# export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" # export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}" echo "PATH : ${PATH}"