user: implement mlibc as the libc, finally.

It's finally done..

Signed-off-by: kaguya <vpshinomiya@protonmail.com>
This commit is contained in:
kaguya
2026-05-02 03:31:49 -04:00
parent 2fa39ad85a
commit 9a9b91c940
2387 changed files with 152741 additions and 315 deletions
@@ -0,0 +1,111 @@
#include <bits/ansi/fenv.h>
.global feclearexcept
.type feclearexcept,@function
feclearexcept:
move.l 4(%sp), %d0
andi.l #~FE_ALL_EXCEPT, %d0
bne 1f
fmove.l %fpsr, %d1
movel 4(%sp), %d0
not.l %d0
and.l %d0, %d1
fmove.l %d1, %fpsr
moveq.l #0, %d0
rts
1:
moveq.l #-1, %d0
rts
.global feraiseexcept
.type feraiseexcept,@function
feraiseexcept:
move.l 4(%sp), %d0
andi.l #~FE_ALL_EXCEPT, %d0
bne 1f
fmove.l %fpsr, %d1
or.l 4(%sp), %d1
fmove.l %d1, %fpsr
moveq.l #0, %d0
rts
1:
moveq.l #-1, %d0
rts
.global __fesetround
.hidden __fesetround
.type __fesetround,@function
__fesetround:
fmove.l %fpcr, %d1
andi.l #~FE_UPWARD, %d1
or.l 4(%sp), %d1
fmove.l %d1, %fpcr
moveq.l #0, %d0
rts
.global fegetround
.type fegetround,@function
fegetround:
fmove.l %fpcr, %d0
andi.l #FE_UPWARD, %d0
rts
.global fegetenv
.type fegetenv,@function
fegetenv:
move.l 4(%sp), %a0
fmove.l %fpcr, %d0
move.l %d0, (%a0)
fmove.l %fpsr, %d0
move.l %d0, 4(%a0)
fmove.l %fpiar, %d0
move.l %d0, 8(%a0)
moveq.l #0, %d0
rts
.global fesetenv
.type fesetenv,@function
fesetenv:
move.l 4(%sp), %a0
cmp.l #-1, %a0
beq 1f
move.l (%a0), %d0
fmove.l %d0, %fpcr
move.l 4(%a0), %d0
fmove.l %d0, %fpsr
move.l 8(%a0), %d0
fmove.l %d0, %fpiar
moveq.l #0, %d0
rts
1:
clr.l %d0
fmove.l %d0, %fpcr
fmove.l %d0, %fpsr
fmove.l %d0, %fpiar
moveq.l #0, %d0
rts
.global fetestexcept
.type fetestexcept,@function
fetestexcept:
fmove.l %fpsr, %d0
and.l 4(%sp), %d0
rts
.section .note.GNU-stack,"",%progbits
@@ -0,0 +1,52 @@
.type __setjmp, "function"
__setjmp:
movea.l 4(%sp), %a0
movem.l %d2-%d7/%a2-%a7, (%a0)
move.l (%sp), 48(%a0)
tst.l %d0
bne 1f
clr.l %d0
rts
1:
move.l #1, -(%sp)
move.l %a0, -(%sp)
jbsr __sigsetjmp@PLTPC
addq.l #8, %sp
rts
.global setjmp
.type setjmp, "function"
.global _setjmp
.type _setjmp, "function"
setjmp:
_setjmp:
clr.l %d0
jmp __setjmp
.global sigsetjmp
.type sigsetjmp, "function"
sigsetjmp:
move.l #1, %d0
jmp __setjmp
.global longjmp
.type longjmp, "function"
.global _longjmp
.type _longjmp, "function"
longjmp:
_longjmp:
movea.l 4(%sp),%a0
move.l 8(%sp),%d0
bne 1f
move.l #1,%d0
1:
movem.l (%a0), %d2-%d7/%a2-%a7
move.l 48(%a0), (%sp)
rts
.section .note.GNU-stack,"",%progbits