initial version of mips (o32) port, based on work by Richard Pennington (rdp)
basically, this version of the code was obtained by starting with rdp's work from his ellcc source tree, adapting it to musl's build system and coding style, auditing the bits headers for discrepencies with kernel definitions or glibc/LSB ABI or large file issues, fixing up incompatibility with the old binutils from aboriginal linux, and adding some new special cases to deal with the oddities of sigaction and pipe syscall interfaces on mips. at present, minimal test programs work, but some interfaces are broken or missing. threaded programs probably will not link.
This commit is contained in:
parent
cd8d724516
commit
6315004f61
38 changed files with 2196 additions and 0 deletions
22
src/internal/mips/syscall.s
Normal file
22
src/internal/mips/syscall.s
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
.set noreorder
|
||||
|
||||
.global __syscall
|
||||
.type __syscall,@function
|
||||
__syscall:
|
||||
move $10, $4
|
||||
move $4, $5
|
||||
move $5, $6
|
||||
move $6, $7
|
||||
lw $7, 16($sp)
|
||||
lw $8, 20($sp)
|
||||
lw $9, 24($sp)
|
||||
subu $sp, $sp, 32
|
||||
sw $8, 16($sp)
|
||||
sw $9, 20($sp)
|
||||
move $2, $10
|
||||
syscall
|
||||
beq $7, $0, 1f
|
||||
addu $sp, $sp, 32
|
||||
subu $2, $0, $2
|
||||
1: jr $ra
|
||||
nop
|
||||
25
src/setjmp/mips/longjmp.s
Normal file
25
src/setjmp/mips/longjmp.s
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
.set noreorder
|
||||
|
||||
.global _longjmp
|
||||
.global longjmp
|
||||
.type _longjmp,@function
|
||||
.type longjmp,@function
|
||||
_longjmp:
|
||||
longjmp:
|
||||
move $2, $5
|
||||
bne $2, $0, 1f
|
||||
nop
|
||||
addu $2, $2, 1
|
||||
1: lw $ra, 0($4)
|
||||
lw $sp, 4($4)
|
||||
lw $16, 8($4)
|
||||
lw $17, 12($4)
|
||||
lw $18, 16($4)
|
||||
lw $19, 20($4)
|
||||
lw $20, 24($4)
|
||||
lw $21, 28($4)
|
||||
lw $22, 32($4)
|
||||
lw $23, 36($4)
|
||||
lw $30, 40($4)
|
||||
jr $ra
|
||||
lw $28, 44($4)
|
||||
25
src/setjmp/mips/setjmp.s
Normal file
25
src/setjmp/mips/setjmp.s
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
.set noreorder
|
||||
|
||||
.global __setjmp
|
||||
.global _setjmp
|
||||
.global setjmp
|
||||
.type __setjmp,@function
|
||||
.type _setjmp,@function
|
||||
.type setjmp,@function
|
||||
__setjmp:
|
||||
_setjmp:
|
||||
setjmp:
|
||||
sw $ra, 0($4)
|
||||
sw $sp, 4($4)
|
||||
sw $16, 8($4)
|
||||
sw $17, 12($4)
|
||||
sw $18, 16($4)
|
||||
sw $19, 20($4)
|
||||
sw $20, 24($4)
|
||||
sw $21, 28($4)
|
||||
sw $22, 32($4)
|
||||
sw $23, 36($4)
|
||||
sw $30, 40($4)
|
||||
sw $28, 44($4)
|
||||
jr $ra
|
||||
li $2, 0
|
||||
13
src/signal/mips/restore.s
Normal file
13
src/signal/mips/restore.s
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
.set noreorder
|
||||
|
||||
.global __restore_rt
|
||||
.type __restore_rt,@function
|
||||
__restore_rt:
|
||||
li $2, 4193
|
||||
syscall
|
||||
|
||||
.global __restore
|
||||
.type __restore,@function
|
||||
__restore:
|
||||
li $2, 4119
|
||||
syscall
|
||||
20
src/unistd/mips/pipe.s
Normal file
20
src/unistd/mips/pipe.s
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
.set noreorder
|
||||
|
||||
.global pipe
|
||||
.type pipe,@function
|
||||
pipe:
|
||||
lui $gp, %hi(_gp_disp)
|
||||
addiu $gp, %lo(_gp_disp)
|
||||
addu $gp, $gp, $25
|
||||
li $2, 4042
|
||||
syscall
|
||||
beq $7, $0, 1f
|
||||
nop
|
||||
lw $25, %call16(__syscall_ret)($gp)
|
||||
jr $25
|
||||
subu $4, $0, $2
|
||||
1: sw $2, 0($4)
|
||||
sw $3, 4($4)
|
||||
move $2, $0
|
||||
jr $ra
|
||||
nop
|
||||
Loading…
Add table
Add a link
Reference in a new issue