mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Change support vector to Windows 8+
Doing this makes binaries tinier, since we don't need to have all the
extra code for supporting a 32-bit address space. It also benefits us
because we're able to use WIN32 futexes, which makes locking simpler.
b69f3d2488
is what officially ended our
Windows 7 support. This change is merely a formalization. You can use
old versions of Cosmo now and forevermore if you need Windows 7 since
our repository is hermetic and vendors all its dependencies.
Won't fix #617
This commit is contained in:
parent
6c90f830d9
commit
134ffee519
25 changed files with 296 additions and 167 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/nt/accounting.h"
|
||||
#include "libc/nt/dll.h"
|
||||
#include "libc/nt/struct/systeminfo.h"
|
||||
#include "libc/nt/systeminfo.h"
|
||||
|
@ -61,18 +62,6 @@ static unsigned GetCpuCountBsd(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static textwindows unsigned GetCpuCountWindows(void) {
|
||||
struct NtSystemInfo si;
|
||||
uint32_t (*f)(uint16_t);
|
||||
if ((f = GetProcAddress(GetModuleHandle("KERNEL32"),
|
||||
"GetMaximumProcessorCount"))) {
|
||||
return f(ALL_PROCESSOR_GROUPS);
|
||||
} else {
|
||||
GetSystemInfo(&si);
|
||||
return si.dwNumberOfProcessors;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned GetCpuCountImpl(void) {
|
||||
if (!IsWindows()) {
|
||||
if (!IsBsd()) {
|
||||
|
@ -81,7 +70,7 @@ static unsigned GetCpuCountImpl(void) {
|
|||
return GetCpuCountBsd();
|
||||
}
|
||||
} else {
|
||||
return GetCpuCountWindows();
|
||||
return GetMaximumProcessorCount(ALL_PROCESSOR_GROUPS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
0
libc/intrin/intrin.h
Executable file
0
libc/intrin/intrin.h
Executable file
12
libc/nt/API-MS-Win-Core-Synch-l1-2-0/WaitOnAddress.s
Normal file
12
libc/nt/API-MS-Win-Core-Synch-l1-2-0/WaitOnAddress.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WaitOnAddress,WaitOnAddress,111
|
||||
|
||||
.text.windows
|
||||
WaitOnAddress:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_WaitOnAddress(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn WaitOnAddress,globl
|
||||
.previous
|
15
libc/nt/API-MS-Win-Core-Synch-l1-2-0/WakeByAddressAll.s
Normal file
15
libc/nt/API-MS-Win-Core-Synch-l1-2-0/WakeByAddressAll.s
Normal file
|
@ -0,0 +1,15 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WakeByAddressAll,WakeByAddressAll,113
|
||||
|
||||
.text.windows
|
||||
WakeByAddressAll:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_WakeByAddressAll(%rip)
|
||||
leave
|
||||
ret
|
||||
.endfn WakeByAddressAll,globl
|
||||
.previous
|
15
libc/nt/API-MS-Win-Core-Synch-l1-2-0/WakeByAddressSingle.s
Normal file
15
libc/nt/API-MS-Win-Core-Synch-l1-2-0/WakeByAddressSingle.s
Normal file
|
@ -0,0 +1,15 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WakeByAddressSingle,WakeByAddressSingle,116
|
||||
|
||||
.text.windows
|
||||
WakeByAddressSingle:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_WakeByAddressSingle(%rip)
|
||||
leave
|
||||
ret
|
||||
.endfn WakeByAddressSingle,globl
|
||||
.previous
|
|
@ -992,7 +992,7 @@
|
|||
#define kNtErrorInvalidKeyboardHandle 1457
|
||||
#define kNtErrorHookTypeNotAllowed 1458
|
||||
#define kNtErrorRequiresInteractiveWindowstation 1459
|
||||
#define kNtErrorTimeout 1460
|
||||
#define kNtErrorTimeout 1460 /* ETIMEDOUT */
|
||||
#define kNtErrorInvalidMonitorHandle 1461
|
||||
#define kNtErrorIncorrectSize 1462
|
||||
#define kNtErrorSymlinkClassDisabled 1463
|
||||
|
|
|
@ -3554,6 +3554,13 @@ imp 'InetIsOffline' InetIsOffline url 106
|
|||
imp 'MIMEAssociationDialog' MIMEAssociationDialogW url 108
|
||||
imp 'MailToProtocolHandler' MailToProtocolHandler url 109
|
||||
|
||||
# API-MS-Win-Core-Synch-l1-2-0.dll (Windows 8+)
|
||||
#
|
||||
# Name Actual DLL Hint Arity
|
||||
imp 'WaitOnAddress' WaitOnAddress API-MS-Win-Core-Synch-l1-2-0 111 4
|
||||
imp 'WakeByAddressAll' WakeByAddressAll API-MS-Win-Core-Synch-l1-2-0 113 1
|
||||
imp 'WakeByAddressSingle' WakeByAddressSingle API-MS-Win-Core-Synch-l1-2-0 116 1
|
||||
|
||||
# NTDLL.DLL
|
||||
# BEYOND THE PALE
|
||||
#
|
||||
|
|
|
@ -167,6 +167,27 @@ $(LIBC_NT_URL_A).pkg: \
|
|||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
LIBC_NT_ARTIFACTS += LIBC_NT_SYNCHRONIZATION_A
|
||||
LIBC_NT_SYNCHRONIZATION = $(LIBC_NT_SYNCHRONIZATION_A_DEPS) $(LIBC_NT_SYNCHRONIZATION_A)
|
||||
LIBC_NT_SYNCHRONIZATION_A = o/$(MODE)/libc/nt/synchronization.a
|
||||
LIBC_NT_SYNCHRONIZATION_A_SRCS := $(wildcard libc/nt/API-MS-Win-Core-Synch-l1-2-0/*.s)
|
||||
LIBC_NT_SYNCHRONIZATION_A_OBJS = $(LIBC_NT_SYNCHRONIZATION_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_SYNCHRONIZATION_A_CHECKS = $(LIBC_NT_SYNCHRONIZATION_A).pkg
|
||||
LIBC_NT_SYNCHRONIZATION_A_DIRECTDEPS = LIBC_NT_KERNEL32
|
||||
LIBC_NT_SYNCHRONIZATION_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_SYNCHRONIZATION_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
$(LIBC_NT_SYNCHRONIZATION_A): \
|
||||
libc/nt/API-MS-Win-Core-Synch-l1-2-0/ \
|
||||
$(LIBC_NT_SYNCHRONIZATION_A).pkg \
|
||||
$(LIBC_NT_SYNCHRONIZATION_A_OBJS)
|
||||
|
||||
$(LIBC_NT_SYNCHRONIZATION_A).pkg: \
|
||||
$(LIBC_NT_SYNCHRONIZATION_A_OBJS) \
|
||||
$(foreach x,$(LIBC_NT_SYNCHRONIZATION_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
LIBC_NT_ARTIFACTS += LIBC_NT_USER32_A
|
||||
LIBC_NT_USER32 = $(LIBC_NT_USER32_A_DEPS) $(LIBC_NT_USER32_A)
|
||||
LIBC_NT_USER32_A = o/$(MODE)/libc/nt/user32.a
|
||||
|
|
|
@ -54,6 +54,11 @@ typedef void (*NtTimerapcroutine)(void *lpArgToCompletionRoutine,
|
|||
typedef void (*NtWaitOrTimerCallback)(void *lpParameter,
|
||||
bool32 TimerOrWaitFired);
|
||||
|
||||
void WakeByAddressAll(void *Address);
|
||||
void WakeByAddressSingle(void *Address);
|
||||
bool32 WaitOnAddress(volatile void *Address, void *CompareAddress,
|
||||
size_t AddressSize, uint32_t opt_dwMilliseconds);
|
||||
|
||||
void Sleep(uint32_t dwMilliseconds);
|
||||
uint32_t SleepEx(uint32_t dwMilliseconds, bool32 bAlertable);
|
||||
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
# -*- conf -*-
|
||||
# Cosmopolitan Libc Legacy Memory Plan
|
||||
|
||||
00000000-0000001f 2048kb guard
|
||||
00000020-0000003f 2048kb loader
|
||||
00000040-000000ff 12mb image
|
||||
00000100-000003ff 48mb free
|
||||
00000400-000007ff 64mb free
|
||||
00000800-00000bff 64mb free
|
||||
00000c00-00000fff 64mb free
|
||||
00001000-000013ff 64mb automap
|
||||
00001400-000017ff 64mb automap
|
||||
00001800-00001bff 64mb automap
|
||||
00001c00-00001fff 64mb automap
|
||||
00002000-000023ff 64mb automap
|
||||
00002400-000027ff 64mb automap
|
||||
00002800-00002bff 64mb automap
|
||||
00002c00-00002fff 64mb automap
|
||||
00003000-000033ff 64mb automap
|
||||
00003400-000037ff 64mb automap
|
||||
00003800-00003bff 64mb automap
|
||||
00003c00-00003fe7 63mb automap
|
||||
00003fe4-00003ffb 1536kb memtrack
|
||||
00003ffc-00003fff 256kb free
|
||||
00004000-000043ff 64mb fixedmap
|
||||
00004400-000047ff 64mb fixedmap
|
||||
00004800-00004bff 64mb fixedmap
|
||||
00004c00-00004fff 64mb fixedmap
|
||||
00005000-000053ff 64mb fixedmap
|
||||
00005400-000057ff 64mb fixedmap
|
||||
00005800-00005bff 64mb fixedmap
|
||||
00005c00-00005fff 64mb fixedmap
|
||||
00006000-000063ff 64mb fixedmap
|
||||
00006400-000067ff 64mb fixedmap
|
||||
00006800-00006bff 64mb fixedmap
|
||||
00006c00-00006fff 64mb fixedmap
|
||||
00005000-000053ff 64mb arena
|
||||
00005400-000057ff 64mb arena
|
||||
00005800-00005bff 64mb arena
|
||||
00005c00-00005fff 64mb arena
|
||||
00006000-000063ff 64mb arena
|
||||
00006400-000067ff 64mb arena
|
||||
00006800-00006bff 64mb fds
|
||||
00006c00-00006fff 64mb zipos
|
||||
00007000-000073ff 64mb zipos
|
||||
00007400-000077ff 64mb zipos
|
||||
00007800-00007bff 64mb zipos
|
||||
00007c00-00007ffd 64mb arena
|
||||
00007ffe-00007fff 128kb free
|
||||
00008000-000083ff 64mb free
|
||||
00008400-000087ff 64mb free
|
||||
00008800-00008bff 64mb free
|
||||
00008c00-00008fff 64mb free
|
||||
00009000-000093ff 64mb free
|
||||
00009400-000097ff 64mb free
|
||||
00009800-00009bff 64mb free
|
||||
00009c00-00009fff 64mb free
|
||||
0000a000-0000a3ff 64mb free
|
||||
0000a400-0000a7ff 64mb free
|
||||
0000a800-0000abff 64mb free
|
||||
0000ac00-0000afff 64mb free
|
||||
0000b000-0000b3ff 64mb free
|
||||
0000b400-0000b7ff 64mb free
|
||||
0000b800-0000bbff 64mb free
|
||||
0000bc00-0000bfff 64mb free
|
||||
0000c000-0000c3ff 64mb free
|
||||
0000c400-0000c7ff 64mb free
|
||||
0000c800-0000cbff 64mb free
|
||||
0000cc00-0000cfff 64mb free
|
||||
0000d000-0000d3ff 64mb free
|
||||
0000d400-0000d7ff 64mb free
|
||||
0000d800-0000dbff 64mb free
|
||||
0000dc00-0000dfff 64mb free
|
||||
0000e000-0000e3ff 64mb free
|
||||
0000e400-0000e7ff 64mb free
|
||||
0000e800-0000ebff 64mb free
|
||||
0000ec00-0000efff 64mb free
|
||||
0000f000-0000f3ff 64mb free
|
||||
0000f400-0000f7ff 64mb free
|
||||
0000f800-0000fbff 64mb free
|
||||
0000fc00-0000fffb 64mb free
|
||||
0000fffc-0000fffd 128kb winargs
|
||||
0000fffe-0000ffff 128kb stack
|
|
@ -94,7 +94,7 @@ syscon errno EISCONN 106 56 56 56 56 10056 # socket is connected
|
|||
syscon errno ENOTCONN 107 57 57 57 57 10057 # socket is not connected; bsd consensus; WSAENOTCONN; raised by getpeername(2), recv(2), send(2), shutdown(2), ip(7)
|
||||
syscon errno ESHUTDOWN 108 58 58 58 58 10058 # cannot send after transport endpoint shutdown; note that shutdown write is an EPIPE; bsd consensus; WSAESHUTDOWN
|
||||
syscon errno ETOOMANYREFS 109 59 59 59 59 10059 # too many references: cannot splice; bsd consensus; WSAETOOMANYREFS; raised by sendmsg(2), unix(7)
|
||||
syscon errno ETIMEDOUT 110 60 60 60 60 10060 # connection timed out; bsd consensus; WSAETIMEDOUT; raised by connect(2), futex(2), keyctl(2), tcp(7)
|
||||
syscon errno ETIMEDOUT 110 60 60 60 60 1460 # connection timed out; kNtErrorTimeout; bsd consensus; WSAETIMEDOUT; raised by connect(2), futex(2), keyctl(2), tcp(7)
|
||||
syscon errno ECONNREFUSED 111 61 61 61 61 10061 # bsd consensus; WSAECONNREFUSED; raised by connect(2), listen(2), recv(2), unix(7), udp(7)system-imposed limit on the number of threads was encountered.
|
||||
syscon errno EHOSTDOWN 112 64 64 64 64 10064 # bsd consensus; WSAEHOSTDOWN; raised by accept(2)
|
||||
syscon errno EHOSTUNREACH 113 65 65 65 65 10065 # bsd consensus; WSAEHOSTUNREACH; raised by accept(2), ip(7)
|
||||
|
@ -1316,7 +1316,7 @@ syscon rusage RUSAGE_BOTH -2 99 99 99 99 99 # woop
|
|||
#
|
||||
# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary
|
||||
syscon futex FUTEX_WAIT 0 0 0 1 0 0
|
||||
syscon futex FUTEX_WAKE 1 0 0 2 0 0
|
||||
syscon futex FUTEX_WAKE 1 0 0 2 0 1
|
||||
syscon futex FUTEX_REQUEUE 3 0 0 3 0 0
|
||||
syscon futex FUTEX_PRIVATE_FLAG 128 0 0 128 0 0
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
.include "o/libc/sysv/consts/syscon.internal.inc"
|
||||
.syscon errno,ETIMEDOUT,110,60,60,60,60,10060
|
||||
.syscon errno,ETIMEDOUT,110,60,60,60,60,1460
|
||||
.yoink kDos2Errno.ETIMEDOUT
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
.include "o/libc/sysv/consts/syscon.internal.inc"
|
||||
.syscon futex,FUTEX_WAKE,1,0,0,2,0,0
|
||||
.syscon futex,FUTEX_WAKE,1,0,0,2,0,1
|
||||
|
|
|
@ -84,7 +84,7 @@ dir=libc/sysv/dos2errno
|
|||
# dos WSAENOTCONN ENOTCONN # in consts.sh
|
||||
# dos WSAESHUTDOWN ESHUTDOWN # in consts.sh
|
||||
# dos WSAETOOMANYREFS ETOOMANYREFS # in consts.sh
|
||||
# dos WSAETIMEDOUT ETIMEDOUT # in consts.sh
|
||||
# dos kNtErrorTimeout ETIMEDOUT # in consts.sh
|
||||
# dos WSAECONNREFUSED ECONNREFUSED # in consts.sh
|
||||
# dos WSAEHOSTDOWN EHOSTDOWN # in consts.sh
|
||||
# dos WSAEHOSTUNREACH EHOSTUNREACH # in consts.sh
|
||||
|
@ -170,3 +170,4 @@ dos WSAEPROCLIM ENOMEM
|
|||
dos WSANOTINITIALISED ENETDOWN
|
||||
dos WSASYSNOTREADY ENETDOWN
|
||||
dos WSAVERNOTSUPPORTED ENOSYS
|
||||
dos WSAETIMEDOUT ETIMEDOUT
|
||||
|
|
|
@ -9,3 +9,4 @@
|
|||
.type kDos2Errno.ETIMEDOUT,@object
|
||||
kDos2Errno.ETIMEDOUT:
|
||||
.e kNtErrorSemTimeout,ETIMEDOUT
|
||||
.e WSAETIMEDOUT,ETIMEDOUT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue