[c5c522c] | 1 | From: Dejan Latinovic <Dejan.Latinovic@imgtec.com> |
---|
| 2 | Date: Thu, 5 Mar 2015 16:51:44 -0800 |
---|
| 3 | Subject: [PATCH 1/3] add-mips64-support-headers |
---|
| 4 | Origin: https://git.kernel.org/cgit/libs/klibc/klibc.git/commit/?id=493f9a99220aed4eb7c6e3dd9018c037d45b13e2 |
---|
| 5 | |
---|
| 6 | Description: Added header files for mips64. |
---|
| 7 | Modeled on mips 32 header files and adapted for 64 bit ABI. |
---|
| 8 | - archsetjmp.h: do not save floating-point state |
---|
| 9 | - asm.h: Symbolic register names for 64 bit ABI |
---|
| 10 | --- |
---|
| 11 | usr/include/arch/mips64/klibc/archconfig.h | 5 ++ |
---|
| 12 | usr/include/arch/mips64/klibc/archsetjmp.h | 26 ++++++++++ |
---|
| 13 | usr/include/arch/mips64/machine/asm.h | 82 ++++++++++++++++++++++++++++++ |
---|
| 14 | usr/include/fcntl.h | 2 +- |
---|
| 15 | 4 files changed, 114 insertions(+), 1 deletion(-) |
---|
| 16 | create mode 100644 usr/include/arch/mips64/klibc/archsetjmp.h |
---|
| 17 | create mode 100644 usr/include/arch/mips64/machine/asm.h |
---|
| 18 | |
---|
| 19 | diff --git a/usr/include/arch/mips64/klibc/archconfig.h b/usr/include/arch/mips64/klibc/archconfig.h |
---|
| 20 | index 4d856a5..df3cf1c 100644 |
---|
| 21 | --- a/usr/include/arch/mips64/klibc/archconfig.h |
---|
| 22 | +++ b/usr/include/arch/mips64/klibc/archconfig.h |
---|
| 23 | @@ -12,7 +12,12 @@ |
---|
| 24 | /* MIPS has nonstandard socket definitions */ |
---|
| 25 | #define _KLIBC_HAS_ARCHSOCKET_H 1 |
---|
| 26 | |
---|
| 27 | +#define _KLIBC_STATFS_F_TYPE_64 1 |
---|
| 28 | + |
---|
| 29 | /* We can use RT signals on MIPS */ |
---|
| 30 | #define _KLIBC_USE_RT_SIG 1 |
---|
| 31 | |
---|
| 32 | +/* MIPS has architecture-specific code for vfork() */ |
---|
| 33 | +#define _KLIBC_REAL_VFORK 1 |
---|
| 34 | + |
---|
| 35 | #endif /* _KLIBC_ARCHCONFIG_H */ |
---|
| 36 | diff --git a/usr/include/arch/mips64/klibc/archsetjmp.h b/usr/include/arch/mips64/klibc/archsetjmp.h |
---|
| 37 | new file mode 100644 |
---|
| 38 | index 0000000..c4587dc |
---|
| 39 | --- /dev/null |
---|
| 40 | +++ b/usr/include/arch/mips64/klibc/archsetjmp.h |
---|
| 41 | @@ -0,0 +1,26 @@ |
---|
| 42 | +/* |
---|
| 43 | + * arch/mips64/include/klibc/archsetjmp.h |
---|
| 44 | + */ |
---|
| 45 | + |
---|
| 46 | +#ifndef _KLIBC_ARCHSETJMP_H |
---|
| 47 | +#define _KLIBC_ARCHSETJMP_H |
---|
| 48 | + |
---|
| 49 | +struct __jmp_buf { |
---|
| 50 | + unsigned long __s0; |
---|
| 51 | + unsigned long __s1; |
---|
| 52 | + unsigned long __s2; |
---|
| 53 | + unsigned long __s3; |
---|
| 54 | + unsigned long __s4; |
---|
| 55 | + unsigned long __s5; |
---|
| 56 | + unsigned long __s6; |
---|
| 57 | + unsigned long __s7; |
---|
| 58 | + unsigned long __gp; |
---|
| 59 | + unsigned long __sp; |
---|
| 60 | + unsigned long __s8; |
---|
| 61 | + unsigned long __ra; |
---|
| 62 | + unsigned long __unused; |
---|
| 63 | +} __attribute__ ((aligned(8))); |
---|
| 64 | + |
---|
| 65 | +typedef struct __jmp_buf jmp_buf[1]; |
---|
| 66 | + |
---|
| 67 | +#endif /* _KLIBC_ARCHSETJMP_H */ |
---|
| 68 | diff --git a/usr/include/arch/mips64/machine/asm.h b/usr/include/arch/mips64/machine/asm.h |
---|
| 69 | new file mode 100644 |
---|
| 70 | index 0000000..42dcaa4 |
---|
| 71 | --- /dev/null |
---|
| 72 | +++ b/usr/include/arch/mips64/machine/asm.h |
---|
| 73 | @@ -0,0 +1,82 @@ |
---|
| 74 | +/* |
---|
| 75 | + * arch/mips64/include/machine/asm.h |
---|
| 76 | + */ |
---|
| 77 | + |
---|
| 78 | +#ifndef _MACHINE_ASM_H |
---|
| 79 | +#define _MACHINE_ASM_H |
---|
| 80 | + |
---|
| 81 | +/* |
---|
| 82 | + * Symbolic register names for 64 bit ABI |
---|
| 83 | + */ |
---|
| 84 | + |
---|
| 85 | + |
---|
| 86 | +#define zero $0 /* wired zero */ |
---|
| 87 | +#define AT $at /* assembler temp - uppercase because of ".set at" */ |
---|
| 88 | +#define v0 $2 /* return value - caller saved */ |
---|
| 89 | +#define v1 $3 |
---|
| 90 | +#define a0 $4 /* argument registers */ |
---|
| 91 | +#define a1 $5 |
---|
| 92 | +#define a2 $6 |
---|
| 93 | +#define a3 $7 |
---|
| 94 | +#define a4 $8 /* arg reg 64 bit; caller saved in 32 bit */ |
---|
| 95 | +#define ta0 $8 |
---|
| 96 | +#define a5 $9 |
---|
| 97 | +#define ta1 $9 |
---|
| 98 | +#define a6 $10 |
---|
| 99 | +#define ta2 $10 |
---|
| 100 | +#define a7 $11 |
---|
| 101 | +#define ta3 $11 |
---|
| 102 | +#define t4 $12 /* caller saved */ |
---|
| 103 | +#define t5 $13 |
---|
| 104 | +#define t6 $14 |
---|
| 105 | +#define t7 $15 |
---|
| 106 | +#define s0 $16 /* callee saved */ |
---|
| 107 | +#define s1 $17 |
---|
| 108 | +#define s2 $18 |
---|
| 109 | +#define s3 $19 |
---|
| 110 | +#define s4 $20 |
---|
| 111 | +#define s5 $21 |
---|
| 112 | +#define s6 $22 |
---|
| 113 | +#define s7 $23 |
---|
| 114 | +#define t8 $24 /* caller saved */ |
---|
| 115 | +#define t9 $25 /* callee address for PIC/temp */ |
---|
| 116 | +#define jp $25 /* PIC jump register */ |
---|
| 117 | +#define k0 $26 /* kernel temporary */ |
---|
| 118 | +#define k1 $27 |
---|
| 119 | +#define gp $28 /* global pointer - caller saved for PIC */ |
---|
| 120 | +#define sp $29 /* stack pointer */ |
---|
| 121 | +#define fp $30 /* frame pointer */ |
---|
| 122 | +#define s8 $30 /* callee saved */ |
---|
| 123 | +#define ra $31 /* return address */ |
---|
| 124 | + |
---|
| 125 | + |
---|
| 126 | +/* |
---|
| 127 | + * LEAF - declare leaf routine |
---|
| 128 | + */ |
---|
| 129 | +#define LEAF(symbol) \ |
---|
| 130 | + .globl symbol; \ |
---|
| 131 | + .align 2; \ |
---|
| 132 | + .type symbol,@function; \ |
---|
| 133 | + .ent symbol,0; \ |
---|
| 134 | +symbol: .frame sp,0,ra |
---|
| 135 | + |
---|
| 136 | + |
---|
| 137 | +/* |
---|
| 138 | + * NESTED - declare nested routine entry point |
---|
| 139 | + */ |
---|
| 140 | +#define NESTED(symbol, framesize, rpc) \ |
---|
| 141 | + .globl symbol; \ |
---|
| 142 | + .align 2; \ |
---|
| 143 | + .type symbol,@function; \ |
---|
| 144 | + .ent symbol,0; \ |
---|
| 145 | +symbol: .frame sp, framesize, rpc |
---|
| 146 | + |
---|
| 147 | +/* |
---|
| 148 | + * END - mark end of function |
---|
| 149 | + */ |
---|
| 150 | +#define END(function) \ |
---|
| 151 | + .end function; \ |
---|
| 152 | + .size function,.-function |
---|
| 153 | + |
---|
| 154 | + |
---|
| 155 | +#endif /* _MACHINE_ASM_H */ |
---|
| 156 | diff --git a/usr/include/fcntl.h b/usr/include/fcntl.h |
---|
| 157 | index bbd6917..16128f8 100644 |
---|
| 158 | --- a/usr/include/fcntl.h |
---|
| 159 | +++ b/usr/include/fcntl.h |
---|
| 160 | @@ -9,7 +9,7 @@ |
---|
| 161 | #include <klibc/compiler.h> |
---|
| 162 | #include <klibc/seek.h> |
---|
| 163 | #include <sys/types.h> |
---|
| 164 | -#if defined(__mips__) && !defined(__mips64__) |
---|
| 165 | +#if defined(__mips__) && ! defined(__mips64) |
---|
| 166 | # include <klibc/archfcntl.h> |
---|
| 167 | #endif |
---|
| 168 | #include <linux/fcntl.h> |
---|
| 169 | -- |
---|
| 170 | 2.4.5 |
---|
| 171 | |
---|