Improve signal handling and math

- Polyfill ucontext_t on FreeBSD/OpenBSD/NetBSD
- Add tests confirming signals can edit CPU state
- Work towards supporting ZIP filesystem on bare metal
- Add more tinymath unit tests for POSIX conformance
- Add X87 and SSE status flags to crash report
- Fix some bugs in blinkenlights
- Fix llvm build breakage
This commit is contained in:
Justine Tunney 2021-02-25 18:30:17 -08:00
parent cdc54ea1fd
commit 40291c9db3
109 changed files with 2316 additions and 520 deletions

View file

@ -16,18 +16,23 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/runtime/pc.internal.h"
#include "libc/macros.h"
.source __FILE__
// Returns 𝑒^x-1.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of exponentiation on FPU stack in %st
expm1l:
push %rbp
expm1l: push %rbp
mov %rsp,%rbp
.profilable
fldt 16(%rbp)
fxam # isinf(x)
fstsw %ax
mov %ah,%al
and $0x45,%ah
cmp $5,%ah
je 1f
fldl2e
fmulp %st,%st(1)
fld %st
@ -40,11 +45,15 @@ expm1l:
fxch %st(2)
fscale
fstp %st(1)
fsubs .Lone(%rip)
fld1
fsubrp
faddp %st,%st(1)
pop %rbp
0: pop %rbp
ret
1: test $2,%al # signbit(x)
jz 0b
fstp %st
fld1
3: fchs
jmp 0b
.endfn expm1l,globl
.rodata.cst4
.Lone: .float 1.0