source:
npl/system/klibc/patches/0003-add-mips64-support-arch-mips64-specific.patch
@
c5c522c
Last change on this file since c5c522c was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 2.9 KB |
-
usr/klibc/arch/mips64/MCONFIG
From: Dejan Latinovic <Dejan.Latinovic@imgtec.com> Date: Thu, 5 Mar 2015 16:51:45 -0800 Subject: [PATCH 3/3] add-mips64-support-arch-mips64-specific Origin: https://git.kernel.org/cgit/libs/klibc/klibc.git/commit/?id=3438d861da2e6939a6b0d454ffe247c19ead5993 Description: Adding mips64 specific chagnes. Modeled on mips 32 and adapted for 64 bit ABI. - MCONFIG: using existing klibc.ld scrpit - crt0.S: adapted gp initialization - setjmp.S: do not save floating-point state --- usr/klibc/arch/mips64/MCONFIG | 2 ++ usr/klibc/arch/mips64/crt0.S | 31 ++++++++++++++++++++++++++ usr/klibc/arch/mips64/setjmp.S | 50 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 usr/klibc/arch/mips64/crt0.S create mode 100644 usr/klibc/arch/mips64/setjmp.S diff --git a/usr/klibc/arch/mips64/MCONFIG b/usr/klibc/arch/mips64/MCONFIG index 5c50b8d..b37cc6a 100644
a b 9 9 10 10 KLIBCOPTFLAGS += -Os 11 11 KLIBCBITSIZE = 64 12 13 KLIBCSHAREDFLAGS = -T $(src)/arch/mips/klibc.ld -
new file usr/klibc/arch/mips64/crt0.S
diff --git a/usr/klibc/arch/mips64/crt0.S b/usr/klibc/arch/mips64/crt0.S new file mode 100644 index 0000000..775a919
- + 1 # 2 # arch/mips64/crt0.S 3 # 4 # Does arch-specific initialization and invokes __libc_init 5 # with the appropriate arguments. 6 # 7 # See __static_init.c or __shared_init.c for the expected 8 # arguments. 9 # 10 11 #include <machine/asm.h> 12 13 NESTED(__start, 64, sp) 14 daddiu sp,sp,-64 15 sd zero, 32(sp) 16 17 # Initialize gp 18 lui gp,%highest(_gp) # load highest "halfword" 19 daddiu gp,gp,%higher(_gp) # merge next "halfword" 20 dsll gp,gp,16 # shift by one halfword 21 daddiu gp,gp,%hi(_gp) # merge next "halfword" 22 dsll gp,gp,16 # shift into final position 23 daddiu gp,gp,%lo(_gp) # merge lowest "halfword" 24 25 daddiu a0, sp, 64 # Pointer to ELF entry structure 26 move a1, v0 # Kernel-provided atexit() pointer 27 28 ld t9, %call16(__libc_init)(gp) 29 jalr t9 30 31 END(__start) -
new file usr/klibc/arch/mips64/setjmp.S
diff --git a/usr/klibc/arch/mips64/setjmp.S b/usr/klibc/arch/mips64/setjmp.S new file mode 100644 index 0000000..5d902e2
- + 1 # 2 # arch/mips64/setjmp.S 3 # 4 # setjmp/longjmp for the MIPS architecture 5 # 6 # The jmp_buf is assumed to contain the following, in order: 7 # s0..s7 8 # gp 9 # sp 10 # s8 11 # ra 12 # 13 14 #include <machine/asm.h> 15 16 LEAF(setjmp) 17 sd s0, 0(a0) 18 sd s1, 8(a0) 19 sd s2, 16(a0) 20 sd s3, 24(a0) 21 sd s4, 32(a0) 22 sd s5, 40(a0) 23 sd s6, 48(a0) 24 sd s7, 56(a0) 25 sd gp, 64(a0) 26 sd sp, 72(a0) 27 sd s8, 80(a0) 28 sd ra, 88(a0) 29 move v0, zero 30 jr ra 31 32 END(setjmp) 33 34 LEAF(longjmp) 35 ld s0, 0(a0) 36 ld s1, 8(a0) 37 ld s2, 16(a0) 38 ld s3, 24(a0) 39 ld s4, 32(a0) 40 ld s5, 40(a0) 41 ld s6, 48(a0) 42 ld s7, 56(a0) 43 ld gp, 64(a0) 44 ld sp, 72(a0) 45 ld s8, 80(a0) 46 ld ra, 88(a0) 47 move v0, a1 48 jr ra 49 50 END(longjmp)
Note: See TracBrowser
for help on using the repository browser.