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 42ab9cc60c
commit 494faf2fbc
5 changed files with 58 additions and 124 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 */