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 * 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 */

View File

@ -49,12 +49,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 */

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 */

View File

@ -49,12 +49,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

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 */