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:
@@ -1,28 +1,14 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_INTRIN_PADDSW_H_
|
||||
#define COSMOPOLITAN_LIBC_INTRIN_PADDSW_H_
|
||||
#include "libc/intrin/macros.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/**
|
||||
* Adds signed 16-bit integers w/ saturation.
|
||||
*
|
||||
* @param 𝑎 [w/o] receives result
|
||||
* @param 𝑏 [r/o] supplies first input vector
|
||||
* @param 𝑐 [r/o] supplies second input vector
|
||||
* @see paddw()
|
||||
* @mayalias
|
||||
*/
|
||||
static void paddsw(short a[8], const short b[8], const short c[8]) {
|
||||
int i;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
a[i] = MIN(SHRT_MAX, MAX(SHRT_MIN, b[i] + c[i]));
|
||||
}
|
||||
}
|
||||
void paddsw(int16_t[8], const int16_t[8], const int16_t[8]);
|
||||
|
||||
#define paddsw(A, B, C) \
|
||||
INTRIN_SSEVEX_X_X_X_(paddsw, SSE2, "paddsw", INTRIN_COMMUTATIVE, A, B, C)
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_INTRIN_PADDSW_H_ */
|
||||
|
||||
Reference in New Issue
Block a user