mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Add x86_64-linux-gnu emulator
I wanted a tiny scriptable meltdown proof way to run userspace programs and visualize how program execution impacts memory. It helps to explain how things like Actually Portable Executable works. It can show you how the GCC generated code is going about manipulating matrices and more. I didn't feel fully comfortable with Qemu and Bochs because I'm not smart enough to understand them. I wanted something like gVisor but with much stronger levels of assurances. I wanted a single binary that'll run, on all major operating systems with an embedded GPL barrier ZIP filesystem that is tiny enough to transpile to JavaScript and run in browsers too. https://justine.storage.googleapis.com/emulator625.mp4
This commit is contained in:
parent
467504308a
commit
f4f4caab0e
1052 changed files with 65667 additions and 7825 deletions
|
@ -18,38 +18,24 @@
|
|||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
/ Returns log₂ₓ exponent part of long double.
|
||||
/
|
||||
/ @param 𝑥 is long double passed on stack
|
||||
/ @return result in %eax
|
||||
/ @note needs sse3
|
||||
tinymath_ilogbl:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
sub $24,%rsp
|
||||
fldt 32(%rsp)
|
||||
fnstcw 14(%rsp)
|
||||
movzwl 14(%rsp),%eax
|
||||
orb $12,%ah
|
||||
movw %ax,12(%rsp)
|
||||
fldt 16(%rbp)
|
||||
fxtract
|
||||
fstp %st
|
||||
fldcw 12(%rsp)
|
||||
fistpl 8(%rsp)
|
||||
fldcw 14(%rsp)
|
||||
movl 8(%rsp),%eax
|
||||
add $24,%rsp
|
||||
push %rax
|
||||
fisttpl (%rsp)
|
||||
mov (%rsp),%eax
|
||||
leave
|
||||
ret
|
||||
.endfn tinymath_ilogbl,globl
|
||||
.alias tinymath_ilogbl,ilogbl
|
||||
|
||||
/*
|
||||
TODO(jart)
|
||||
.globl ilogbl
|
||||
.type ilogbl,@function
|
||||
ilogbl: sub $24,%rsp
|
||||
fldt 32(%rsp)
|
||||
fxtract
|
||||
fstp %st
|
||||
fisttpl 12(%rsp)
|
||||
movl 12(%rsp),%eax
|
||||
add $24,%rsp
|
||||
ret
|
||||
.size ilogbl,.-ilogbl
|
||||
*/
|
||||
.source __FILE__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue