mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03: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
|
@ -1,5 +1,6 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_ACCOUNTING_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_ACCOUNTING_H_
|
||||
#include "libc/nt/thunk/msabi.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
|
@ -64,6 +65,9 @@ int32_t SetProcessWorkingSetSizeEx(int64_t hProcess,
|
|||
uint64_t dwMaximumWorkingSetSize,
|
||||
uint32_t Flags);
|
||||
|
||||
#if ShouldUseMsabiAttribute()
|
||||
#include "libc/nt/thunk/accounting.inc"
|
||||
#endif /* ShouldUseMsabiAttribute() */
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_ACCOUNTING_H_ */
|
||||
|
|
|
@ -148,9 +148,9 @@ bool32 GetFileAttributesEx(
|
|||
uint32_t GetCompressedFileSize(const char16_t *lpFileName,
|
||||
uint32_t *lpFileSizeHigh);
|
||||
bool32 SetFileAttributes(const char16_t *lpFileName, uint32_t dwFileAttributes);
|
||||
bool32 GetFileTime(int64_t hFile, struct NtFileTime *lpCreationFileTime,
|
||||
struct NtFileTime *lpLastAccessFileTime,
|
||||
struct NtFileTime *lpLastWriteFileTime);
|
||||
bool32 GetFileTime(int64_t hFile, struct NtFileTime *opt_lpCreationFileTime,
|
||||
struct NtFileTime *opt_lpLastAccessFileTime,
|
||||
struct NtFileTime *opt_lpLastWriteFileTime);
|
||||
bool32 SetFileTime(int64_t hFile,
|
||||
const struct NtFileTime *opt_lpCreationFileTime,
|
||||
const struct NtFileTime *opt_lpLastAccessFileTime,
|
||||
|
|
|
@ -2162,8 +2162,8 @@ imp 'GetFileMUIPath' GetFileMUIPath KernelBase 550
|
|||
imp 'GetFileNameFromBrowse' GetFileNameFromBrowse shell32 63
|
||||
imp 'GetFileSecurity' GetFileSecurityW KernelBase 551 5
|
||||
imp 'GetFileSecurityA' GetFileSecurityA advapi32 1326 5
|
||||
imp 'GetFileSize$nopenopenope' GetFileSize KernelBase 552
|
||||
imp 'GetFileSizeEx$nopenopenope' GetFileSizeEx KernelBase 553
|
||||
imp 'GetFileSize' GetFileSize KernelBase 552 m
|
||||
imp 'GetFileSizeEx' GetFileSizeEx KernelBase 553 m
|
||||
imp 'GetFileTime' GetFileTime KernelBase 554 4
|
||||
imp 'GetFileTitleA' GetFileTitleA comdlg32 111
|
||||
imp 'GetFileTitle' GetFileTitleW comdlg32 112
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "libc/nt/enum/memflags.h"
|
||||
#include "libc/nt/enum/offerpriority.h"
|
||||
#include "libc/nt/enum/pageflags.h"
|
||||
#include "libc/nt/thunk/msabi.h"
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
|
@ -72,6 +73,9 @@ bool32 PrefetchVirtualMemory(int64_t hProcess, const uint32_t *NumberOfEntries,
|
|||
bool32 OfferVirtualMemory(void *inout_VirtualAddress, size_t Size,
|
||||
enum NtOfferPriority Priority);
|
||||
|
||||
#if ShouldUseMsabiAttribute()
|
||||
#include "libc/nt/thunk/memory.inc"
|
||||
#endif /* ShouldUseMsabiAttribute() */
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_MEMORY_H_ */
|
||||
|
|
|
@ -35,7 +35,7 @@ LIBC_NT_KERNEL32_A = o/$(MODE)/libc/nt/kernel32.a
|
|||
LIBC_NT_KERNEL32_A_SRCS := $(wildcard libc/nt/kernel32/*.s)
|
||||
LIBC_NT_KERNEL32_A_OBJS = $(LIBC_NT_KERNEL32_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_KERNEL32_A_CHECKS = $(LIBC_NT_KERNEL32_A).pkg
|
||||
LIBC_NT_KERNEL32_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_KERNEL32_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_KERNEL32_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_KERNEL32_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -56,7 +56,7 @@ LIBC_NT_ADVAPI32_A = o/$(MODE)/libc/nt/advapi32.a
|
|||
LIBC_NT_ADVAPI32_A_SRCS := $(wildcard libc/nt/advapi32/*.s)
|
||||
LIBC_NT_ADVAPI32_A_OBJS = $(LIBC_NT_ADVAPI32_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_ADVAPI32_A_CHECKS = $(LIBC_NT_ADVAPI32_A).pkg
|
||||
LIBC_NT_ADVAPI32_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_ADVAPI32_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_ADVAPI32_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_ADVAPI32_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -77,7 +77,7 @@ LIBC_NT_COMDLG32_A = o/$(MODE)/libc/nt/comdlg32.a
|
|||
LIBC_NT_COMDLG32_A_SRCS := $(wildcard libc/nt/comdlg32/*.s)
|
||||
LIBC_NT_COMDLG32_A_OBJS = $(LIBC_NT_COMDLG32_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_COMDLG32_A_CHECKS = $(LIBC_NT_COMDLG32_A).pkg
|
||||
LIBC_NT_COMDLG32_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_COMDLG32_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_COMDLG32_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_COMDLG32_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -98,7 +98,7 @@ LIBC_NT_GDI32_A = o/$(MODE)/libc/nt/gdi32.a
|
|||
LIBC_NT_GDI32_A_SRCS := $(wildcard libc/nt/gdi32/*.s)
|
||||
LIBC_NT_GDI32_A_OBJS = $(LIBC_NT_GDI32_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_GDI32_A_CHECKS = $(LIBC_NT_GDI32_A).pkg
|
||||
LIBC_NT_GDI32_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_GDI32_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_GDI32_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_GDI32_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -119,7 +119,7 @@ LIBC_NT_KERNELBASE_A = o/$(MODE)/libc/nt/KernelBase.a
|
|||
LIBC_NT_KERNELBASE_A_SRCS := $(wildcard libc/nt/KernelBase/*.s)
|
||||
LIBC_NT_KERNELBASE_A_OBJS = $(LIBC_NT_KERNELBASE_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_KERNELBASE_A_CHECKS = $(LIBC_NT_KERNELBASE_A).pkg
|
||||
LIBC_NT_KERNELBASE_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_KERNELBASE_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_KERNELBASE_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_KERNELBASE_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -142,10 +142,9 @@ LIBC_NT_NTDLL_A_SRCS_S = libc/nt/ntdllimport.S
|
|||
LIBC_NT_NTDLL_A_SRCS = $(LIBC_NT_NTDLL_A_SRCS_A) $(LIBC_NT_NTDLL_A_SRCS_S)
|
||||
LIBC_NT_NTDLL_A_OBJS = \
|
||||
$(LIBC_NT_NTDLL_A_SRCS_A:%.s=o/$(MODE)/%.o) \
|
||||
$(LIBC_NT_NTDLL_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
||||
$(LIBC_NT_NTDLL_A_SRCS:%=o/$(MODE)/%.zip.o)
|
||||
$(LIBC_NT_NTDLL_A_SRCS_S:%.S=o/$(MODE)/%.o)
|
||||
LIBC_NT_NTDLL_A_CHECKS = $(LIBC_NT_NTDLL_A).pkg
|
||||
LIBC_NT_NTDLL_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E LIBC_NT_KERNELBASE
|
||||
LIBC_NT_NTDLL_A_DIRECTDEPS = LIBC_STUBS LIBC_NT_KERNELBASE
|
||||
LIBC_NT_NTDLL_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_NTDLL_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -176,7 +175,7 @@ LIBC_NT_NETAPI32_A = o/$(MODE)/libc/nt/netapi32.a
|
|||
LIBC_NT_NETAPI32_A_SRCS := $(wildcard libc/nt/netapi32/*.s)
|
||||
LIBC_NT_NETAPI32_A_OBJS = $(LIBC_NT_NETAPI32_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_NETAPI32_A_CHECKS = $(LIBC_NT_NETAPI32_A).pkg
|
||||
LIBC_NT_NETAPI32_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_NETAPI32_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_NETAPI32_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_NETAPI32_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -197,7 +196,7 @@ LIBC_NT_URL_A = o/$(MODE)/libc/nt/url.a
|
|||
LIBC_NT_URL_A_SRCS := $(wildcard libc/nt/url/*.s)
|
||||
LIBC_NT_URL_A_OBJS = $(LIBC_NT_URL_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_URL_A_CHECKS = $(LIBC_NT_URL_A).pkg
|
||||
LIBC_NT_URL_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_URL_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_URL_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_URL_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -218,7 +217,7 @@ LIBC_NT_USER32_A = o/$(MODE)/libc/nt/user32.a
|
|||
LIBC_NT_USER32_A_SRCS := $(wildcard libc/nt/user32/*.s)
|
||||
LIBC_NT_USER32_A_OBJS = $(LIBC_NT_USER32_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_USER32_A_CHECKS = $(LIBC_NT_USER32_A).pkg
|
||||
LIBC_NT_USER32_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_USER32_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_USER32_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_USER32_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -239,7 +238,7 @@ LIBC_NT_WS2_32_A = o/$(MODE)/libc/nt/ws2_32.a
|
|||
LIBC_NT_WS2_32_A_SRCS := $(wildcard libc/nt/ws2_32/*.s)
|
||||
LIBC_NT_WS2_32_A_OBJS = $(LIBC_NT_WS2_32_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_WS2_32_A_CHECKS = $(LIBC_NT_WS2_32_A).pkg
|
||||
LIBC_NT_WS2_32_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_WS2_32_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_WS2_32_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_WS2_32_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -260,7 +259,7 @@ LIBC_NT_MSWSOCK_A = o/$(MODE)/libc/nt/MsWSock.a
|
|||
LIBC_NT_MSWSOCK_A_SRCS := $(wildcard libc/nt/MsWSock/*.s)
|
||||
LIBC_NT_MSWSOCK_A_OBJS = $(LIBC_NT_MSWSOCK_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_MSWSOCK_A_CHECKS = $(LIBC_NT_MSWSOCK_A).pkg
|
||||
LIBC_NT_MSWSOCK_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_MSWSOCK_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_MSWSOCK_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_MSWSOCK_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
|
@ -281,7 +280,7 @@ LIBC_NT_SHELL32_A = o/$(MODE)/libc/nt/shell32.a
|
|||
LIBC_NT_SHELL32_A_SRCS := $(wildcard libc/nt/shell32/*.s)
|
||||
LIBC_NT_SHELL32_A_OBJS = $(LIBC_NT_SHELL32_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_SHELL32_A_CHECKS = $(LIBC_NT_SHELL32_A).pkg
|
||||
LIBC_NT_SHELL32_A_DIRECTDEPS = LIBC_STUBS LIBC_NEXGEN32E
|
||||
LIBC_NT_SHELL32_A_DIRECTDEPS = LIBC_STUBS
|
||||
LIBC_NT_SHELL32_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_SHELL32_A_DIRECTDEPS),$($(x))))
|
||||
$(LIBC_NT_SHELL32_A): \
|
||||
|
@ -294,11 +293,7 @@ $(LIBC_NT_SHELL32_A).pkg: \
|
|||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
$(LIBC_NT_OBJS): libc/nt/nt.mk o/libc/nt/codegen.inc
|
||||
|
||||
.PHONY: o/libc/nt
|
||||
o/libc/nt: $(LIBC_NT_LIBS) \
|
||||
$(LIBC_NT_CHECKS)
|
||||
$(LIBC_NT_OBJS): o/libc/nt/codegen.inc
|
||||
|
||||
.PHONY: o/$(MODE)/libc/nt
|
||||
o/$(MODE)/libc/nt: \
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_NT_SYSTEMTHREADS_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_SYSTEMTHREADS_H_
|
||||
#include "libc/nt/enum/kwaitreason.h"
|
||||
#include "libc/nt/enum/threadstate.h"
|
||||
#include "libc/nt/struct/clientid.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
struct NtSystemThreads {
|
||||
int64_t KernelTime;
|
||||
int64_t UserTime;
|
||||
int64_t CreateTime;
|
||||
uint32_t WaitTime;
|
||||
void *StartAddress;
|
||||
struct NtClientId ClientId;
|
||||
int32_t Priority;
|
||||
int32_t BasePriority;
|
||||
uint32_t ContextSwitchCount;
|
||||
enum NtThreadState State;
|
||||
uint32_t WaitReason;
|
||||
};
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_SYSTEMTHREADS_H_ */
|
|
@ -19,7 +19,6 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/nt/enum/status.h"
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
/ @fileoverview NTDLL.DLL Non-Mandatory Importer
|
||||
/
|
||||
|
|
|
@ -76,7 +76,7 @@ bool32 SetProcessPriorityBoost(int64_t hProcess, bool32 bDisablePriorityBoost);
|
|||
bool32 GetProcessPriorityBoost(int64_t hProcess, bool32 *pDisablePriorityBoost);
|
||||
|
||||
#if ShouldUseMsabiAttribute()
|
||||
#include "libc/nt/thunk/msabi.h"
|
||||
#include "libc/nt/thunk/process.inc"
|
||||
#endif /* ShouldUseMsabiAttribute() */
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
|
@ -30,41 +30,38 @@
|
|||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
#endif
|
||||
|
||||
#define kNtSignalBreakpoint 0x80000003u
|
||||
#define kNtSignalIllegalInstruction 0xC000001Du
|
||||
#define kNtSignalPrivInstruction 0xC0000096u
|
||||
#define kNtSignalGuardPage 0x80000001u
|
||||
#define kNtSignalAccessViolation 0xC0000005u
|
||||
#define kNtSignalInPageError 0xC0000006u
|
||||
#define kNtSignalInvalidHandle 0xC0000008u
|
||||
#define kNtSignalInvalidParameter 0xC000000du
|
||||
#define kNtSignalFltDenormalOperand 0xC000008Du
|
||||
#define kNtSignalFltDivideByZero 0xC000008Eu
|
||||
#define kNtSignalFltInexactResult 0xC000008Fu
|
||||
#define kNtSignalBreakpoint 0x80000003u
|
||||
#define kNtSignalIllegalInstruction 0xC000001Du
|
||||
#define kNtSignalPrivInstruction 0xC0000096u
|
||||
#define kNtSignalGuardPage 0x80000001u
|
||||
#define kNtSignalAccessViolation 0xC0000005u
|
||||
#define kNtSignalInPageError 0xC0000006u
|
||||
#define kNtSignalInvalidHandle 0xC0000008u
|
||||
#define kNtSignalInvalidParameter 0xC000000du
|
||||
#define kNtSignalFltDenormalOperand 0xC000008Du
|
||||
#define kNtSignalFltDivideByZero 0xC000008Eu
|
||||
#define kNtSignalFltInexactResult 0xC000008Fu
|
||||
#define kNtSignalFltInvalidOperation 0xC0000090u
|
||||
#define kNtSignalFltOverflow 0xC0000091u
|
||||
#define kNtSignalFltStackCheck 0xC0000092u
|
||||
#define kNtSignalFltUnderflow 0xC0000093u
|
||||
#define kNtSignalFltOverflow 0xC0000091u
|
||||
#define kNtSignalFltStackCheck 0xC0000092u
|
||||
#define kNtSignalFltUnderflow 0xC0000093u
|
||||
#define kNtSignalIntegerDivideByZero 0xC0000094u
|
||||
#define kNtSignalDllNotFound 0xC0000135u
|
||||
#define kNtSignalOrdinalNotFound 0xC0000138u
|
||||
#define kNtSignalEntrypointNotFound 0xC0000139u
|
||||
#define kNtSignalControlCExit 0xC000013Au
|
||||
#define kNtSignalDllInitFailed 0xC0000142u
|
||||
#define kNtSignalDllNotFound 0xC0000135u
|
||||
#define kNtSignalOrdinalNotFound 0xC0000138u
|
||||
#define kNtSignalEntrypointNotFound 0xC0000139u
|
||||
#define kNtSignalControlCExit 0xC000013Au
|
||||
#define kNtSignalDllInitFailed 0xC0000142u
|
||||
#define kNtSignalFloatMultipleFaults 0xC00002B4u
|
||||
#define kNtSignalFloatMultipleTraps 0xC00002B5u
|
||||
#define kNtSignalAssertionFailure 0xC0000420u
|
||||
#define kNtSignalFloatMultipleTraps 0xC00002B5u
|
||||
#define kNtSignalAssertionFailure 0xC0000420u
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct NtExceptionPointers;
|
||||
|
||||
typedef enum NtExceptionHandlerActions (*NtTopLevelExceptionFilter)(
|
||||
const struct NtExceptionPointers *ExceptionInfo);
|
||||
|
||||
typedef int32_t (*NtVectoredExceptionHandler)(
|
||||
struct NtExceptionPointers *ExceptionInfo);
|
||||
typedef int (*NtTopLevelExceptionFilter)(const struct NtExceptionPointers *);
|
||||
typedef int32_t (*NtVectoredExceptionHandler)(struct NtExceptionPointers *);
|
||||
|
||||
enum NtErrorModeFlags SetErrorMode(enum NtErrorModeFlags uMode);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_TEB_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_TEB_H_
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/bits/segmentation.h"
|
||||
#include "libc/nt/struct/peb.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
|
@ -14,14 +14,14 @@
|
|||
#define NtGetErr() gs((int *)(0x68))
|
||||
#define NtGetVersion() \
|
||||
((NtGetPeb()->OSMajorVersion & 0xff) << 8 | NtGetPeb()->OSMinorVersion)
|
||||
#define _NtGetSeh() gs((void **)(0x00))
|
||||
#define _NtGetStackHigh() gs((void **)(0x08))
|
||||
#define _NtGetStackLow() gs((void **)(0x10))
|
||||
#define _NtGetSeh() gs((void **)(0x00))
|
||||
#define _NtGetStackHigh() gs((void **)(0x08))
|
||||
#define _NtGetStackLow() gs((void **)(0x10))
|
||||
#define _NtGetSubsystemTib() gs((void **)(0x18))
|
||||
#define _NtGetFib() gs((void **)(0x20))
|
||||
#define _NtGetEnv() gs((char16_t **)(0x38))
|
||||
#define _NtGetRpc() gs((void **)(0x50))
|
||||
#define _NtGetTls() gs((void **)(0x58))
|
||||
#define _NtGetFib() gs((void **)(0x20))
|
||||
#define _NtGetEnv() gs((char16_t **)(0x38))
|
||||
#define _NtGetRpc() gs((void **)(0x50))
|
||||
#define _NtGetTls() gs((void **)(0x58))
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_TEB_H_ */
|
||||
|
|
11
libc/nt/thunk/accounting.inc
Normal file
11
libc/nt/thunk/accounting.inc
Normal file
|
@ -0,0 +1,11 @@
|
|||
#define GetProcessTimes(...) __imp_GetProcessTimes(__VA_ARGS__)
|
||||
extern typeof(GetProcessTimes) *const __imp_GetProcessTimes __msabi;
|
||||
|
||||
#define GetThreadTimes(...) __imp_GetThreadTimes(__VA_ARGS__)
|
||||
extern typeof(GetThreadTimes) *const __imp_GetThreadTimes __msabi;
|
||||
|
||||
#define GetUserName(...) __imp_GetUserNameW(__VA_ARGS__)
|
||||
extern typeof(GetUserName) *const __imp_GetUserNameW __msabi;
|
||||
|
||||
#define GetExitCodeProcess(...) __imp_GetExitCodeProcess(__VA_ARGS__)
|
||||
extern typeof(GetExitCodeProcess) *const __imp_GetExitCodeProcess __msabi;
|
|
@ -1,3 +1,5 @@
|
|||
#define CopyFile(...) __imp_CopyFileW(__VA_ARGS__)
|
||||
#define FlushFileBuffers(...) __imp_FlushFileBuffers(__VA_ARGS__)
|
||||
|
||||
extern typeof(CopyFile) *const __imp_CopyFileW __msabi;
|
||||
extern typeof(FlushFileBuffers) *const __imp_FlushFileBuffers __msabi;
|
||||
|
|
10
libc/nt/thunk/memory.inc
Normal file
10
libc/nt/thunk/memory.inc
Normal file
|
@ -0,0 +1,10 @@
|
|||
#define CreateFileMappingNuma(...) __imp_CreateFileMappingNumaW(__VA_ARGS__)
|
||||
#define MapViewOfFileExNuma(...) __imp_MapViewOfFileExNuma(__VA_ARGS__)
|
||||
#define FlushViewOfFile(...) __imp_FlushViewOfFile(__VA_ARGS__)
|
||||
#define UnmapViewOfFile(...) __imp_UnmapViewOfFile(__VA_ARGS__)
|
||||
|
||||
extern typeof(UnmapViewOfFile) *const __imp_UnmapViewOfFile __msabi;
|
||||
extern typeof(FlushViewOfFile) *const __imp_FlushViewOfFile __msabi;
|
||||
extern typeof(MapViewOfFileExNuma) *const __imp_MapViewOfFileExNuma __msabi;
|
||||
extern typeof(CreateFileMappingNuma) *const
|
||||
__imp_CreateFileMappingNumaW __msabi;
|
|
@ -1,8 +1,19 @@
|
|||
#define GetEnvironmentVariable(...) __imp_GetEnvironmentVariableW(__VA_ARGS__)
|
||||
#define GetPriorityClass(...) __imp_GetPriorityClass(__VA_ARGS__)
|
||||
#define SetPriorityClass(...) __imp_SetPriorityClass(__VA_ARGS__)
|
||||
|
||||
extern typeof(GetEnvironmentVariable) *const
|
||||
__imp_GetEnvironmentVariableW __msabi;
|
||||
|
||||
#define SetEnvironmentVariable(...) __imp_SetEnvironmentVariableW(__VA_ARGS__)
|
||||
extern typeof(SetEnvironmentVariable) *const
|
||||
__imp_SetEnvironmentVariableW __msabi;
|
||||
|
||||
#define GetPriorityClass(...) __imp_GetPriorityClass(__VA_ARGS__)
|
||||
extern typeof(GetPriorityClass) *const __imp_GetPriorityClass __msabi;
|
||||
|
||||
#define SetPriorityClass(...) __imp_SetPriorityClass(__VA_ARGS__)
|
||||
extern typeof(SetPriorityClass) *const __imp_SetPriorityClass __msabi;
|
||||
|
||||
#define GetCurrentProcessId(...) __imp_GetCurrentProcessId(__VA_ARGS__)
|
||||
extern typeof(GetCurrentProcessId) *const __imp_GetCurrentProcessId __msabi;
|
||||
|
||||
#define CreateProcess(...) __imp_CreateProcessW(__VA_ARGS__)
|
||||
extern typeof(CreateProcess) *const __imp_CreateProcessW __msabi;
|
||||
|
|
|
@ -1,23 +1,33 @@
|
|||
#define ExitProcess(...) __imp_ExitProcess(__VA_ARGS__)
|
||||
#define FreeEnvironmentStrings(...) __imp_FreeEnvironmentStringsW(__VA_ARGS__)
|
||||
#define GetCommandLine(...) __imp_GetCommandLineW(__VA_ARGS__)
|
||||
#define GetEnvironmentStrings(...) __imp_GetEnvironmentStringsW(__VA_ARGS__)
|
||||
#define GetStdHandle(...) __imp_GetStdHandle(__VA_ARGS__)
|
||||
#define SetStdHandle(...) __imp_SetStdHandle(__VA_ARGS__)
|
||||
#define ReadFile(...) __imp_ReadFile(__VA_ARGS__)
|
||||
#define WriteFile(...) __imp_WriteFile(__VA_ARGS__)
|
||||
#define SetDefaultDllDirectories(...) \
|
||||
__imp_SetDefaultDllDirectories(__VA_ARGS__)
|
||||
|
||||
#define ExitProcess(...) __imp_ExitProcess(__VA_ARGS__)
|
||||
extern typeof(ExitProcess) *const __imp_ExitProcess __msabi;
|
||||
|
||||
#define FreeEnvironmentStrings(...) __imp_FreeEnvironmentStringsW(__VA_ARGS__)
|
||||
extern typeof(FreeEnvironmentStrings) *const
|
||||
__imp_FreeEnvironmentStringsW __msabi;
|
||||
|
||||
#define GetCommandLine(...) __imp_GetCommandLineW(__VA_ARGS__)
|
||||
extern typeof(GetCommandLine) *const __imp_GetCommandLineW __msabi;
|
||||
|
||||
#define GetEnvironmentStrings(...) __imp_GetEnvironmentStringsW(__VA_ARGS__)
|
||||
extern typeof(GetEnvironmentStrings) *const
|
||||
__imp_GetEnvironmentStringsW __msabi;
|
||||
|
||||
#define GetStdHandle(...) __imp_GetStdHandle(__VA_ARGS__)
|
||||
extern typeof(GetStdHandle) *const __imp_GetStdHandle __msabi;
|
||||
|
||||
#define SetStdHandle(...) __imp_SetStdHandle(__VA_ARGS__)
|
||||
extern typeof(SetStdHandle) *const __imp_SetStdHandle __msabi;
|
||||
|
||||
#define ReadFile(...) __imp_ReadFile(__VA_ARGS__)
|
||||
extern typeof(ReadFile) *const __imp_ReadFile __msabi;
|
||||
|
||||
#define WriteFile(...) __imp_WriteFile(__VA_ARGS__)
|
||||
extern typeof(WriteFile) *const __imp_WriteFile __msabi;
|
||||
|
||||
#define SetDefaultDllDirectories(...) \
|
||||
__imp_SetDefaultDllDirectories(__VA_ARGS__)
|
||||
extern typeof(SetDefaultDllDirectories) *const
|
||||
__imp_SetDefaultDllDirectories __msabi;
|
||||
|
||||
#define GetCurrentProcess(...) __imp_GetCurrentProcess(__VA_ARGS__)
|
||||
extern typeof(GetCurrentProcess) *const __imp_GetCurrentProcess __msabi;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue