summaryrefslogtreecommitdiffstats
path: root/qemu/roms/openbios/libgcc
diff options
context:
space:
mode:
Diffstat (limited to 'qemu/roms/openbios/libgcc')
-rw-r--r--qemu/roms/openbios/libgcc/__divdi3.c26
-rw-r--r--qemu/roms/openbios/libgcc/__divti3.c26
-rw-r--r--qemu/roms/openbios/libgcc/__lshrdi3.c59
-rw-r--r--qemu/roms/openbios/libgcc/__negti2.c53
-rw-r--r--qemu/roms/openbios/libgcc/__udivdi3.c10
-rw-r--r--qemu/roms/openbios/libgcc/__udivmoddi4.c31
-rw-r--r--qemu/roms/openbios/libgcc/__udivmodti4.c31
-rw-r--r--qemu/roms/openbios/libgcc/__udivti3.c10
-rw-r--r--qemu/roms/openbios/libgcc/__umoddi3.c13
-rw-r--r--qemu/roms/openbios/libgcc/__umodti3.c13
-rw-r--r--qemu/roms/openbios/libgcc/ashldi3.c59
-rw-r--r--qemu/roms/openbios/libgcc/ashrdi3.c60
-rw-r--r--qemu/roms/openbios/libgcc/build.xml24
-rw-r--r--qemu/roms/openbios/libgcc/crtsavres.S401
-rw-r--r--qemu/roms/openbios/libgcc/libgcc.h45
-rw-r--r--qemu/roms/openbios/libgcc/multi3.c83
16 files changed, 944 insertions, 0 deletions
diff --git a/qemu/roms/openbios/libgcc/__divdi3.c b/qemu/roms/openbios/libgcc/__divdi3.c
new file mode 100644
index 000000000..a6b29b9af
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__divdi3.c
@@ -0,0 +1,26 @@
+/*
+ * arch/i386/libgcc/__divdi3.c
+ */
+
+#include "libgcc.h"
+
+int64_t __divdi3(int64_t num, int64_t den)
+{
+ int minus = 0;
+ int64_t v;
+
+ if ( num < 0 ) {
+ num = -num;
+ minus = 1;
+ }
+ if ( den < 0 ) {
+ den = -den;
+ minus ^= 1;
+ }
+
+ v = __udivmoddi4(num, den, NULL);
+ if ( minus )
+ v = -v;
+
+ return v;
+}
diff --git a/qemu/roms/openbios/libgcc/__divti3.c b/qemu/roms/openbios/libgcc/__divti3.c
new file mode 100644
index 000000000..501c14f67
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__divti3.c
@@ -0,0 +1,26 @@
+/*
+ * arch/i386/libgcc/__divti3.c
+ */
+
+#include "libgcc.h"
+
+__int128_t __divti3(__int128_t num, __int128_t den)
+{
+ int minus = 0;
+ __int128_t v;
+
+ if ( num < 0 ) {
+ num = -num;
+ minus = 1;
+ }
+ if ( den < 0 ) {
+ den = -den;
+ minus ^= 1;
+ }
+
+ v = __udivmodti4(num, den, NULL);
+ if ( minus )
+ v = -v;
+
+ return v;
+}
diff --git a/qemu/roms/openbios/libgcc/__lshrdi3.c b/qemu/roms/openbios/libgcc/__lshrdi3.c
new file mode 100644
index 000000000..4c1a38cd5
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__lshrdi3.c
@@ -0,0 +1,59 @@
+/* lshrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin St, Fifth Floor, Boston,
+MA 02110-1301, USA. */
+
+#include "libgcc.h"
+
+#define BITS_PER_UNIT 8
+
+struct DIstruct {SItype high, low;};
+
+typedef union
+{
+ struct DIstruct s;
+ DItype ll;
+} DIunion;
+
+DItype
+__lshrdi3 (DItype u, word_type b)
+{
+ DIunion w;
+ word_type bm;
+ DIunion uu;
+
+ if (b == 0)
+ return u;
+
+ uu.ll = u;
+
+ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
+ if (bm <= 0)
+ {
+ w.s.high = 0;
+ w.s.low = (USItype)uu.s.high >> -bm;
+ }
+ else
+ {
+ USItype carries = (USItype)uu.s.high << bm;
+ w.s.high = (USItype)uu.s.high >> b;
+ w.s.low = ((USItype)uu.s.low >> b) | carries;
+ }
+
+ return w.ll;
+}
diff --git a/qemu/roms/openbios/libgcc/__negti2.c b/qemu/roms/openbios/libgcc/__negti2.c
new file mode 100644
index 000000000..e97cd1228
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__negti2.c
@@ -0,0 +1,53 @@
+/* Extracted from gcc-3.4.1/gcc/config/mips/_tilibi.c */
+/* A few TImode functions needed for TFmode emulated arithmetic.
+ Copyright 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Alexandre Oliva <aoliva@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include "libgcc.h"
+
+#if defined(__sparc__) || defined(__ppc__)
+#define LIBGCC2_WORDS_BIG_ENDIAN
+#endif
+
+typedef union
+{
+ struct TIstruct {
+#if defined(LIBGCC2_WORDS_BIG_ENDIAN)
+ DItype high, low;
+#else
+ DItype low, high;
+#endif
+ } s;
+ TItype ll;
+} TIunion;
+
+TItype
+__negti2 (TItype u)
+{
+ TIunion w;
+ TIunion uu;
+
+ uu.ll = u;
+
+ w.s.low = -uu.s.low;
+ w.s.high = -uu.s.high - ((UDItype) w.s.low > 0);
+
+ return w.ll;
+}
diff --git a/qemu/roms/openbios/libgcc/__udivdi3.c b/qemu/roms/openbios/libgcc/__udivdi3.c
new file mode 100644
index 000000000..2bfe91393
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__udivdi3.c
@@ -0,0 +1,10 @@
+/*
+ * arch/i386/libgcc/__divdi3.c
+ */
+
+#include "libgcc.h"
+
+uint64_t __udivdi3(uint64_t num, uint64_t den)
+{
+ return __udivmoddi4(num, den, NULL);
+}
diff --git a/qemu/roms/openbios/libgcc/__udivmoddi4.c b/qemu/roms/openbios/libgcc/__udivmoddi4.c
new file mode 100644
index 000000000..bed70e12b
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__udivmoddi4.c
@@ -0,0 +1,31 @@
+#include "libgcc.h"
+
+uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem_p)
+{
+ uint64_t quot = 0, qbit = 1;
+
+ if ( den == 0 ) {
+ __divide_error();
+ return 0; /* If trap returns... */
+ }
+
+ /* Left-justify denominator and count shift */
+ while ( (int64_t)den >= 0 ) {
+ den <<= 1;
+ qbit <<= 1;
+ }
+
+ while ( qbit ) {
+ if ( den <= num ) {
+ num -= den;
+ quot += qbit;
+ }
+ den >>= 1;
+ qbit >>= 1;
+ }
+
+ if ( rem_p )
+ *rem_p = num;
+
+ return quot;
+}
diff --git a/qemu/roms/openbios/libgcc/__udivmodti4.c b/qemu/roms/openbios/libgcc/__udivmodti4.c
new file mode 100644
index 000000000..e373c59e6
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__udivmodti4.c
@@ -0,0 +1,31 @@
+#include "libgcc.h"
+
+__uint128_t __udivmodti4(__uint128_t num, __uint128_t den, __uint128_t *rem_p)
+{
+ __uint128_t quot = 0, qbit = 1;
+
+ if ( den == 0 ) {
+ __divide_error();
+ return 0; /* If trap returns... */
+ }
+
+ /* Left-justify denominator and count shift */
+ while ( (__int128_t)den >= 0 ) {
+ den <<= 1;
+ qbit <<= 1;
+ }
+
+ while ( qbit ) {
+ if ( den <= num ) {
+ num -= den;
+ quot += qbit;
+ }
+ den >>= 1;
+ qbit >>= 1;
+ }
+
+ if ( rem_p )
+ *rem_p = num;
+
+ return quot;
+}
diff --git a/qemu/roms/openbios/libgcc/__udivti3.c b/qemu/roms/openbios/libgcc/__udivti3.c
new file mode 100644
index 000000000..6be015bb5
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__udivti3.c
@@ -0,0 +1,10 @@
+/*
+ * arch/i386/libgcc/__divdi3.c
+ */
+
+#include "libgcc.h"
+
+__uint128_t __udivti3(__uint128_t num, __uint128_t den)
+{
+ return __udivmodti4(num, den, NULL);
+}
diff --git a/qemu/roms/openbios/libgcc/__umoddi3.c b/qemu/roms/openbios/libgcc/__umoddi3.c
new file mode 100644
index 000000000..1c7b1cd72
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__umoddi3.c
@@ -0,0 +1,13 @@
+/*
+ * arch/i386/libgcc/__umoddi3.c
+ */
+
+#include "libgcc.h"
+
+uint64_t __umoddi3(uint64_t num, uint64_t den)
+{
+ uint64_t v;
+
+ (void) __udivmoddi4(num, den, &v);
+ return v;
+}
diff --git a/qemu/roms/openbios/libgcc/__umodti3.c b/qemu/roms/openbios/libgcc/__umodti3.c
new file mode 100644
index 000000000..196c7bf7e
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/__umodti3.c
@@ -0,0 +1,13 @@
+/*
+ * arch/i386/libgcc/__umoddi3.c
+ */
+
+#include "libgcc.h"
+
+__uint128_t __umodti3(__uint128_t num, __uint128_t den)
+{
+ __uint128_t v;
+
+ (void) __udivmodti4(num, den, &v);
+ return v;
+}
diff --git a/qemu/roms/openbios/libgcc/ashldi3.c b/qemu/roms/openbios/libgcc/ashldi3.c
new file mode 100644
index 000000000..6feb063e8
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/ashldi3.c
@@ -0,0 +1,59 @@
+/* ashrdi3.c extracted from gcc-2.95.2/libgcc2.c which is: */
+/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin St, Fifth Floor, Boston,
+MA 02110-1301, USA. */
+
+#include "libgcc.h"
+
+#define BITS_PER_UNIT 8
+
+struct DIstruct {SItype high, low;};
+
+typedef union
+{
+ struct DIstruct s;
+ DItype ll;
+} DIunion;
+
+DItype
+__ashldi3 (DItype u, word_type b)
+{
+ DIunion w;
+ word_type bm;
+ DIunion uu;
+
+ if (b == 0)
+ return u;
+
+ uu.ll = u;
+
+ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
+ if (bm <= 0)
+ {
+ w.s.low = 0;
+ w.s.high = (USItype)uu.s.low << -bm;
+ }
+ else
+ {
+ USItype carries = (USItype)uu.s.low >> bm;
+ w.s.low = (USItype)uu.s.low << b;
+ w.s.high = ((USItype)uu.s.high << b) | carries;
+ }
+
+ return w.ll;
+}
diff --git a/qemu/roms/openbios/libgcc/ashrdi3.c b/qemu/roms/openbios/libgcc/ashrdi3.c
new file mode 100644
index 000000000..8594d5eef
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/ashrdi3.c
@@ -0,0 +1,60 @@
+/* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin St, Fifth Floor, Boston,
+MA 02110-1301, USA. */
+
+#include "libgcc.h"
+
+#define BITS_PER_UNIT 8
+
+struct DIstruct {SItype high, low;};
+
+typedef union
+{
+ struct DIstruct s;
+ DItype ll;
+} DIunion;
+
+DItype
+__ashrdi3 (DItype u, word_type b)
+{
+ DIunion w;
+ word_type bm;
+ DIunion uu;
+
+ if (b == 0)
+ return u;
+
+ uu.ll = u;
+
+ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
+ if (bm <= 0)
+ {
+ /* w.s.high = 1..1 or 0..0 */
+ w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
+ w.s.low = uu.s.high >> -bm;
+ }
+ else
+ {
+ USItype carries = (USItype)uu.s.high << bm;
+ w.s.high = uu.s.high >> b;
+ w.s.low = ((USItype)uu.s.low >> b) | carries;
+ }
+
+ return w.ll;
+}
diff --git a/qemu/roms/openbios/libgcc/build.xml b/qemu/roms/openbios/libgcc/build.xml
new file mode 100644
index 000000000..1b7724c5e
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/build.xml
@@ -0,0 +1,24 @@
+<build>
+
+ <library name="gcc" type="static" target="target">
+ <object source="ashldi3.c"/>
+ <object source="ashrdi3.c"/>
+ <object source="__lshrdi3.c"/>
+
+ <object source="__divdi3.c"/>
+ <object source="__udivdi3.c"/>
+ <object source="__udivmoddi4.c"/>
+ <object source="__umoddi3.c"/>
+
+ <object source="crtsavres.S" condition="PPC"/>
+
+ <!-- CONDITION="CONFIG_64BITS" -->
+ <object source="__divti3.c" condition="SPARC64"/>
+ <object source="__udivti3.c" condition="SPARC64"/>
+ <object source="__udivmodti4.c" condition="SPARC64"/>
+ <object source="__umodti3.c" condition="SPARC64"/>
+ <object source="multi3.c" condition="SPARC64"/>
+ <object source="__negti2.c" condition="SPARC64"/>
+ </library>
+
+</build>
diff --git a/qemu/roms/openbios/libgcc/crtsavres.S b/qemu/roms/openbios/libgcc/crtsavres.S
new file mode 100644
index 000000000..40bd7365d
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/crtsavres.S
@@ -0,0 +1,401 @@
+/*
+ * Special support for eabi and SVR4
+ *
+ * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ * Written By Michael Meissner
+ *
+ * Based on gcc/config/rs6000/crtsavres.asm from gcc
+ * 64 bit additions from reading the PPC elf64abi document.
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * In addition to the permissions in the GNU General Public License, the
+ * Free Software Foundation gives you unlimited permission to link the
+ * compiled version of this file with other programs, and to distribute
+ * those programs without any restriction coming from the use of this
+ * file. (The General Public License restrictions do apply in other
+ * respects; for example, they cover modification of the file, and
+ * distribution when not linked into another program.)
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * As a special exception, if you link this library with files
+ * compiled with GCC to produce an executable, this does not cause
+ * the resulting executable to be covered by the GNU General Public License.
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ */
+
+/* taken from Linux arch/powerpc/lib/crtsavres.S */
+
+/* arch/powerpc/include/asm/ppc_asm.h */
+#ifdef CONFIG_PPC64
+
+#define XGLUE(a,b) a##b
+#define GLUE(a,b) XGLUE(a,b)
+
+#define _GLOBAL(name) \
+ .section ".text"; \
+ .align 2 ; \
+ .globl name; \
+ .globl GLUE(.,name); \
+ .section ".opd","aw"; \
+name: \
+ .quad GLUE(.,name); \
+ .quad .TOC.@tocbase; \
+ .quad 0; \
+ .previous; \
+ .type GLUE(.,name),@function; \
+GLUE(.,name):
+
+#else /* 32-bit */
+
+/* include/linux/stringify.h */
+
+/* Indirect stringification. Doing two levels allows the parameter to be a
+ * macro itself. For example, compile with -DFOO=bar, __stringify(FOO)
+ * converts to "bar".
+ */
+
+#define __stringify_1(x...) #x
+#define __stringify(x...) __stringify_1(x)
+
+/* arch/powerpc/include/asm/ppc_asm.h continues */
+
+#define _GLOBAL(n) \
+ .text; \
+ .stabs __stringify(n:F-1),N_FUN,0,0,n;\
+ .globl n; \
+n:
+
+/* some stab codes */
+#define N_FUN 36
+
+#endif
+
+/* arch/powerpc/lib/crtsavres.S continues */
+
+ .file "crtsavres.S"
+ .section ".text"
+
+#ifndef CONFIG_PPC64
+
+/* Routines for saving integer registers, called by the compiler. */
+/* Called with r11 pointing to the stack header word of the caller of the */
+/* function, just beyond the end of the integer save area. */
+
+_GLOBAL(_savegpr_14)
+_GLOBAL(_save32gpr_14)
+ stw 14,-72(11) /* save gp registers */
+_GLOBAL(_savegpr_15)
+_GLOBAL(_save32gpr_15)
+ stw 15,-68(11)
+_GLOBAL(_savegpr_16)
+_GLOBAL(_save32gpr_16)
+ stw 16,-64(11)
+_GLOBAL(_savegpr_17)
+_GLOBAL(_save32gpr_17)
+ stw 17,-60(11)
+_GLOBAL(_savegpr_18)
+_GLOBAL(_save32gpr_18)
+ stw 18,-56(11)
+_GLOBAL(_savegpr_19)
+_GLOBAL(_save32gpr_19)
+ stw 19,-52(11)
+_GLOBAL(_savegpr_20)
+_GLOBAL(_save32gpr_20)
+ stw 20,-48(11)
+_GLOBAL(_savegpr_21)
+_GLOBAL(_save32gpr_21)
+ stw 21,-44(11)
+_GLOBAL(_savegpr_22)
+_GLOBAL(_save32gpr_22)
+ stw 22,-40(11)
+_GLOBAL(_savegpr_23)
+_GLOBAL(_save32gpr_23)
+ stw 23,-36(11)
+_GLOBAL(_savegpr_24)
+_GLOBAL(_save32gpr_24)
+ stw 24,-32(11)
+_GLOBAL(_savegpr_25)
+_GLOBAL(_save32gpr_25)
+ stw 25,-28(11)
+_GLOBAL(_savegpr_26)
+_GLOBAL(_save32gpr_26)
+ stw 26,-24(11)
+_GLOBAL(_savegpr_27)
+_GLOBAL(_save32gpr_27)
+ stw 27,-20(11)
+_GLOBAL(_savegpr_28)
+_GLOBAL(_save32gpr_28)
+ stw 28,-16(11)
+_GLOBAL(_savegpr_29)
+_GLOBAL(_save32gpr_29)
+ stw 29,-12(11)
+_GLOBAL(_savegpr_30)
+_GLOBAL(_save32gpr_30)
+ stw 30,-8(11)
+_GLOBAL(_savegpr_31)
+_GLOBAL(_save32gpr_31)
+ stw 31,-4(11)
+ blr
+
+/* Routines for restoring integer registers, called by the compiler. */
+/* Called with r11 pointing to the stack header word of the caller of the */
+/* function, just beyond the end of the integer restore area. */
+
+_GLOBAL(_restgpr_14)
+_GLOBAL(_rest32gpr_14)
+ lwz 14,-72(11) /* restore gp registers */
+_GLOBAL(_restgpr_15)
+_GLOBAL(_rest32gpr_15)
+ lwz 15,-68(11)
+_GLOBAL(_restgpr_16)
+_GLOBAL(_rest32gpr_16)
+ lwz 16,-64(11)
+_GLOBAL(_restgpr_17)
+_GLOBAL(_rest32gpr_17)
+ lwz 17,-60(11)
+_GLOBAL(_restgpr_18)
+_GLOBAL(_rest32gpr_18)
+ lwz 18,-56(11)
+_GLOBAL(_restgpr_19)
+_GLOBAL(_rest32gpr_19)
+ lwz 19,-52(11)
+_GLOBAL(_restgpr_20)
+_GLOBAL(_rest32gpr_20)
+ lwz 20,-48(11)
+_GLOBAL(_restgpr_21)
+_GLOBAL(_rest32gpr_21)
+ lwz 21,-44(11)
+_GLOBAL(_restgpr_22)
+_GLOBAL(_rest32gpr_22)
+ lwz 22,-40(11)
+_GLOBAL(_restgpr_23)
+_GLOBAL(_rest32gpr_23)
+ lwz 23,-36(11)
+_GLOBAL(_restgpr_24)
+_GLOBAL(_rest32gpr_24)
+ lwz 24,-32(11)
+_GLOBAL(_restgpr_25)
+_GLOBAL(_rest32gpr_25)
+ lwz 25,-28(11)
+_GLOBAL(_restgpr_26)
+_GLOBAL(_rest32gpr_26)
+ lwz 26,-24(11)
+_GLOBAL(_restgpr_27)
+_GLOBAL(_rest32gpr_27)
+ lwz 27,-20(11)
+_GLOBAL(_restgpr_28)
+_GLOBAL(_rest32gpr_28)
+ lwz 28,-16(11)
+_GLOBAL(_restgpr_29)
+_GLOBAL(_rest32gpr_29)
+ lwz 29,-12(11)
+_GLOBAL(_restgpr_30)
+_GLOBAL(_rest32gpr_30)
+ lwz 30,-8(11)
+_GLOBAL(_restgpr_31)
+_GLOBAL(_rest32gpr_31)
+ lwz 31,-4(11)
+ blr
+
+/* Routines for restoring integer registers, called by the compiler. */
+/* Called with r11 pointing to the stack header word of the caller of the */
+/* function, just beyond the end of the integer restore area. */
+
+_GLOBAL(_restgpr_14_x)
+_GLOBAL(_rest32gpr_14_x)
+ lwz 14,-72(11) /* restore gp registers */
+_GLOBAL(_restgpr_15_x)
+_GLOBAL(_rest32gpr_15_x)
+ lwz 15,-68(11)
+_GLOBAL(_restgpr_16_x)
+_GLOBAL(_rest32gpr_16_x)
+ lwz 16,-64(11)
+_GLOBAL(_restgpr_17_x)
+_GLOBAL(_rest32gpr_17_x)
+ lwz 17,-60(11)
+_GLOBAL(_restgpr_18_x)
+_GLOBAL(_rest32gpr_18_x)
+ lwz 18,-56(11)
+_GLOBAL(_restgpr_19_x)
+_GLOBAL(_rest32gpr_19_x)
+ lwz 19,-52(11)
+_GLOBAL(_restgpr_20_x)
+_GLOBAL(_rest32gpr_20_x)
+ lwz 20,-48(11)
+_GLOBAL(_restgpr_21_x)
+_GLOBAL(_rest32gpr_21_x)
+ lwz 21,-44(11)
+_GLOBAL(_restgpr_22_x)
+_GLOBAL(_rest32gpr_22_x)
+ lwz 22,-40(11)
+_GLOBAL(_restgpr_23_x)
+_GLOBAL(_rest32gpr_23_x)
+ lwz 23,-36(11)
+_GLOBAL(_restgpr_24_x)
+_GLOBAL(_rest32gpr_24_x)
+ lwz 24,-32(11)
+_GLOBAL(_restgpr_25_x)
+_GLOBAL(_rest32gpr_25_x)
+ lwz 25,-28(11)
+_GLOBAL(_restgpr_26_x)
+_GLOBAL(_rest32gpr_26_x)
+ lwz 26,-24(11)
+_GLOBAL(_restgpr_27_x)
+_GLOBAL(_rest32gpr_27_x)
+ lwz 27,-20(11)
+_GLOBAL(_restgpr_28_x)
+_GLOBAL(_rest32gpr_28_x)
+ lwz 28,-16(11)
+_GLOBAL(_restgpr_29_x)
+_GLOBAL(_rest32gpr_29_x)
+ lwz 29,-12(11)
+_GLOBAL(_restgpr_30_x)
+_GLOBAL(_rest32gpr_30_x)
+ lwz 30,-8(11)
+_GLOBAL(_restgpr_31_x)
+_GLOBAL(_rest32gpr_31_x)
+ lwz 0,4(11)
+ lwz 31,-4(11)
+ mtlr 0
+ mr 1,11
+ blr
+
+#else /* CONFIG_PPC64 */
+
+.globl _savegpr0_14
+_savegpr0_14:
+ std r14,-144(r1)
+.globl _savegpr0_15
+_savegpr0_15:
+ std r15,-136(r1)
+.globl _savegpr0_16
+_savegpr0_16:
+ std r16,-128(r1)
+.globl _savegpr0_17
+_savegpr0_17:
+ std r17,-120(r1)
+.globl _savegpr0_18
+_savegpr0_18:
+ std r18,-112(r1)
+.globl _savegpr0_19
+_savegpr0_19:
+ std r19,-104(r1)
+.globl _savegpr0_20
+_savegpr0_20:
+ std r20,-96(r1)
+.globl _savegpr0_21
+_savegpr0_21:
+ std r21,-88(r1)
+.globl _savegpr0_22
+_savegpr0_22:
+ std r22,-80(r1)
+.globl _savegpr0_23
+_savegpr0_23:
+ std r23,-72(r1)
+.globl _savegpr0_24
+_savegpr0_24:
+ std r24,-64(r1)
+.globl _savegpr0_25
+_savegpr0_25:
+ std r25,-56(r1)
+.globl _savegpr0_26
+_savegpr0_26:
+ std r26,-48(r1)
+.globl _savegpr0_27
+_savegpr0_27:
+ std r27,-40(r1)
+.globl _savegpr0_28
+_savegpr0_28:
+ std r28,-32(r1)
+.globl _savegpr0_29
+_savegpr0_29:
+ std r29,-24(r1)
+.globl _savegpr0_30
+_savegpr0_30:
+ std r30,-16(r1)
+.globl _savegpr0_31
+_savegpr0_31:
+ std r31,-8(r1)
+ std r0,16(r1)
+ blr
+
+.globl _restgpr0_14
+_restgpr0_14:
+ ld r14,-144(r1)
+.globl _restgpr0_15
+_restgpr0_15:
+ ld r15,-136(r1)
+.globl _restgpr0_16
+_restgpr0_16:
+ ld r16,-128(r1)
+.globl _restgpr0_17
+_restgpr0_17:
+ ld r17,-120(r1)
+.globl _restgpr0_18
+_restgpr0_18:
+ ld r18,-112(r1)
+.globl _restgpr0_19
+_restgpr0_19:
+ ld r19,-104(r1)
+.globl _restgpr0_20
+_restgpr0_20:
+ ld r20,-96(r1)
+.globl _restgpr0_21
+_restgpr0_21:
+ ld r21,-88(r1)
+.globl _restgpr0_22
+_restgpr0_22:
+ ld r22,-80(r1)
+.globl _restgpr0_23
+_restgpr0_23:
+ ld r23,-72(r1)
+.globl _restgpr0_24
+_restgpr0_24:
+ ld r24,-64(r1)
+.globl _restgpr0_25
+_restgpr0_25:
+ ld r25,-56(r1)
+.globl _restgpr0_26
+_restgpr0_26:
+ ld r26,-48(r1)
+.globl _restgpr0_27
+_restgpr0_27:
+ ld r27,-40(r1)
+.globl _restgpr0_28
+_restgpr0_28:
+ ld r28,-32(r1)
+.globl _restgpr0_29
+_restgpr0_29:
+ ld r0,16(r1)
+ ld r29,-24(r1)
+ mtlr r0
+ ld r30,-16(r1)
+ ld r31,-8(r1)
+ blr
+
+.globl _restgpr0_30
+_restgpr0_30:
+ ld r30,-16(r1)
+.globl _restgpr0_31
+_restgpr0_31:
+ ld r0,16(r1)
+ ld r31,-8(r1)
+ mtlr r0
+ blr
+
+#endif /* CONFIG_PPC64 */
diff --git a/qemu/roms/openbios/libgcc/libgcc.h b/qemu/roms/openbios/libgcc/libgcc.h
new file mode 100644
index 000000000..fc82397dc
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/libgcc.h
@@ -0,0 +1,45 @@
+#ifndef _LIBGCC_H
+#define _LIBGCC_H
+
+#include "asm/types.h"
+
+#ifndef NULL
+#define NULL ((void *)0)
+#endif
+
+typedef int SItype __attribute__ ((mode (SI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef int DItype __attribute__ ((mode (DI)));
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
+typedef int word_type __attribute__ ((mode (__word__)));
+
+uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem);
+
+int64_t __divdi3(int64_t num, int64_t den);
+uint64_t __udivdi3(uint64_t num, uint64_t den);
+
+uint64_t __umoddi3(uint64_t num, uint64_t den);
+
+DItype __ashldi3 (DItype u, word_type b);
+DItype __lshrdi3 (DItype u, word_type b);
+DItype __ashrdi3 (DItype u, word_type b);
+
+// Must be implemented outside:
+void __divide_error(void);
+
+#if defined(__arch64__) || defined(__LP64__)
+typedef int TItype __attribute__ ((mode (TI)));
+
+__uint128_t __udivmodti4(__uint128_t num, __uint128_t den, __uint128_t *rem);
+
+__int128_t __divti3(__int128_t num, __int128_t den);
+__uint128_t __udivti3(__uint128_t num, __uint128_t den);
+
+__uint128_t __umodti3(__uint128_t num, __uint128_t den);
+
+TItype __multi3 (TItype u, TItype v);
+TItype __negti2 (TItype u);
+
+#endif
+
+#endif /* _LIBGCC_H */
diff --git a/qemu/roms/openbios/libgcc/multi3.c b/qemu/roms/openbios/libgcc/multi3.c
new file mode 100644
index 000000000..e7186be2a
--- /dev/null
+++ b/qemu/roms/openbios/libgcc/multi3.c
@@ -0,0 +1,83 @@
+/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and
+ gcc-2.7.2.3/longlong.h which is: */
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin St, Fifth Floor, Boston,
+MA 02110-1301, USA. */
+
+#include "libgcc.h"
+
+#define BITS_PER_UNIT 8
+#define DI_TYPE_SIZE 64
+
+#define __BITS4 (DI_TYPE_SIZE / 4)
+#define __ll_B (1L << (DI_TYPE_SIZE / 2))
+#define __ll_lowpart(t) ((UDItype) (t) % __ll_B)
+#define __ll_highpart(t) ((UDItype) (t) / __ll_B)
+
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype __x0, __x1, __x2, __x3; \
+ UDItype __ul, __vl, __uh, __vh; \
+ \
+ __ul = __ll_lowpart (u); \
+ __uh = __ll_highpart (u); \
+ __vl = __ll_lowpart (v); \
+ __vh = __ll_highpart (v); \
+ \
+ __x0 = (UDItype) __ul * __vl; \
+ __x1 = (UDItype) __ul * __vh; \
+ __x2 = (UDItype) __uh * __vl; \
+ __x3 = (UDItype) __uh * __vh; \
+ \
+ __x1 += __ll_highpart (__x0);/* this can't give carry */ \
+ __x1 += __x2; /* but this indeed can */ \
+ if (__x1 < __x2) /* did we get it? */ \
+ __x3 += __ll_B; /* yes, add it in the proper pos. */ \
+ \
+ (w1) = __x3 + __ll_highpart (__x1); \
+ (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \
+ } while (0)
+
+#define __umulsidi3(u, v) \
+ ({TIunion __w; \
+ umul_ppmm (__w.s.high, __w.s.low, u, v); \
+ __w.ll; })
+
+struct TIstruct {DItype high, low;};
+
+typedef union
+{
+ struct TIstruct s;
+ TItype ll;
+} TIunion;
+
+TItype
+__multi3 (TItype u, TItype v)
+{
+ TIunion w;
+ TIunion uu, vv;
+
+ uu.ll = u,
+ vv.ll = v;
+
+ w.ll = __umulsidi3 (uu.s.low, vv.s.low);
+ w.s.high += ((UDItype) uu.s.low * (UDItype) vv.s.high
+ + (UDItype) uu.s.high * (UDItype) vv.s.low);
+
+ return w.ll;
+}