mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 18:28:30 +00:00
Make improvements
- Introduce portable sched_getcpu() api - Support GCC's __target_clones__ feature - Make fma() go faster on x86 in default mode - Remove some asan checks from core libraries - WinMain() now ensures $HOME and $USER are defined
This commit is contained in:
parent
d5225a693b
commit
2ab9e9f7fd
192 changed files with 2809 additions and 932 deletions
|
@ -1,6 +1,5 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_TEB_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_TEB_H_
|
||||
#include "libc/intrin/segmentation.h"
|
||||
#include "libc/nt/struct/peb.h"
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
|
||||
|
@ -8,19 +7,19 @@
|
|||
* These macros address directly into NT's TEB a.k.a. TIB
|
||||
* Any function that does this needs the `dontasan` keyword
|
||||
*/
|
||||
#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 _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)) /* cf. gs((long *)0x1480 + i0..64) */
|
||||
#define NtGetPeb() ((__seg_gs struct NtPeb *)0x60)
|
||||
#define NtGetTeb() ((void *)*(__seg_gs uintptr_t *)0x30)
|
||||
#define NtGetPid() (*(__seg_gs uint32_t *)0x40)
|
||||
#define NtGetTid() (*(__seg_gs uint32_t *)0x48)
|
||||
#define NtGetErr() (*(__seg_gs int *)0x68)
|
||||
#define _NtGetSeh() ((void *)*(__seg_gs uintptr_t *)0x00)
|
||||
#define _NtGetStackHigh() ((void *)*(__seg_gs uintptr_t *)0x08)
|
||||
#define _NtGetStackLow() ((void *)*(__seg_gs uintptr_t *)0x10)
|
||||
#define _NtGetSubsystemTib() ((void *)*(__seg_gs uintptr_t *)0x18)
|
||||
#define _NtGetFib() ((void *)*(__seg_gs uintptr_t *)0x20)
|
||||
#define _NtGetEnv() ((char16_t *)*(__seg_gs intptr_t *)0x38)
|
||||
#define _NtGetRpc() ((void *)*(__seg_gs uintptr_t *)0x50)
|
||||
#define _NtGetTls() ((void *)*(__seg_gs uintptr_t *)0x58)
|
||||
|
||||
#endif /* __GNUC__ && !__STRICT_ANSI__ */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_TEB_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue