diff --git a/dll/ntdll/CMakeLists.txt b/dll/ntdll/CMakeLists.txt index 9b74eac0ea3..6882571577b 100644 --- a/dll/ntdll/CMakeLists.txt +++ b/dll/ntdll/CMakeLists.txt @@ -69,7 +69,7 @@ set_subsystem(ntdll console) target_link_libraries(ntdll ntdll_vista_static etwtrace csrlib rtl rtl_um rtl_vista ntdllsys libcntpr setjmp uuid ${PSEH_LIB}) if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600) - target_link_libraries(ntdll cryptlib) + target_link_libraries(ntdll cryptlib ntdllsys_nt6) endif() if (STACK_PROTECTOR) diff --git a/dll/ntdll/def/ntdll.spec b/dll/ntdll/def/ntdll.spec index df4f085256c..46bd5a85f57 100644 --- a/dll/ntdll/def/ntdll.spec +++ b/dll/ntdll/def/ntdll.spec @@ -71,7 +71,7 @@ @ stdcall -stub -version=0x600+ EtwEventActivityIdControl(long ptr) @ stdcall -stub -version=0x600+ EtwEventEnabled(int64 ptr) @ stdcall -stub -version=0x600+ EtwEventProviderEnabled(long long long) -@ stdcall -stub -version=0x600+ EtwEventRegister(ptr ptr ptr ptr) +@ stdcall -stub -version=0x600+ EtwEventRegister(ptr ptr ptr ptr) @ stdcall -stub -version=0x600+ EtwEventSetInformation(int64 long ptr long) @ stdcall -stub -version=0x600+ EtwEventUnregister(int64) @ stdcall -stub -version=0x600+ EtwEventWrite(int64 ptr long ptr) @@ -227,7 +227,7 @@ @ stdcall -stub -version=0x600+ NtAlpcAcceptConnectPort(long long long long long long long long long) @ stdcall -stub -version=0x600+ NtAlpcCancelMessage(long long long) @ stdcall -stub -version=0x600+ NtAlpcConnectPort(long long long long long long long long long long long) -@ stdcall -stub -version=0x600+ NtAlpcCreatePort(long long long) +@ stdcall -stub -version=0x600+ NtAlpcCreatePort(long long long) @ stdcall -stub -version=0x600+ NtAlpcCreatePortSection(long long long long ptr ptr) @ stdcall -stub -version=0x600+ NtAlpcCreateResourceReserve(long long long ptr) @ stdcall -stub -version=0x600+ NtAlpcCreateSectionView(long long long) @@ -339,6 +339,7 @@ @ stdcall NtFsControlFile(long long long long long long long long long long) @ stdcall NtGetContextThread(long ptr) @ stdcall NtGetCurrentProcessorNumber() ; 5.2 and higher +@ stdcall -version=0xA00+ NtGetCurrentProcessorNumberEx(ptr) @ stdcall NtGetDevicePowerState(ptr ptr) @ stdcall -stub -version=0x600+ NtGetMUIRegistryInfo(long ptr ptr) @ stdcall -stub -version=0x600+ NtGetNextProcess(long long long long ptr) @@ -1505,6 +1506,7 @@ @ stdcall ZwFsControlFile(long long long long long long long long long long) @ stdcall ZwGetContextThread(long ptr) @ stdcall ZwGetCurrentProcessorNumber() +@ stdcall -version=0xA00+ ZwGetCurrentProcessorNumberEx(ptr) @ stdcall ZwGetDevicePowerState(ptr ptr) @ stdcall -stub -version=0x600+ ZwGetMUIRegistryInfo(long ptr ptr) @ stdcall -stub -version=0x600+ ZwGetNextProcess(ptr long long long ptr) diff --git a/dll/ntdll/nt_0600/CMakeLists.txt b/dll/ntdll/nt_0600/CMakeLists.txt index 69b9b5f0ff8..21e92e06269 100644 --- a/dll/ntdll/nt_0600/CMakeLists.txt +++ b/dll/ntdll/nt_0600/CMakeLists.txt @@ -19,7 +19,7 @@ target_link_libraries(ntdll_vista_static) add_dependencies(ntdll_vista_static psdk) add_library(ntdll_vista MODULE DllMain.c ${CMAKE_CURRENT_BINARY_DIR}/ntdll_vista.def ntdll_vista.rc) set_module_type(ntdll_vista win32dll ENTRYPOINT DllMain 12) -target_link_libraries(ntdll_vista ntdll_vista_static smlib rtl_vista ${PSEH_LIB}) +target_link_libraries(ntdll_vista ntdll_vista_static smlib rtl_vista ntdllsys_nt6 ${PSEH_LIB}) if(ARCH STREQUAL "arm") target_link_libraries(ntdll_vista chkstk) endif() diff --git a/dll/ntdll/nt_0600/ntdll_vista.spec b/dll/ntdll/nt_0600/ntdll_vista.spec index f25f688baa4..859f47e1c6c 100644 --- a/dll/ntdll/nt_0600/ntdll_vista.spec +++ b/dll/ntdll/nt_0600/ntdll_vista.spec @@ -1,6 +1,8 @@ @ stdcall LdrRegisterDllNotification(long ptr ptr ptr) @ stdcall LdrUnregisterDllNotification(ptr) +@ stdcall NtGetCurrentProcessorNumberEx(ptr) + @ stdcall RtlGetProductInfo(long long long long ptr) @ stdcall RtlInitializeConditionVariable(ptr) @ stdcall RtlWakeConditionVariable(ptr) diff --git a/ntoskrnl/CMakeLists.txt b/ntoskrnl/CMakeLists.txt index d33ff76dcc0..34999010434 100644 --- a/ntoskrnl/CMakeLists.txt +++ b/ntoskrnl/CMakeLists.txt @@ -63,3 +63,9 @@ add_asm_files(ntdllsys_asm ntdll.S) add_library(ntdllsys ${ntdllsys_asm}) set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C") add_dependencies(ntdllsys asm) + +# NT6 syscalls for ntdll_vista +add_asm_files(ntdllsys_nt6_asm ntdll_nt6.S) +add_library(ntdllsys_nt6 ${ntdllsys_nt6_asm}) +set_target_properties(ntdllsys_nt6 PROPERTIES LINKER_LANGUAGE "C") +add_dependencies(ntdllsys_nt6 asm) diff --git a/ntoskrnl/include/sysfuncs.h b/ntoskrnl/include/sysfuncs.h index b900287d4e5..2a155313df8 100644 --- a/ntoskrnl/include/sysfuncs.h +++ b/ntoskrnl/include/sysfuncs.h @@ -1,3 +1,4 @@ +#ifndef SYSFUNCS_NT6_ONLY SVC_(AcceptConnectPort, 6) SVC_(AccessCheck, 8) SVC_(AccessCheckAndAuditAlarm, 11) @@ -294,3 +295,8 @@ SVC_(QueryPortInformationProcess, 0) SVC_(GetCurrentProcessorNumber, 0) SVC_(WaitForMultipleObjects32, 5) +#endif // SYSFUNCS_NT6_ONLY + +#ifndef SYSFUNCS_NT5_ONLY + SVC_(GetCurrentProcessorNumberEx, 1) +#endif diff --git a/ntoskrnl/ke/processor.c b/ntoskrnl/ke/processor.c index 48e6b11fe6d..d09a7081502 100644 --- a/ntoskrnl/ke/processor.c +++ b/ntoskrnl/ke/processor.c @@ -42,3 +42,31 @@ KeQueryActiveProcessors(VOID) { return KeActiveProcessors; } + +/** + * Retrieves the number of the current processor. + * + * \param ProcessorNumber Pointer to a PROCESSOR_NUMBER structure that receives the processor number. + * + * \return NTSTATUS The status of the operation. + */ +NTSTATUS +NTAPI +NtGetCurrentProcessorNumberEx( + _Out_ PPROCESSOR_NUMBER ProcessorNumber) +{ + _SEH2_TRY + { + ProbeForWrite(ProcessorNumber, sizeof(PROCESSOR_NUMBER), __alignof(PROCESSOR_NUMBER)); + ProcessorNumber->Group = 0; // TODO: Support processor groups + ProcessorNumber->Number = (UCHAR)KeGetCurrentProcessorNumber(); + ProcessorNumber->Reserved = 0; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + return _SEH2_GetExceptionCode(); + } + _SEH2_END; + + return STATUS_SUCCESS; +} diff --git a/ntoskrnl/ntdll.S b/ntoskrnl/ntdll.S index b1c291f9a33..c14e9743515 100644 --- a/ntoskrnl/ntdll.S +++ b/ntoskrnl/ntdll.S @@ -1,6 +1,9 @@ #include +/* This file only has the NT5 syscalls */ +#define SYSFUNCS_NT5_ONLY + #ifdef _M_ARM TEXTAREA diff --git a/ntoskrnl/ntdll_nt6.S b/ntoskrnl/ntdll_nt6.S new file mode 100644 index 00000000000..d4af15396b2 --- /dev/null +++ b/ntoskrnl/ntdll_nt6.S @@ -0,0 +1,33 @@ + +#include + +/* Skip NT5 syscalls, so we get the right IDs for the NT6 ones */ +#define SYSFUNCS_NT5_ONLY +#define SVC_(name, argcount) SyscallId = SyscallId + 1 +#include +#undef SVC_ +#undef SYSFUNCS_NT5_ONLY + +/* Now do the NT6 ones proper */ +#define SYSFUNCS_NT6_ONLY + +#ifdef _M_ARM + + TEXTAREA + +#define SVC_(name, argcount) STUB_U name + +#include + + END + +#else + +.code + +#define SVC_(name, argcount) STUB_U name, argcount + +#include + +END +#endif