mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 23:13:34 +00:00
ea0b5d9d1c
A new rollup tool now exists for flattening out the headers in a way that works better for our purposes than cpp. A lot of the API clutter has been removed. APIs that aren't a sure thing in terms of general recommendation are now marked internal. There's now a smoke test for the amalgamation archive and gigantic header file. So we can now guarantee you can use this project on the easiest difficulty setting without the gigantic repository. A website is being created, which is currently a work in progress: https://justine.storage.googleapis.com/cosmopolitan/index.html
25 lines
1.1 KiB
C
25 lines
1.1 KiB
C
#ifndef COSMOPOLITAN_LIBC_NT_TEB_H_
|
|
#define COSMOPOLITAN_LIBC_NT_TEB_H_
|
|
#include "libc/bits/segmentation.h"
|
|
#include "libc/nt/struct/peb.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
/* These macros address directly into NT's TEB a.k.a. TIB */
|
|
#define NtGetPeb() gs((struct NtPeb **)(0x60ULL))
|
|
#define NtGetTeb() gs((void **)(0x30)) /* %gs:0 linear address */
|
|
#define NtGetPid() gs((uint32_t *)(0x40)) /* GetCurrentProcessId() */
|
|
#define NtGetTid() gs((uint32_t *)(0x48)) /* GetCurrentThreadId() */
|
|
#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 _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))
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_NT_TEB_H_ */
|