mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08: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
43
tool/build/lib/alu.h
Normal file
43
tool/build/lib/alu.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef COSMOPOLITAN_TOOL_BUILD_LIB_ALU_H_
|
||||
#define COSMOPOLITAN_TOOL_BUILD_LIB_ALU_H_
|
||||
#include "tool/build/lib/machine.h"
|
||||
|
||||
#define ALU_ADD 0
|
||||
#define ALU_OR 1
|
||||
#define ALU_ADC 2
|
||||
#define ALU_SBB 3
|
||||
#define ALU_AND 4
|
||||
#define ALU_SUB 5
|
||||
#define ALU_XOR 6
|
||||
#define ALU_CMP 7
|
||||
#define ALU_TEST 8
|
||||
#define ALU_FLIP 16
|
||||
#define ALU_XCHG 64
|
||||
#define ALU_BYTE 128
|
||||
|
||||
#define BSU_ROL 0
|
||||
#define BSU_ROR 1
|
||||
#define BSU_RCL 2
|
||||
#define BSU_RCR 3
|
||||
#define BSU_SHL 4
|
||||
#define BSU_SHR 5
|
||||
#define BSU_SAL 6
|
||||
#define BSU_SAR 7
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
typedef uint64_t (*aluop1_f)(struct Machine *, uint64_t);
|
||||
typedef uint64_t (*aluop2_f)(struct Machine *, uint64_t, uint64_t);
|
||||
|
||||
int64_t Alu(int, int, uint64_t, uint64_t, uint32_t *);
|
||||
int64_t Bsu(int, int, uint64_t, uint64_t, uint32_t *);
|
||||
uint64_t AluBt(struct Machine *, uint64_t, uint64_t);
|
||||
uint64_t AluBtc(struct Machine *, uint64_t, uint64_t);
|
||||
uint64_t AluBtr(struct Machine *, uint64_t, uint64_t);
|
||||
uint64_t AluBts(struct Machine *, uint64_t, uint64_t);
|
||||
uint64_t BsuDoubleShift(int, uint64_t, uint64_t, uint8_t, bool, uint32_t *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_TOOL_BUILD_LIB_ALU_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue