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

View File

@ -46,13 +46,7 @@
* Pre-processor Definitions
****************************************************************************/
#ifdef __CYGWIN__
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
#define KSEG 0x10
#define KSEG 0x10
/****************************************************************************
* Nasm
@ -64,8 +58,8 @@
* Nasm externals
****************************************************************************/
global SYMBOL(gdt_flush)
global SYMBOL(idt_flush)
global gdt_flush
global idt_flush
/****************************************************************************
* Nasm macros
@ -82,7 +76,7 @@ BITS 32
* Name: gdt_flush
****************************************************************************/
SYMBOL(gdt_flush):
gdt_flush:
mov eax, [esp+4] /* Get the pointer to the GDT, passed as a parameter */
lgdt [eax] /* Load the new GDT pointer */
@ -100,7 +94,7 @@ SYMBOL(gdt_flush):
* Name: idt_flush
****************************************************************************/
SYMBOL(idt_flush):
idt_flush:
mov eax, [esp+4] /* Get the pointer to the IDT, passed as a parameter */
lidt [eax] /* Load the IDT pointer */
ret
@ -117,8 +111,8 @@ SYMBOL(idt_flush):
* GAS Globals
****************************************************************************/
.globl SYMBOL(gdt_flush)
.globl SYMBOL(idt_flush)
.globl gdt_flush
.globl idt_flush
/****************************************************************************
* GAS .text
@ -130,10 +124,8 @@ SYMBOL(idt_flush):
* Name: gdt_flush
****************************************************************************/
#ifndef __CYGWIN__
.type SYMBOL(gdt_flush), @function
#endif
SYMBOL(gdt_flush):
.type gdt_flush, @function
gdt_flush:
movl %eax, 4(%esp) /* Get the pointer to the GDT, passed as a parameter */
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! */
.Lgflush:
ret
#ifndef __CYGWIN__
.size SYMBOL(gdt_flush), . - SYMBOL(gdt_flush)
#endif
.size gdt_flush, . - gdt_flush
/****************************************************************************
* Name: idt_flush
****************************************************************************/
#ifndef __CYGWIN__
.type SYMBOL(idt_flush), @function
#endif
SYMBOL(idt_flush):
.type idt_flush, @function
idt_flush:
movl %eax, 4(%esp) /* Get the pointer to the IDT, passed as a parameter */
lidt (%eax) /* Load the IDT pointer */
ret
#ifndef __CYGWIN__
.size SYMBOL(idt_flush), . - SYMBOL(idt_flush)
#endif
.size idt_flush, . - idt_flush
.end
#endif /* CONFIG_X86_NASM */

View File

@ -48,12 +48,6 @@
/**************************************************************************
* Pre-processor Definitions
**************************************************************************/
#ifdef __CYGWIN__
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
/**************************************************************************
* Private Types
@ -92,11 +86,9 @@
#else
.file "qemu_fullcontextrestore.S"
.text
.globl SYMBOL(up_fullcontextrestore)
#ifndef __CYGWIN__
.type SYMBOL(up_fullcontextrestore), @function
#endif
SYMBOL(up_fullcontextrestore):
.globl up_fullcontextrestore
.type up_fullcontextrestore, @function
up_fullcontextrestore:
/* Fetch the pointer to the register save array in EAX. */
movl 4(%esp), %eax
@ -146,9 +138,7 @@ SYMBOL(up_fullcontextrestore):
popl %eax
popf
ret
#ifndef __CYGWIN__
.size SYMBOL(up_fullcontextrestore), . - SYMBOL(up_fullcontextrestore)
#endif
.size up_fullcontextrestore, . - up_fullcontextrestore
.end
#endif /* CONFIG_X86_NASM */

View File

