aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--com32/lib/com32.ld128
-rw-r--r--com32/lib/memcpy.S90
-rw-r--r--com32/lib/memmove.S150
-rw-r--r--com32/lib/mempcpy.S89
-rw-r--r--com32/lib/memset.S90
-rw-r--r--com32/lib/setjmp.S68
6 files changed, 2 insertions, 613 deletions
diff --git a/com32/lib/com32.ld b/com32/lib/com32.ld
deleted file mode 100644
index 4000ed72..00000000
--- a/com32/lib/com32.ld
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Linker script for COM32 binaries using libcom32
- */
-
-/* Script for -z combreloc: combine and sort reloc sections */
-OUTPUT_FORMAT("elf32-i386", "elf32-i386",
- "elf32-i386")
-OUTPUT_ARCH(i386)
-EXTERN(_start)
-ENTRY(_start)
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- . = 0;
- HIDDEN (__executable_start = .);
- HIDDEN (_stext = .);
-
- .init :
- {
- KEEP (*(.init))
- } =0x90909090
- .text :
- {
- *(.text .stub .text.* .gnu.linkonce.t.*)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- } =0x90909090
- .fini :
- {
- KEEP (*(.fini))
- } =0x90909090
- HIDDEN (_etext = .);
-
- HIDDEN( __rodata_start = .);
- .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
- .rodata1 : { *(.rodata1) }
- HIDDEN(__rodata_end = .);
-
- /*
- * The difference betwee .ctors/.dtors and .init_array/.fini_array
- * is the ordering, but we don't use prioritization for libcom32, so
- * just lump them all together and hope that's okay.
- */
- . = ALIGN(4);
- .ctors : {
- HIDDEN(__ctors_start = .);
- KEEP (*(SORT(.preinit_array*)))
- KEEP (*(SORT(.init_array*)))
- KEEP (*(SORT(.ctors*)))
- HIDDEN(__ctors_end = .);
- }
- .dtors : {
- HIDDEN(__dtors_start = .);
- KEEP (*(SORT(.fini_array*)))
- KEEP (*(SORT(.dtors*)))
- HIDDEN(__dtors_end = .);
- }
-
- .got : {
- HIDDEN(__got_start = .);
- KEEP (*(.got.plt))
- KEEP (*(.got))
- HIDDEN(__got_end = .);
- }
-
- /* Adjust the address for the data segment. Avoid mixing code and
- data within same 128-byte chunk. */
- . = ALIGN(128);
-
- .data :
- {
- HIDDEN(_sdata = .);
- KEEP(*(.data .data.* .gnu.linkonce.d.*))
- SORT(CONSTRUCTORS)
- *(.data1)
- . = ALIGN(4);
- HIDDEN(_edata = .);
- }
-
- HIDDEN(__bss_start = .);
- .bss :
- {
- *(.dynbss)
- *(.bss .bss.* .gnu.linkonce.b.*)
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections. */
- . = ALIGN(4);
- }
- . = ALIGN(4);
- HIDDEN(_end = .);
-
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
- /* DWARF debug sections.
- Symbols in the DWARF debugging sections are relative to the beginning
- of the section so we begin them at 0. */
- /* DWARF 1 */
- .debug 0 : { *(.debug) }
- .line 0 : { *(.line) }
- /* GNU DWARF 1 extensions */
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- /* DWARF 1.1 and DWARF 2 */
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- /* DWARF 2 */
- .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- /* SGI/MIPS DWARF 2 extensions */
- .debug_weaknames 0 : { *(.debug_weaknames) }
- .debug_funcnames 0 : { *(.debug_funcnames) }
- .debug_typenames 0 : { *(.debug_typenames) }
- .debug_varnames 0 : { *(.debug_varnames) }
- /DISCARD/ : { *(.note.GNU-stack) }
-}
diff --git a/com32/lib/memcpy.S b/com32/lib/memcpy.S
deleted file mode 100644
index 9b5306dd..00000000
--- a/com32/lib/memcpy.S
+++ /dev/null
@@ -1,90 +0,0 @@
-/* ----------------------------------------------------------------------- *
- *
- * Copyright 2008 H. Peter Anvin - All Rights Reserved
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall
- * be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * memcpy.S
- *
- * Reasonably efficient memcpy, using aligned transfers at least
- * for the destination operand.
- */
-
- .text
- .globl memcpy
- .type memcpy, @function
-memcpy:
- movl 0xc(%esp),%ecx
- movl 0x8(%esp),%edx
- movl 0x4(%esp),%eax
-
- jecxz 1f
-
- pushl %esi
- pushl %edi
- pushl %eax /* Return value */
-
- movl %eax,%edi
- movl %edx,%esi
-
- /* Initial alignment */
- movl %edi,%edx
- shrl $1,%edx
- jnc 11f
- movsb
- decl %ecx
-11:
- movb %cl,%al
- cmpl $2,%ecx
- jb 13f
-
- shrl $1,%edx
- jnc 12f
- movsw
- subl $2,%ecx
-12:
- /* Bulk transfer */
- movb %cl,%al
- shrl $2,%ecx
- rep; movsl
-
- /* Final alignment */
- testb $2,%al
- jz 14f
- movsw
-13:
-14:
- testb $1,%al
- jz 15f
- movsb
-15:
-
- popl %eax /* Return value */
- popl %edi
- popl %esi
-1:
- ret
-
- .size memcpy, .-memcpy
diff --git a/com32/lib/memmove.S b/com32/lib/memmove.S
deleted file mode 100644
index 2094e4aa..00000000
--- a/com32/lib/memmove.S
+++ /dev/null
@@ -1,150 +0,0 @@
-/* ----------------------------------------------------------------------- *
- *
- * Copyright 2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2010 Intel Corporation; author: H. Peter Anvin
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall
- * be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * memmove.S
- *
- * Reasonably efficient memmove, using aligned transfers at least
- * for the destination operand.
- */
-
- .globl memmove
- .type memmove,@function
- .text
-memmove:
- movl 0xc(%esp),%ecx
- movl 0x8(%esp),%edx
- movl 0x4(%esp),%eax
-
- jecxz 4f
-
- pushl %esi
- pushl %edi
- pushl %eax /* Return value */
-
- movl %eax,%edi
- movl %edx,%esi
-
- cmpl %edi,%esi
- jb 2f
-
- /* source >= dest, forwards move */
-
- /* Initial alignment */
-1:
- movl %edi,%edx
- shrl $1,%edx
- jnc 11f
- movsb
- decl %ecx
-11:
- movb %cl,%al
- cmpl $2,%ecx
- jb 13f
-
- shrl $1,%edx
- jnc 12f
- movsw
- subl $2,%ecx
-12:
- /* Bulk transfer */
- movb %cl,%al
- shrl $2,%ecx
- rep; movsl
-
- /* Final alignment */
- testb $2,%al
- jz 14f
- movsw
-13:
-14:
- testb $1,%al
- jz 15f
- movsb
-15:
- /* Common exit stub */
-3:
- popl %eax /* Return value */
- popl %edi
- popl %esi
-4:
- ret
-
-
-2:
- /* source < dest, backwards move if overlap */
- leal -1(%ecx,%esi),%eax
- cmpl %eax,%edi
- ja 1b /* No overlap, after all... */
-
- std
- leal -1(%ecx,%edi),%edi
- movl %eax,%esi
-
- /* Initial alignment */
- movl %edi,%edx
- shrl $1,%edx
- jc 21f
- movsb
- decl %ecx
-21:
- decl %esi
- decl %edi
- movb %cl,%al
- cmpl $2,%ecx
- jb 23f
- shrl $1,%edx
- jc 22f
- movsw
- subl $2,%ecx
-22:
- /* Bulk transfer */
- subl $2,%esi
- subl $2,%edi
- movb %cl,%al
- shrl $2,%ecx
- rep; movsl
-
- /* Final alignment */
- addl $2,%esi
- addl $2,%edi
- testb $2,%al
- jz 24f
- movsw
-23:
-24:
- incl %esi
- incl %edi
- testb $1,%al
- jz 25f
- movsb
-25:
- cld
- jmp 3b
-
- .size memmove, .-memmove
diff --git a/com32/lib/mempcpy.S b/com32/lib/mempcpy.S
deleted file mode 100644
index 2096f132..00000000
--- a/com32/lib/mempcpy.S
+++ /dev/null
@@ -1,89 +0,0 @@
-/* ----------------------------------------------------------------------- *
- *
- * Copyright 2008 H. Peter Anvin - All Rights Reserved
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall
- * be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * mempcpy.S
- *
- * Reasonably efficient mempcpy, using aligned transfers at least
- * for the destination operand.
- */
-
- .text
- .globl mempcpy
- .type mempcpy, @function
-mempcpy:
- movl 0xc(%esp),%ecx
- movl 0x8(%esp),%edx
- movl 0x4(%esp),%eax
-
- jecxz 1f
-
- pushl %esi
- pushl %edi
-
- movl %eax,%edi
- movl %edx,%esi
-
- /* Initial alignment */
- movl %edi,%edx
- shrl $1,%edx
- jnc 11f
- movsb
- decl %ecx
-11:
- movb %cl,%al
- cmpl $2,%ecx
- jb 13f
-
- shrl $1,%edx
- jnc 12f
- movsw
- subl $2,%ecx
-12:
- /* Bulk transfer */
- movb %cl,%al
- shrl $2,%ecx
- rep; movsl
-
- /* Final alignment */
- testb $2,%al
- jz 14f
- movsw
-13:
-14:
- testb $1,%al
- jz 15f
- movsb
-15:
-
- movl %edi,%eax /* Return value */
- popl %edi
- popl %esi
-1:
- ret
-
- .size mempcpy, .-mempcpy
diff --git a/com32/lib/memset.S b/com32/lib/memset.S
deleted file mode 100644
index fd42842a..00000000
--- a/com32/lib/memset.S
+++ /dev/null
@@ -1,90 +0,0 @@
-/* ----------------------------------------------------------------------- *
- *
- * Copyright 2008 H. Peter Anvin - All Rights Reserved
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall
- * be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * memset.S
- *
- * Reasonably efficient memset, using aligned transfers at least
- * for the destination operand.
- */
-
- .globl memset
- .type memset,@function
- .text
-memset:
- movl 0xc(%esp),%ecx
- movl 0x8(%esp),%edx
- movl 0x4(%esp),%eax
-
- jecxz 6f
-
- pushl %edi
- pushl %ebx
- pushl %eax /* Return value */
-
- movl %eax,%edi
- movb %dl,%dh
- movzwl %dx,%eax
- shll $16,%edx
- orl %edx,%eax
-
- /* Initial alignment */
- movl %edi,%edx
- shrl $1,%edx
- jnc 1f
- stosb
- decl %ecx
-1:
- movb %cl,%bl
- cmpl $2,%ecx
- jb 3f
- shrl $1,%edx
- jnc 2f
- stosw
- subl $2,%ecx
-2:
- /* Bulk transfer */
- movb %cl,%bl
- shrl $2,%ecx
- rep; stosl
-
- testb $2,%bl
- jz 4f
- stosw
-3:
-4:
- testb $1,%bl
- jz 5f
- stosb
-5:
- popl %eax /* Return value */
- popl %ebx
- popl %edi
-6:
- ret
-
- .size memset, .-memset
diff --git a/com32/lib/setjmp.S b/com32/lib/setjmp.S
index 2fb5c234..ac047dda 100644
--- a/com32/lib/setjmp.S
+++ b/com32/lib/setjmp.S
@@ -1,70 +1,6 @@
-/*
- * arch/i386/setjmp.S
- *
- * setjmp/longjmp for the i386 architecture
- *
- *
- *
- * The jmp_buf is assumed to contain the following, in order:
- * %ebx
- * %esp
- * %ebp
- * %esi
- * %edi
- * <return address>
- */
-/*
- .text
- .align 4
-
- .globl _setjmp
- .type _setjmp, @function
-_setjmp: # gcc 4.0.1 wants this as an alias?
-
- .globl setjmp
- .type setjmp, @function
-setjmp:
-#ifdef REGPARM
- movl %eax,%edx
-#else
- movl 4(%esp),%edx
-#endif
- popl %ecx # Return address, and adjust the stack
- xorl %eax,%eax # Return value
- movl %ebx,(%edx)
- movl %esp,4(%edx) # Post-return %esp!
- pushl %ecx # Make the call/return stack happy
- movl %ebp,8(%edx)
- movl %esi,12(%edx)
- movl %edi,16(%edx)
- movl %ecx,20(%edx) # Return address
- ret
-
- .size setjmp,.-setjmp
-
- .text
- .align 4
- .globl longjmp
- .type longjmp, @function
-longjmp:
-#ifdef REGPARM
- xchgl %eax,%edx
-#else
- movl 4(%esp),%edx # jmp_ptr address
- movl 8(%esp),%eax # Return value
-#endif
- movl (%edx),%ebx
- movl 4(%edx),%esp
- movl 8(%edx),%ebp
- movl 12(%edx),%esi
- movl 16(%edx),%edi
- jmp *20(%edx)
-
- .size longjmp,.-longjmp
-*/
-#if __SIZEOF_POINTER__ == 4
+#ifdef __i386__
#include <i386/setjmp.S>
-#elif __SIZEOF_POINTER__ == 8
+#elif defined(__x86_64__)
#include <x86_64/setjmp.S>
#else
#error "Unable to build for to-be-defined architecture type"