summaryrefslogtreecommitdiff
path: root/com32/lib/libgcc
diff options
context:
space:
mode:
authorchandramouli narayanan <mouli@linux.intel.com>2012-06-25 12:34:46 -0700
committerchandramouli narayanan <mouli@linux.intel.com>2012-06-25 12:34:46 -0700
commit5caee9aeaf89dbbc45269737cc1dac7de070b867 (patch)
tree5284cfb67697c00d34cfca692e2da52f22e9716d /com32/lib/libgcc
parentc53187e1adc326c3246917cb936cbab020b4d820 (diff)
downloadsyslinux-5caee9aeaf89dbbc45269737cc1dac7de070b867.tar.gz
This patch implements the setjmp/longjmp, memcpy, memmove, memset and mempcpy functions
as appropriate for the architecture. The code came from klibc. com32/lib has i386 and x86_64 sub directories implementing the code. The code in com32/lib/libgcc/__muldi3.S essentially has fixes for building x86_64. The file x86_init_fpu.c is split into the respective architecture specific files and reside under com32/lib/sys/i386 and com32/lib/sys/x86_64. The file com32/lib/sys/farcall.c has fixes for architecture-specific code. The com32 lib dependends on it. Remanants of the unused old i386-only files, if any, need to be pruned.
Diffstat (limited to 'com32/lib/libgcc')
-rw-r--r--com32/lib/libgcc/__muldi3.S49
1 files changed, 49 insertions, 0 deletions
diff --git a/com32/lib/libgcc/__muldi3.S b/com32/lib/libgcc/__muldi3.S
index 648a88ad..424787c8 100644
--- a/com32/lib/libgcc/__muldi3.S
+++ b/com32/lib/libgcc/__muldi3.S
@@ -9,6 +9,8 @@
.globl __muldi3
.type __muldi3,@function
__muldi3:
+#if __SIZEOF_POINTER__ == 4
+ /* i386 */
push %esi
#ifndef REGPARM
movl 8(%esp),%eax
@@ -31,4 +33,51 @@ __muldi3:
#endif
pop %esi
ret
+#elif __SIZEOF_POINTER__ == 8
+ /* x86_64 */
+ push %rsi
+#ifndef REGPARM
+/*
+ movl 8(%esp),%eax
+ movl %eax,%esi
+ movl 16(%esp),%ecx
+ mull %ecx
+ imull 12(%esp),%ecx
+ imull 20(%esp),%esi
+ addl %ecx,%edx
+ addl %esi,%edx
+*/
+ movq 8(%rsp),%rax
+ movq %rax,%rsi
+ movq 16(%rsp),%rcx
+ mulq %rcx
+ imulq 12(%rsp),%rcx
+ imulq 20(%rsp),%rsi
+ addq %rcx,%rdx
+ addq %rsi,%rdx
+#else
+/*
+ movl %eax,%esi
+ push %edx
+ mull %ecx
+ imull 8(%esp),%esi
+ addl %esi,%edx
+ pop %rsi
+ imull %esi,%ecx
+ addl %ecx,%edx
+*/
+ movq %rax,%rsi
+ pushq %rdx
+ mulq %rcx
+ imulq 8(%rsp),%rsi
+ addq %rsi,%rdx
+ popq %rsi
+ imulq %rsi,%rcx
+ addq %rcx,%rdx
+#endif
+ pop %rsi
+ ret
+#else
+#error "Unsupported architecture for __muldi3.S"
+#endif
.size __muldi3,.-__muldi3