@ -43,12 +43,6 @@
* 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
* 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
@ -67,9 +61,9 @@
#ifdef CONFIG_X86_NASM
global __start /* Making entry point visible to linker */
global SYMBOL(g_heapbase) /* The start of the heap */
extern SYMBOL(os_start) /* os_start is defined elsewhere */
extern SYMBOL(up_lowsetup) /* up_lowsetup is defined elsewhere */
global g_heapbase /* The start of the heap */
extern os_start /* os_start is defined elsewhere */
extern up_lowsetup /* up_lowsetup is defined elsewhere */
/* Setting up the Multiboot header - see GRUB docs for details */
@ -98,8 +92,8 @@ __start:
/* Initialize and start NuttX */
call SYMBOL(up_lowsetup) /* Low-level, pre-OS initialization */
call SYMBOL(os_start) /* Start NuttX */
call up_lowsetup /* Low-level, pre-OS initialization */
call os_start /* Start NuttX */
/* NuttX will not return */
@ -135,7 +129,7 @@ section .rodata
*/
align 4
SYMBOL(g_heapbase):
g_heapbase:
dd _ebss
#else /* !CONFIG_X86_NASM (GAS) */
@ -146,9 +140,9 @@ SYMBOL(g_heapbase):
.file "qemu_head.S"
.global __start /* Making entry point visible to linker */
.global SYMBOL(os_start) /* os_start is defined elsewhere */
.global SYMBOL(up_lowsetup) /* up_lowsetup is defined elsewhere */
.global SYMBOL(g_heapbase) /* The start of the heap */
.global os_start /* os_start is defined elsewhere */
.global up_lowsetup /* up_lowsetup is defined elsewhere */
.global g_heapbase /* The start of the heap */
/* Setting up the Multiboot header - see GRUB docs for details */
@ -164,9 +158,7 @@ SYMBOL(g_heapbase):
.long FLAGS
.long CHECKSUM
#ifndef __CYGWIN__
.type __start, @function
#endif
__start:
/* Set up the stack */
@ -179,8 +171,8 @@ __start:
/* Initialize and start NuttX */
call SYMBOL(up_lowsetup) /* Low-level, pre-OS initialization */
call SYMBOL(os_start) /* Start NuttX */
call up_lowsetup /* Low-level, pre-OS initialization */
call os_start /* Start NuttX */
/* NuttX will not return */
@ -188,9 +180,7 @@ __start:
hang:
hlt /* Halt machine should NuttX return */
jmp hang
#ifndef __CYGWIN__
.size __start, . - __start
#endif
/****************************************************************************
* .bss
@ -202,13 +192,9 @@ hang:
* do in the system (see up_idle()).
*/
#ifndef __CYGWIN__
.type idle_stack, @object
#endif
.comm idle_stack, CONFIG_IDLETHREAD_STACKSIZE, 32
#ifndef __CYGWIN__
.size idle_stack, . - idle_stack
#endif
/****************************************************************************
* .rodata
@ -221,13 +207,9 @@ hang:
* until the end of memory.
*/
#ifndef __CYGWIN__
.type SYMBOL(g_heapbase), @object
#endif
SYMBOL(g_heapbase):
.type g_heapbase, @object
g_heapbase:
.long _ebss
#ifndef __CYGWIN__
.size SYMBOL(g_heapbase), . - SYMBOL(g_heapbase)
#endif
.size g_heapbase, . - g_heapbase
.end
#endif /* CONFIG_X86_NASM */
#endif /* CONFIG_X86_NASM */

View File

@ -48,12 +48,6 @@
/**************************************************************************
* Private Definitions
**************************************************************************/
#ifdef __CYGWIN__
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
/**************************************************************************
* Private Types
@ -106,11 +100,9 @@
#else
.file "qemu_saveusercontext.S"
.text
.globl SYMBOL(up_saveusercontext)
#ifndef __CYGWIN__
.type SYMBOL(up_saveusercontext), @function
#endif
SYMBOL(up_saveusercontext):
.globl up_saveusercontext
.type up_saveusercontext, @function
up_saveusercontext:
/* Fetch the pointer to the register save array. %eax is a available
* because it must be modified later to provide the return value.
*/
@ -157,8 +149,6 @@ SYMBOL(up_saveusercontext):
xorl %eax, %eax
ret
#ifndef __CYGWIN__
.size SYMBOL(up_saveusercontext), . - SYMBOL(up_saveusercontext)
#endif
.size up_saveusercontext, . - up_saveusercontext
.end
#endif

View File

