[c5c522c] | 1 | From: Dejan Latinovic <Dejan.Latinovic@imgtec.com> |
---|
| 2 | Date: Thu, 5 Mar 2015 16:51:44 -0800 |
---|
| 3 | Subject: [PATCH 2/3] add-mips64-support-arch-mips32 |
---|
| 4 | Origin: https://git.kernel.org/cgit/libs/klibc/klibc.git/commit/?id=ccd50880175e79fb9bc544c96d72b8971303cc0a |
---|
| 5 | |
---|
| 6 | Description: Add mips64 support, using existing mips32 code. |
---|
| 7 | - using mips32 assembler source files: pipe.S vfork.S syscall.S |
---|
| 8 | - sysstub.ph: copied over from klibc/arch/mips |
---|
| 9 | --- |
---|
| 10 | usr/klibc/arch/mips64/Kbuild | 11 +++++++++++ |
---|
| 11 | usr/klibc/arch/mips64/sysstub.ph | 29 +++++++++++++++++++++++++++++ |
---|
| 12 | 2 files changed, 40 insertions(+) |
---|
| 13 | create mode 100644 usr/klibc/arch/mips64/sysstub.ph |
---|
| 14 | |
---|
| 15 | diff --git a/usr/klibc/arch/mips64/Kbuild b/usr/klibc/arch/mips64/Kbuild |
---|
| 16 | index 970c0f8..6fe3b53 100644 |
---|
| 17 | --- a/usr/klibc/arch/mips64/Kbuild |
---|
| 18 | +++ b/usr/klibc/arch/mips64/Kbuild |
---|
| 19 | @@ -1,3 +1,14 @@ |
---|
| 20 | # |
---|
| 21 | # klibc files for mips64 |
---|
| 22 | # |
---|
| 23 | + |
---|
| 24 | +klib-y := ../mips/pipe.o ../mips/vfork.o setjmp.o ../mips/syscall.o |
---|
| 25 | + |
---|
| 26 | +klib-y += ../../libgcc/__clzsi2.o ../../libgcc/__ashldi3.o |
---|
| 27 | +klib-y += ../../libgcc/__ashrdi3.o ../../libgcc/__lshrdi3.o |
---|
| 28 | +klib-y += ../../libgcc/__divdi3.o ../../libgcc/__moddi3.o |
---|
| 29 | +klib-y += ../../libgcc/__udivdi3.o ../../libgcc/__umoddi3.o |
---|
| 30 | +klib-y += ../../libgcc/__udivmoddi4.o |
---|
| 31 | + |
---|
| 32 | +always := crt0.o |
---|
| 33 | +targets := crt0.o |
---|
| 34 | diff --git a/usr/klibc/arch/mips64/sysstub.ph b/usr/klibc/arch/mips64/sysstub.ph |
---|
| 35 | new file mode 100644 |
---|
| 36 | index 0000000..e8a0200 |
---|
| 37 | --- /dev/null |
---|
| 38 | +++ b/usr/klibc/arch/mips64/sysstub.ph |
---|
| 39 | @@ -0,0 +1,29 @@ |
---|
| 40 | +# -*- perl -*- |
---|
| 41 | +# |
---|
| 42 | +# arch/mips64/sysstub.ph |
---|
| 43 | +# |
---|
| 44 | +# Script to generate system call stubs |
---|
| 45 | +# |
---|
| 46 | + |
---|
| 47 | +# On MIPS, most system calls follow the standard convention, with the |
---|
| 48 | +# system call number in r0 (v0), return an error value in r19 (a3) as |
---|
| 49 | +# well as the return value in r0 (v0). |
---|
| 50 | + |
---|
| 51 | +sub make_sysstub($$$$$@) { |
---|
| 52 | + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; |
---|
| 53 | + |
---|
| 54 | + $stype = $stype || 'common'; |
---|
| 55 | + open(OUT, '>', "${outputdir}/${fname}.S"); |
---|
| 56 | + print OUT "#include <machine/asm.h>\n"; |
---|
| 57 | + print OUT "#include <asm/unistd.h>\n"; |
---|
| 58 | + print OUT "\n"; |
---|
| 59 | + print OUT "\t.set noreorder\n"; |
---|
| 60 | + print OUT "\n"; |
---|
| 61 | + print OUT "LEAF(${fname})\n"; |
---|
| 62 | + print OUT "\tj\t__syscall_${stype}\n"; |
---|
| 63 | + print OUT "\t li\tv0, __NR_${sname}\n"; |
---|
| 64 | + print OUT "\tEND(${fname})\n"; |
---|
| 65 | + close(OUT); |
---|
| 66 | +} |
---|
| 67 | + |
---|
| 68 | +1; |
---|
| 69 | -- |
---|
| 70 | 2.4.5 |
---|
| 71 | |
---|