mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18:30 +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
|
@ -1,5 +1,6 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_ELF_H_
|
||||
#define COSMOPOLITAN_LIBC_ELF_H_
|
||||
#ifndef __STRICT_ANSI__
|
||||
#include "libc/bits/safemacros.h"
|
||||
#include "libc/elf/def.h"
|
||||
#include "libc/elf/struct/ehdr.h"
|
||||
|
@ -25,7 +26,7 @@ Elf64_Shdr *getelfsectionbyaddress(const Elf64_Ehdr *, size_t, void *);
|
|||
|
||||
forceinline void checkelfaddress(const Elf64_Ehdr *elf, size_t mapsize,
|
||||
intptr_t addr, size_t addrsize) {
|
||||
#if !(TRUSTWORTHY + ELF_TRUSTWORTHY + 0)
|
||||
#if !(TRUSTWORTHY + ELF_TRUSTWORTHY + 0) || ELF_UNTRUSTWORTHY + 0
|
||||
if (addr < (intptr_t)elf || addr + addrsize > (intptr_t)elf + mapsize) {
|
||||
abort();
|
||||
}
|
||||
|
@ -119,4 +120,5 @@ static inline const char *getelfsectionname(const Elf64_Ehdr *elf,
|
|||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* !ANSI */
|
||||
#endif /* COSMOPOLITAN_LIBC_ELF_H_ */
|
||||
|
|
|
@ -7,8 +7,9 @@ typedef struct Elf64_Sym {
|
|||
Elf64_Word st_name;
|
||||
/* ELF64_ST_TYPE(st_info) → STT_{NOTYPE,OBJECT,FUNC,SECTION,FILE,COMMON,...}
|
||||
* ELF64_ST_BIND(st_info) → STB_{LOCAL,GLOBAL,WEAK,...} */
|
||||
unsigned char st_info;
|
||||
unsigned char st_other;
|
||||
uint8_t st_info;
|
||||
/* STV_{DEFAULT,INTERNAL,HIDDEN,PROTECTED} */
|
||||
uint8_t st_other;
|
||||
Elf64_Section st_shndx;
|
||||
Elf64_Addr st_value;
|
||||
Elf64_Xword st_size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue