Remove Cygwin dependencies from .S files

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3352 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-03-08 02:37:41 +00:00
parent 78f93cf4c7
commit 0e185156e6
6 changed files with 85 additions and 133 deletions
+13 -27
View File
@@ -46,13 +46,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#ifdef __CYGWIN__ #define KSEG 0x10
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
#define KSEG 0x10
/**************************************************************************** /****************************************************************************
* Nasm * Nasm
@@ -64,8 +58,8 @@
* Nasm externals * Nasm externals
****************************************************************************/ ****************************************************************************/
global SYMBOL(gdt_flush) global gdt_flush
global SYMBOL(idt_flush) global idt_flush
/**************************************************************************** /****************************************************************************
* Nasm macros * Nasm macros
@@ -82,7 +76,7 @@ BITS 32
* Name: gdt_flush * Name: gdt_flush
****************************************************************************/ ****************************************************************************/
SYMBOL(gdt_flush): 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 */
@@ -100,7 +94,7 @@ SYMBOL(gdt_flush):
* Name: idt_flush * Name: idt_flush
****************************************************************************/ ****************************************************************************/
SYMBOL(idt_flush): idt_flush:
mov eax, [esp+4] /* Get the pointer to the IDT, passed as a parameter */ mov eax, [esp+4] /* Get the pointer to the IDT, passed as a parameter */
lidt [eax] /* Load the IDT pointer */ lidt [eax] /* Load the IDT pointer */
ret ret
@@ -117,8 +111,8 @@ SYMBOL(idt_flush):
* GAS Globals * GAS Globals
****************************************************************************/ ****************************************************************************/
.globl SYMBOL(gdt_flush) .globl gdt_flush
.globl SYMBOL(idt_flush) .globl idt_flush
/**************************************************************************** /****************************************************************************
* GAS .text * GAS .text
@@ -130,10 +124,8 @@ SYMBOL(idt_flush):
* Name: gdt_flush * Name: gdt_flush
****************************************************************************/ ****************************************************************************/
#ifndef __CYGWIN__ .type gdt_flush, @function
.type SYMBOL(gdt_flush), @function gdt_flush:
#endif
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 */
@@ -146,23 +138,17 @@ SYMBOL(gdt_flush):
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
#ifndef __CYGWIN__ .size gdt_flush, . - gdt_flush
.size SYMBOL(gdt_flush), . - SYMBOL(gdt_flush)
#endif
/**************************************************************************** /****************************************************************************
* Name: idt_flush * Name: idt_flush
****************************************************************************/ ****************************************************************************/
#ifndef __CYGWIN__ .type idt_flush, @function
.type SYMBOL(idt_flush), @function idt_flush:
#endif
SYMBOL(idt_flush):
movl %eax, 4(%esp) /* Get the pointer to the IDT, passed as a parameter */ movl %eax, 4(%esp) /* Get the pointer to the IDT, passed as a parameter */
lidt (%eax) /* Load the IDT pointer */ lidt (%eax) /* Load the IDT pointer */
ret ret
#ifndef __CYGWIN__ .size idt_flush, . - idt_flush
.size SYMBOL(idt_flush), . - SYMBOL(idt_flush)
#endif
.end .end
#endif /* CONFIG_X86_NASM */ #endif /* CONFIG_X86_NASM */
+4 -14
View File
@@ -48,12 +48,6 @@
/************************************************************************** /**************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
**************************************************************************/ **************************************************************************/
#ifdef __CYGWIN__
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
/************************************************************************** /**************************************************************************
* Private Types * Private Types
@@ -92,11 +86,9 @@
#else #else
.file "qemu_fullcontextrestore.S" .file "qemu_fullcontextrestore.S"
.text .text
.globl SYMBOL(up_fullcontextrestore) .globl up_fullcontextrestore
#ifndef __CYGWIN__ .type up_fullcontextrestore, @function
.type SYMBOL(up_fullcontextrestore), @function up_fullcontextrestore:
#endif
SYMBOL(up_fullcontextrestore):
/* Fetch the pointer to the register save array in EAX. */ /* Fetch the pointer to the register save array in EAX. */
movl 4(%esp), %eax movl 4(%esp), %eax
@@ -146,9 +138,7 @@ SYMBOL(up_fullcontextrestore):
popl %eax popl %eax
popf popf
ret ret
#ifndef __CYGWIN__ .size up_fullcontextrestore, . - up_fullcontextrestore
.size SYMBOL(up_fullcontextrestore), . - SYMBOL(up_fullcontextrestore)
#endif
.end .end
#endif /* CONFIG_X86_NASM */ #endif /* CONFIG_X86_NASM */
+15 -33
View File
@@ -43,12 +43,6 @@
* Pre-processor definitions * Pre-processor definitions
****************************************************************************/ ****************************************************************************/
#ifdef __CYGWIN__
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
/* Memory Map: _sbss is the start of the BSS region (see ld.script) _ebss is /* Memory Map: _sbss is the start of the BSS region (see ld.script) _ebss is
* the end of the BSS regsion (see ld.script). The idle task stack starts at * the end of the BSS regsion (see ld.script). The idle task stack starts at
* the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread * the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread
@@ -67,9 +61,9 @@
#ifdef CONFIG_X86_NASM #ifdef CONFIG_X86_NASM
global __start /* Making entry point visible to linker */ global __start /* Making entry point visible to linker */
global SYMBOL(g_heapbase) /* The start of the heap */ global g_heapbase /* The start of the heap */
extern SYMBOL(os_start) /* os_start is defined elsewhere */ extern os_start /* os_start is defined elsewhere */
extern SYMBOL(up_lowsetup) /* up_lowsetup is defined elsewhere */ extern up_lowsetup /* up_lowsetup is defined elsewhere */
/* Setting up the Multiboot header - see GRUB docs for details */ /* Setting up the Multiboot header - see GRUB docs for details */
@@ -98,8 +92,8 @@ __start:
/* Initialize and start NuttX */ /* Initialize and start NuttX */
call SYMBOL(up_lowsetup) /* Low-level, pre-OS initialization */ call up_lowsetup /* Low-level, pre-OS initialization */
call SYMBOL(os_start) /* Start NuttX */ call os_start /* Start NuttX */
/* NuttX will not return */ /* NuttX will not return */
@@ -135,7 +129,7 @@ section .rodata
*/ */
align 4 align 4
SYMBOL(g_heapbase): g_heapbase:
dd _ebss dd _ebss
#else /* !CONFIG_X86_NASM (GAS) */ #else /* !CONFIG_X86_NASM (GAS) */
@@ -146,9 +140,9 @@ SYMBOL(g_heapbase):
.file "qemu_head.S" .file "qemu_head.S"
.global __start /* Making entry point visible to linker */ .global __start /* Making entry point visible to linker */
.global SYMBOL(os_start) /* os_start is defined elsewhere */ .global os_start /* os_start is defined elsewhere */
.global SYMBOL(up_lowsetup) /* up_lowsetup is defined elsewhere */ .global up_lowsetup /* up_lowsetup is defined elsewhere */
.global SYMBOL(g_heapbase) /* The start of the heap */ .global g_heapbase /* The start of the heap */
/* Setting up the Multiboot header - see GRUB docs for details */ /* Setting up the Multiboot header - see GRUB docs for details */
@@ -164,9 +158,7 @@ SYMBOL(g_heapbase):
.long FLAGS .long FLAGS
.long CHECKSUM .long CHECKSUM
#ifndef __CYGWIN__
.type __start, @function .type __start, @function
#endif
__start: __start:
/* Set up the stack */ /* Set up the stack */
@@ -179,8 +171,8 @@ __start:
/* Initialize and start NuttX */ /* Initialize and start NuttX */
call SYMBOL(up_lowsetup) /* Low-level, pre-OS initialization */ call up_lowsetup /* Low-level, pre-OS initialization */
call SYMBOL(os_start) /* Start NuttX */ call os_start /* Start NuttX */
/* NuttX will not return */ /* NuttX will not return */
@@ -188,9 +180,7 @@ __start:
hang: hang:
hlt /* Halt machine should NuttX return */ hlt /* Halt machine should NuttX return */
jmp hang jmp hang
#ifndef __CYGWIN__
.size __start, . - __start .size __start, . - __start
#endif
/**************************************************************************** /****************************************************************************
* .bss * .bss
@@ -202,13 +192,9 @@ hang:
* do in the system (see up_idle()). * do in the system (see up_idle()).
*/ */
#ifndef __CYGWIN__
.type idle_stack, @object .type idle_stack, @object
#endif
.comm idle_stack, CONFIG_IDLETHREAD_STACKSIZE, 32 .comm idle_stack, CONFIG_IDLETHREAD_STACKSIZE, 32
#ifndef __CYGWIN__
.size idle_stack, . - idle_stack .size idle_stack, . - idle_stack
#endif
/**************************************************************************** /****************************************************************************
* .rodata * .rodata
@@ -221,13 +207,9 @@ hang:
* until the end of memory. * until the end of memory.
*/ */
#ifndef __CYGWIN__ .type g_heapbase, @object
.type SYMBOL(g_heapbase), @object g_heapbase:
#endif
SYMBOL(g_heapbase):
.long _ebss .long _ebss
#ifndef __CYGWIN__ .size g_heapbase, . - g_heapbase
.size SYMBOL(g_heapbase), . - SYMBOL(g_heapbase)
#endif
.end .end
#endif /* CONFIG_X86_NASM */ #endif /* CONFIG_X86_NASM */
+4 -14
View File
@@ -48,12 +48,6 @@
/************************************************************************** /**************************************************************************
* Private Definitions * Private Definitions
**************************************************************************/ **************************************************************************/
#ifdef __CYGWIN__
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
/************************************************************************** /**************************************************************************
* Private Types * Private Types
@@ -106,11 +100,9 @@
#else #else
.file "qemu_saveusercontext.S" .file "qemu_saveusercontext.S"
.text .text
.globl SYMBOL(up_saveusercontext) .globl up_saveusercontext
#ifndef __CYGWIN__ .type up_saveusercontext, @function
.type SYMBOL(up_saveusercontext), @function up_saveusercontext:
#endif
SYMBOL(up_saveusercontext):
/* Fetch the pointer to the register save array. %eax is a available /* Fetch the pointer to the register save array. %eax is a available
* because it must be modified later to provide the return value. * because it must be modified later to provide the return value.
*/ */
@@ -157,8 +149,6 @@ SYMBOL(up_saveusercontext):
xorl %eax, %eax xorl %eax, %eax
ret ret
#ifndef __CYGWIN__ .size up_saveusercontext, . - up_saveusercontext
.size SYMBOL(up_saveusercontext), . - SYMBOL(up_saveusercontext)
#endif
.end .end
#endif #endif
+22 -36
View File
@@ -47,12 +47,6 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#ifdef __CYGWIN__
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
#define KSEG 0x10 #define KSEG 0x10
/**************************************************************************** /****************************************************************************
@@ -65,8 +59,8 @@
* Nasm externals * Nasm externals
****************************************************************************/ ****************************************************************************/
extern SYMBOL(irq_handler) extern irq_handler
extern SYMBOL(isr_handler) extern isr_handler
/**************************************************************************** /****************************************************************************
* Nasm macros * Nasm macros
@@ -89,8 +83,8 @@ extern SYMBOL(isr_handler)
*/ */
%macro ISR_NOERRCODE 1 %macro ISR_NOERRCODE 1
global SYMBOL(vector_isr%1) global vector_isr%1
SYMBOL(vector_isr%1): vector_isr%1:
cli /* Disable interrupts firstly. */ cli /* Disable interrupts firstly. */
push byte 0 /* Push a dummy error code. */ push byte 0 /* Push a dummy error code. */
push byte %1 /* Push the interrupt number. */ push byte %1 /* Push the interrupt number. */
@@ -102,8 +96,8 @@ extern SYMBOL(isr_handler)
*/ */
%macro ISR_ERRCODE 1 %macro ISR_ERRCODE 1
global SYMBOL(vector_isr%1) global vector_isr%1
SYMBOL(vector_isr%1): vector_isr%1:
cli /* Disable interrupts. */ cli /* Disable interrupts. */
push byte %1 /* Push the interrupt number */ push byte %1 /* Push the interrupt number */
jmp isr_common jmp isr_common
@@ -114,8 +108,8 @@ extern SYMBOL(isr_handler)
*/ */
%macro IRQ 2 %macro IRQ 2
global SYMBOL(vector_irq%1) global vector_irq%1
SYMBOL(vector_irq%1): vector_irq%1:
cli cli
push byte 0 push byte 0
push byte %2 push byte %2
@@ -206,7 +200,7 @@ isr_common:
mov esp, eax mov esp, eax
push eax push eax
call SYMBOL(isr_handler) call isr_handler
jmp .Lreturn jmp .Lreturn
/**************************************************************************** /****************************************************************************
@@ -238,7 +232,7 @@ irq_common:
mov esp, eax mov esp, eax
push eax push eax
call SYMBOL(irq_handler) call irq_handler
/* The common return point for both isr_handler and irq_handler */ /* The common return point for both isr_handler and irq_handler */
@@ -261,7 +255,7 @@ irq_common:
*/ */
push eax push eax
jmp SYMBOL(up_fullcontext) jmp up_fullcontext
.Lnoswitch: .Lnoswitch:
pop ebx /* Reload the original data segment descriptor */ pop ebx /* Reload the original data segment descriptor */
@@ -287,8 +281,8 @@ irq_common:
* GAS globals * GAS globals
****************************************************************************/ ****************************************************************************/
.globl SYMBOL(irq_handler) .globl irq_handler
.globl SYMBOL(isr_handler) .globl isr_handler
/**************************************************************************** /****************************************************************************
* GAS macros * GAS macros
@@ -307,8 +301,8 @@ irq_common:
*/ */
.macro ISR_NOERRCODE, intno .macro ISR_NOERRCODE, intno
.globl SYMBOL(vector_isr\intno) .globl vector_isr\intno
SYMBOL(vector_isr\intno): vector_isr\intno:
cli /* Disable interrupts firstly. */ cli /* Disable interrupts firstly. */
push $0 /* Push a dummy error code. */ push $0 /* Push a dummy error code. */
push $\intno /* Push the interrupt number. */ push $\intno /* Push the interrupt number. */
@@ -320,8 +314,8 @@ SYMBOL(vector_isr\intno):
*/ */
.macro ISR_ERRCODE, intno .macro ISR_ERRCODE, intno
.globl SYMBOL(vector_isr\intno) .globl vector_isr\intno
SYMBOL(vector_isr\intno): vector_isr\intno:
cli /* Disable interrupts firstly. */ cli /* Disable interrupts firstly. */
push $\intno /* Push the interrupt number. */ push $\intno /* Push the interrupt number. */
jmp isr_common /* Go to the common handler code. */ jmp isr_common /* Go to the common handler code. */
@@ -332,8 +326,8 @@ SYMBOL(vector_isr\intno):
*/ */
.macro IRQ, irqno, intno .macro IRQ, irqno, intno
.globl SYMBOL(vector_irq\irqno) .globl vector_irq\irqno
SYMBOL(vector_irq\irqno): vector_irq\irqno:
cli /* Disable interrupts firstly. */ cli /* Disable interrupts firstly. */
push $0 /* Push a dummy error code. */ push $0 /* Push a dummy error code. */
push $\intno /* Push the interrupt number. */ push $\intno /* Push the interrupt number. */
@@ -401,9 +395,7 @@ SYMBOL(vector_irq\irqno):
* *
****************************************************************************/ ****************************************************************************/
#ifndef __CYGWIN__
.type isr_common, @function .type isr_common, @function
#endif
isr_common: 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 */
@@ -423,11 +415,9 @@ isr_common:
mov %esp, %eax mov %esp, %eax
push %eax push %eax
call SYMBOL(isr_handler) call isr_handler
jmp .Lreturn jmp .Lreturn
#ifndef __CYGWIN__
.size isr_common, . - isr_common .size isr_common, . - isr_common
#endif
/**************************************************************************** /****************************************************************************
* Name: irq_common * Name: irq_common
@@ -439,9 +429,7 @@ isr_common:
* *
****************************************************************************/ ****************************************************************************/
#ifndef __CYGWIN__
.type irq_common, @function .type irq_common, @function
#endif
irq_common: 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 */
@@ -461,7 +449,7 @@ irq_common:
mov %esp, %eax mov %esp, %eax
push %eax push %eax
call SYMBOL(irq_handler) call irq_handler
/* The common return point for both isr_handler and irq_handler */ /* The common return point for both isr_handler and irq_handler */
@@ -484,7 +472,7 @@ irq_common:
*/ */
push %eax push %eax
call SYMBOL(up_fullcontextrestore) call up_fullcontextrestore
.Lnoswitch: .Lnoswitch:
pop %ebx /* Reload the original data segment descriptor */ pop %ebx /* Reload the original data segment descriptor */
@@ -497,8 +485,6 @@ irq_common:
add $8, %esp /* 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__
.size irq_common, . - irq_common .size irq_common, . - irq_common
#endif
.end .end
#endif /* CONFIG_X86_NASM */ #endif /* CONFIG_X86_NASM */
+27 -9
View File
@@ -1,18 +1,24 @@
README README
^^^^^^ ======
This README file describes the contents of the build configurations available This README file describes the contents of the build configurations available
for the NuttX QEMU i486 port. for the NuttX QEMU i486 port.
Contents Contents
^^^^^^^^ ========
* QEMU * QEMU
- Building QEMU
- Cygwin Build Problems
- Running QEMU
* Toolchains * Toolchains
- Cygwin Buildroot Toolchain
- Buildroot Instructions
* Configurations * Configurations
- ostest
QEMU QEMU
^^^^ ====
QEMU is a generic and open source machine emulator and virtualizer. Here are QEMU is a generic and open source machine emulator and virtualizer. Here are
some links (which are mostly outdated by the time your read this): some links (which are mostly outdated by the time your read this):
@@ -22,7 +28,8 @@ some links (which are mostly outdated by the time your read this):
Documentation: http://wiki.qemu.org/Manual Documentation: http://wiki.qemu.org/Manual
Usage: qemu -nographic -kernel nuttx.elf Usage: qemu -nographic -kernel nuttx.elf
Building QEMU: Building QEMU
-------------
tar zxf qemu-0.14.0.tar.gz tar zxf qemu-0.14.0.tar.gz
cd qemu-0.14.0 cd qemu-0.14.0
@@ -30,7 +37,8 @@ Building QEMU:
make make
make install make install
Cygwin build problems: Cygwin Build Problems
---------------------
Error: Error:
@@ -52,8 +60,15 @@ Cygwin build problems:
binaries. I found 0.14.0 here: http://dietpc.org/windows/qemu/, or binaries. I found 0.14.0 here: http://dietpc.org/windows/qemu/, or
2. Try building QEMU with MingGW 2. Try building QEMU with MingGW
Running QEMU
------------
In the top-level NuttX directory:
qemu -cpu 486 -m 2 -kernel nuttx.elf -nographic
Toolchains Toolchains
^^^^^^^^^^ ==========
Two target environments are supported: (1) Linux and (2) Cygwin under Windows. Two target environments are supported: (1) Linux and (2) Cygwin under Windows.
Any GCC toolchain that can produce i486 ELF binaries should work. On Linux, Any GCC toolchain that can produce i486 ELF binaries should work. On Linux,
@@ -65,7 +80,8 @@ Toolchains
The file */setenv.sh should be modified to point to the correct path to the The file */setenv.sh should be modified to point to the correct path to the
GCC toolchain (if different from the default in your PATH variable). GCC toolchain (if different from the default in your PATH variable).
Cygwin Buildroot Toolchain Cygwin Buildroot Toolchain
--------------------------
With Cygwin the solution is to build an i486 cross-development toolchain to With Cygwin the solution is to build an i486 cross-development toolchain to
generate the i486 ELF files needed by QEMU. The NuttX buildroot package will generate the i486 ELF files needed by QEMU. The NuttX buildroot package will
@@ -75,7 +91,8 @@ Toolchains
i486 build. This is only available in SVN or in any any 1.10 or later buildroot i486 build. This is only available in SVN or in any any 1.10 or later buildroot
release. release.
Buildroot Instructions Buildroot Instructions
----------------------
1. You must have already configured Nuttx in <some-dir>/nuttx. 1. You must have already configured Nuttx in <some-dir>/nuttx.
@@ -104,9 +121,10 @@ Toolchains
run into problems building the toolchain for Cygwin under Windows. run into problems building the toolchain for Cygwin under Windows.
Configurations Configurations
^^^^^^^^^^^^^^ ==============
ostest ostest
------
The "standard" NuttX examples/ostest configuration. This The "standard" NuttX examples/ostest configuration. This
configuration may be selected as follows: configuration may be selected as follows: