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:
Justine Tunney
2020-08-25 04:23:25 -07:00
parent 467504308a
commit f4f4caab0e
1052 changed files with 65667 additions and 7825 deletions

View File

@@ -1,3 +1,4 @@
#include "libc/bits/pushpop.h"
#include "libc/calls/calls.h"
#include "libc/limits.h"
#include "libc/math.h"
@@ -294,8 +295,7 @@ extern void *REALLOC(void *, size_t);
#define PRIVATE_MEM 2304
#endif
#define PRIVATE_mem ((PRIVATE_MEM + sizeof(double) - 1) / sizeof(double))
static double private_mem[PRIVATE_mem], *pmem_next;
INITIALIZER(300, _init_dtoa_pmem, { pmem_next = private_mem; });
static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
#endif
#undef IEEE_Arith
@@ -398,11 +398,10 @@ Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
#ifdef SET_INEXACT
#define dtoa_divmax 27
#else
int dtoa_divmax; /* Permit experimenting: on some systems, 64-bit integer */
/* division is slow enough that we may sometimes want to */
/* avoid using it. We assume (but do not check) that */
/* dtoa_divmax <= 27.*/
INITIALIZER(300, _init_dtoa_divmax, { dtoa_divmax = 2; });
int dtoa_divmax = 2; /* Permit experimenting: on some systems, 64-bit integer */
/* division is slow enough that we may sometimes want to */
/* avoid using it. We assume (but do not check) that */
/* dtoa_divmax <= 27.*/
#endif
typedef struct BF96 { /* Normalized 96-bit software floating point numbers */

View File

@@ -46,7 +46,6 @@ $(THIRD_PARTY_DTOA_A).pkg: \
$(THIRD_PARTY_DTOA_A_OBJS): \
OVERRIDE_CFLAGS += \
-ansi \
$(OLD_CODE) \
$(IEEE_MATH) \
-ffunction-sections \

View File

@@ -85,7 +85,6 @@ enum
S7 /* _+#.#e+# #S7 */
};
static int xcmp(char*, char*);
static int fpcmp(char*, ulong*);
static void frnorm(ulong*);
static void divascii(char*, int*, int*, int*);