@ -47,12 +47,6 @@
* Pre-processor Definitions
****************************************************************************/
#ifdef __CYGWIN__
# define SYMBOL(s) _##s
#else
# define SYMBOL(s) s
#endif
#define KSEG 0x10
/****************************************************************************
@ -65,8 +59,8 @@
* Nasm externals
****************************************************************************/
extern SYMBOL(irq_handler)
extern SYMBOL(isr_handler)
extern irq_handler
extern isr_handler
/****************************************************************************
* Nasm macros
@ -89,8 +83,8 @@ extern SYMBOL(isr_handler)
*/
%macro ISR_NOERRCODE 1
global SYMBOL(vector_isr%1)
SYMBOL(vector_isr%1):
global vector_isr%1
vector_isr%1:
cli /* Disable interrupts firstly. */
push byte 0 /* Push a dummy error code. */
push byte %1 /* Push the interrupt number. */
@ -102,8 +96,8 @@ extern SYMBOL(isr_handler)
*/
%macro ISR_ERRCODE 1
global SYMBOL(vector_isr%1)
SYMBOL(vector_isr%1):
global vector_isr%1
vector_isr%1:
cli /* Disable interrupts. */
push byte %1 /* Push the interrupt number */
jmp isr_common
@ -114,8 +108,8 @@ extern SYMBOL(isr_handler)
*/
%macro IRQ 2
global SYMBOL(vector_irq%1)
SYMBOL(vector_irq%1):
global vector_irq%1
vector_irq%1:
cli
push byte 0
push byte %2
@ -206,7 +200,7 @@ isr_common:
mov esp, eax
push eax
call SYMBOL(isr_handler)
call isr_handler
jmp .Lreturn
/****************************************************************************
@ -238,7 +232,7 @@ irq_common:
mov esp, eax
push eax
call SYMBOL(irq_handler)
call irq_handler
/* The common return point for both isr_handler and irq_handler */
@ -261,7 +255,7 @@ irq_common:
*/
push eax
jmp SYMBOL(up_fullcontext)
jmp up_fullcontext
.Lnoswitch:
pop ebx /* Reload the original data segment descriptor */
@ -287,8 +281,8 @@ irq_common:
* GAS globals
****************************************************************************/
.globl SYMBOL(irq_handler)
.globl SYMBOL(isr_handler)
.globl irq_handler
.globl isr_handler
/****************************************************************************
* GAS macros
@ -307,8 +301,8 @@ irq_common:
*/
.macro ISR_NOERRCODE, intno
.globl SYMBOL(vector_isr\intno)
SYMBOL(vector_isr\intno):
.globl vector_isr\intno
vector_isr\intno:
cli /* Disable interrupts firstly. */
push $0 /* Push a dummy error code. */
push $\intno /* Push the interrupt number. */
@ -320,8 +314,8 @@ SYMBOL(vector_isr\intno):
*/
.macro ISR_ERRCODE, intno
.globl SYMBOL(vector_isr\intno)
SYMBOL(vector_isr\intno):
.globl vector_isr\intno
vector_isr\intno:
cli /* Disable interrupts firstly. */
push $\intno /* Push the interrupt number. */
jmp isr_common /* Go to the common handler code. */
@ -332,8 +326,8 @@ SYMBOL(vector_isr\intno):
*/
.macro IRQ, irqno, intno
.globl SYMBOL(vector_irq\irqno)
SYMBOL(vector_irq\irqno):
.globl vector_irq\irqno
vector_irq\irqno:
cli /* Disable interrupts firstly. */
push $0 /* Push a dummy error code. */
push $\intno /* Push the interrupt number. */
@ -401,9 +395,7 @@ SYMBOL(vector_irq\irqno):
*
****************************************************************************/
#ifndef __CYGWIN__
.type isr_common, @function
#endif
isr_common:
/* trace 'S' */
pusha /* Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax */
@ -423,11 +415,9 @@ isr_common:
mov %esp, %eax
push %eax
call SYMBOL(isr_handler)
call isr_handler
jmp .Lreturn
#ifndef __CYGWIN__
.size isr_common, . - isr_common
#endif
/****************************************************************************
* Name: irq_common
@ -439,9 +429,7 @@ isr_common:
*
****************************************************************************/
#ifndef __CYGWIN__
.type irq_common, @function
#endif
irq_common:
/* trace 'R' */
pusha /* Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax */
@ -461,7 +449,7 @@ irq_common:
mov %esp, %eax
push %eax
call SYMBOL(irq_handler)
call irq_handler
/* The common return point for both isr_handler and irq_handler */
@ -484,7 +472,7 @@ irq_common:
*/
push %eax
call SYMBOL(up_fullcontextrestore)
call up_fullcontextrestore
.Lnoswitch:
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 */
sti
iret /* Pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP */
#ifndef __CYGWIN__
.size irq_common, . - irq_common
#endif
.end
#endif /* CONFIG_X86_NASM */

View File

@ -1,18 +1,24 @@
README
^^^^^^
======
This README file describes the contents of the build configurations available
for the NuttX QEMU i486 port.
Contents
^^^^^^^^
========
* QEMU
- Building QEMU
- Cygwin Build Problems
- Running QEMU
* Toolchains
- Cygwin Buildroot Toolchain
- Buildroot Instructions
* Configurations
- ostest
QEMU
^^^^
====
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):
@ -22,7 +28,8 @@ some links (which are mostly outdated by the time your read this):
Documentation: http://wiki.qemu.org/Manual
Usage: qemu -nographic -kernel nuttx.elf
Building QEMU:
Building QEMU
-------------
tar zxf qemu-0.14.0.tar.gz
cd qemu-0.14.0
@ -30,7 +37,8 @@ Building QEMU:
make
make install
Cygwin build problems:
Cygwin Build Problems
---------------------
Error:
@ -52,8 +60,15 @@ Cygwin build problems:
binaries. I found 0.14.0 here: http://dietpc.org/windows/qemu/, or
2. Try building QEMU with MingGW
Running QEMU
------------
In the top-level NuttX directory:
qemu -cpu 486 -m 2 -kernel nuttx.elf -nographic
Toolchains
^^^^^^^^^^
==========
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,
@ -65,7 +80,8 @@ Toolchains
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).
Cygwin Buildroot Toolchain
Cygwin Buildroot Toolchain
--------------------------
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
@ -75,7 +91,8 @@ Toolchains
i486 build. This is only available in SVN or in any any 1.10 or later buildroot
release.
Buildroot Instructions
Buildroot Instructions
----------------------
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.
Configurations
^^^^^^^^^^^^^^
==============
ostest
------
The "standard" NuttX examples/ostest configuration. This
configuration may be selected as follows: