[CPU/Kernel] Cleanup and rework of how kernel exports are declared.

This commit is contained in:
gibbed
2018-11-20 11:01:25 -06:00
parent 613be1425e
commit 394105d359
31 changed files with 399 additions and 502 deletions

View File

@@ -52,7 +52,7 @@ dword_result_t RtlCompareMemory(lpvoid_t source1, lpvoid_t source2,
return c;
}
DECLARE_XBOXKRNL_EXPORT(RtlCompareMemory, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlCompareMemory, kMemory, kImplemented);
// http://msdn.microsoft.com/en-us/library/ff552123
dword_result_t RtlCompareMemoryUlong(lpvoid_t source, dword_t length,
@@ -73,7 +73,7 @@ dword_result_t RtlCompareMemoryUlong(lpvoid_t source, dword_t length,
return n;
}
DECLARE_XBOXKRNL_EXPORT(RtlCompareMemoryUlong, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlCompareMemoryUlong, kMemory, kImplemented);
// http://msdn.microsoft.com/en-us/library/ff552263
void RtlFillMemoryUlong(lpvoid_t destination, dword_t length, dword_t pattern) {
@@ -86,7 +86,7 @@ void RtlFillMemoryUlong(lpvoid_t destination, dword_t length, dword_t pattern) {
*p = swapped_pattern;
}
}
DECLARE_XBOXKRNL_EXPORT(RtlFillMemoryUlong, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlFillMemoryUlong, kMemory, kImplemented);
dword_result_t RtlUpperChar(dword_t in) {
char c = in & 0xFF;
@@ -96,7 +96,7 @@ dword_result_t RtlUpperChar(dword_t in) {
return c;
}
DECLARE_XBOXKRNL_EXPORT(RtlUpperChar, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlUpperChar, kNone, kImplemented);
dword_result_t RtlLowerChar(dword_t in) {
char c = in & 0xFF;
@@ -106,7 +106,7 @@ dword_result_t RtlLowerChar(dword_t in) {
return c;
}
DECLARE_XBOXKRNL_EXPORT(RtlLowerChar, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlLowerChar, kNone, kImplemented);
dword_result_t RtlCompareString(lpstring_t string_1, lpstring_t string_2,
dword_t case_insensitive) {
@@ -115,7 +115,7 @@ dword_result_t RtlCompareString(lpstring_t string_1, lpstring_t string_2,
return ret;
}
DECLARE_XBOXKRNL_EXPORT(RtlCompareString, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlCompareString, kNone, kImplemented);
dword_result_t RtlCompareStringN(lpstring_t string_1, dword_t string_1_len,
lpstring_t string_2, dword_t string_2_len,
@@ -136,7 +136,7 @@ dword_result_t RtlCompareStringN(lpstring_t string_1, dword_t string_1_len,
return ret;
}
DECLARE_XBOXKRNL_EXPORT(RtlCompareStringN, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlCompareStringN, kNone, kImplemented);
// http://msdn.microsoft.com/en-us/library/ff561918
void RtlInitAnsiString(pointer_t<X_ANSI_STRING> destination,
@@ -151,7 +151,7 @@ void RtlInitAnsiString(pointer_t<X_ANSI_STRING> destination,
destination->pointer = source.guest_address();
}
DECLARE_XBOXKRNL_EXPORT(RtlInitAnsiString, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlInitAnsiString, kNone, kImplemented);
// http://msdn.microsoft.com/en-us/library/ff561899
void RtlFreeAnsiString(pointer_t<X_ANSI_STRING> string) {
@@ -161,7 +161,7 @@ void RtlFreeAnsiString(pointer_t<X_ANSI_STRING> string) {
string->reset();
}
DECLARE_XBOXKRNL_EXPORT(RtlFreeAnsiString, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlFreeAnsiString, kNone, kImplemented);
// http://msdn.microsoft.com/en-us/library/ff561934
void RtlInitUnicodeString(pointer_t<X_UNICODE_STRING> destination,
@@ -174,7 +174,7 @@ void RtlInitUnicodeString(pointer_t<X_UNICODE_STRING> destination,
destination->reset();
}
}
DECLARE_XBOXKRNL_EXPORT(RtlInitUnicodeString, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlInitUnicodeString, kNone, kImplemented);
// http://msdn.microsoft.com/en-us/library/ff561903
void RtlFreeUnicodeString(pointer_t<X_UNICODE_STRING> string) {
@@ -184,7 +184,7 @@ void RtlFreeUnicodeString(pointer_t<X_UNICODE_STRING> string) {
string->reset();
}
DECLARE_XBOXKRNL_EXPORT(RtlFreeUnicodeString, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlFreeUnicodeString, kNone, kImplemented);
void RtlCopyString(pointer_t<X_ANSI_STRING> destination,
pointer_t<X_ANSI_STRING> source) {
@@ -201,7 +201,7 @@ void RtlCopyString(pointer_t<X_ANSI_STRING> destination,
}
destination->length = length;
}
DECLARE_XBOXKRNL_EXPORT(RtlCopyString, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlCopyString, kNone, kImplemented);
void RtlCopyUnicodeString(pointer_t<X_UNICODE_STRING> destination,
pointer_t<X_UNICODE_STRING> source) {
@@ -218,7 +218,7 @@ void RtlCopyUnicodeString(pointer_t<X_UNICODE_STRING> destination,
}
destination->length = length;
}
DECLARE_XBOXKRNL_EXPORT(RtlCopyUnicodeString, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlCopyUnicodeString, kNone, kImplemented);
// http://msdn.microsoft.com/en-us/library/ff562969
dword_result_t RtlUnicodeStringToAnsiString(
@@ -262,7 +262,7 @@ dword_result_t RtlUnicodeStringToAnsiString(
}
return result;
}
DECLARE_XBOXKRNL_EXPORT(RtlUnicodeStringToAnsiString, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlUnicodeStringToAnsiString, kNone, kImplemented);
// https://msdn.microsoft.com/en-us/library/ff553113
dword_result_t RtlMultiByteToUnicodeN(lpword_t destination_ptr,
@@ -286,8 +286,7 @@ dword_result_t RtlMultiByteToUnicodeN(lpword_t destination_ptr,
return 0;
}
DECLARE_XBOXKRNL_EXPORT(RtlMultiByteToUnicodeN,
ExportTag::kImplemented | ExportTag::kSketchy);
DECLARE_XBOXKRNL_EXPORT2(RtlMultiByteToUnicodeN, kNone, kImplemented, kSketchy);
// https://msdn.microsoft.com/en-us/library/ff553261
dword_result_t RtlUnicodeToMultiByteN(pointer_t<uint8_t> destination_ptr,
@@ -309,8 +308,7 @@ dword_result_t RtlUnicodeToMultiByteN(pointer_t<uint8_t> destination_ptr,
return 0;
}
DECLARE_XBOXKRNL_EXPORT(RtlUnicodeToMultiByteN,
ExportTag::kImplemented | ExportTag::kSketchy);
DECLARE_XBOXKRNL_EXPORT2(RtlUnicodeToMultiByteN, kNone, kImplemented, kSketchy);
pointer_result_t RtlImageXexHeaderField(pointer_t<xex2_header> xex_header,
dword_t field_dword) {
@@ -322,7 +320,7 @@ pointer_result_t RtlImageXexHeaderField(pointer_t<xex2_header> xex_header,
return field_value;
}
DECLARE_XBOXKRNL_EXPORT(RtlImageXexHeaderField, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlImageXexHeaderField, kNone, kImplemented);
// Unfortunately the Windows RTL_CRITICAL_SECTION object is bigger than the one
// on the 360 (32b vs. 28b). This means that we can't do in-place splatting of
@@ -364,7 +362,7 @@ void xeRtlInitializeCriticalSection(X_RTL_CRITICAL_SECTION* cs,
void RtlInitializeCriticalSection(pointer_t<X_RTL_CRITICAL_SECTION> cs) {
xeRtlInitializeCriticalSection(cs, cs.guest_address());
}
DECLARE_XBOXKRNL_EXPORT(RtlInitializeCriticalSection, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlInitializeCriticalSection, kNone, kImplemented);
X_STATUS xeRtlInitializeCriticalSectionAndSpinCount(X_RTL_CRITICAL_SECTION* cs,
uint32_t cs_ptr,
@@ -391,8 +389,8 @@ dword_result_t RtlInitializeCriticalSectionAndSpinCount(
return xeRtlInitializeCriticalSectionAndSpinCount(cs, cs.guest_address(),
spin_count);
}
DECLARE_XBOXKRNL_EXPORT(RtlInitializeCriticalSectionAndSpinCount,
ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlInitializeCriticalSectionAndSpinCount, kNone,
kImplemented);
void RtlEnterCriticalSection(pointer_t<X_RTL_CRITICAL_SECTION> cs) {
uint32_t cur_thread = XThread::GetCurrentThread()->guest_object();
@@ -425,8 +423,8 @@ void RtlEnterCriticalSection(pointer_t<X_RTL_CRITICAL_SECTION> cs) {
cs->owning_thread = cur_thread;
cs->recursion_count = 1;
}
DECLARE_XBOXKRNL_EXPORT(RtlEnterCriticalSection,
ExportTag::kImplemented | ExportTag::kHighFrequency);
DECLARE_XBOXKRNL_EXPORT2(RtlEnterCriticalSection, kNone, kImplemented,
kHighFrequency);
dword_result_t RtlTryEnterCriticalSection(
pointer_t<X_RTL_CRITICAL_SECTION> cs) {
@@ -447,8 +445,8 @@ dword_result_t RtlTryEnterCriticalSection(
// Failed to acquire lock.
return 0;
}
DECLARE_XBOXKRNL_EXPORT(RtlTryEnterCriticalSection,
ExportTag::kImplemented | ExportTag::kHighFrequency);
DECLARE_XBOXKRNL_EXPORT2(RtlTryEnterCriticalSection, kNone, kImplemented,
kHighFrequency);
void RtlLeaveCriticalSection(pointer_t<X_RTL_CRITICAL_SECTION> cs) {
assert_true(cs->owning_thread == XThread::GetCurrentThread()->guest_object());
@@ -469,8 +467,8 @@ void RtlLeaveCriticalSection(pointer_t<X_RTL_CRITICAL_SECTION> cs) {
KeSetEvent(reinterpret_cast<X_KEVENT*>(cs.host_address()), 1, 0);
}
}
DECLARE_XBOXKRNL_EXPORT(RtlLeaveCriticalSection,
ExportTag::kImplemented | ExportTag::kHighFrequency);
DECLARE_XBOXKRNL_EXPORT2(RtlLeaveCriticalSection, kNone, kImplemented,
kHighFrequency);
struct X_TIME_FIELDS {
xe::be<uint16_t> year;
@@ -500,7 +498,7 @@ void RtlTimeToTimeFields(lpqword_t time_ptr,
time_fields_ptr->milliseconds = time_ms % 1000;
time_fields_ptr->weekday = tm->tm_wday;
}
DECLARE_XBOXKRNL_EXPORT(RtlTimeToTimeFields, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlTimeToTimeFields, kNone, kImplemented);
dword_result_t RtlTimeFieldsToTime(pointer_t<X_TIME_FIELDS> time_fields_ptr,
lpqword_t time_ptr) {
@@ -522,7 +520,7 @@ dword_result_t RtlTimeFieldsToTime(pointer_t<X_TIME_FIELDS> time_fields_ptr,
*time_ptr = time;
return 1;
}
DECLARE_XBOXKRNL_EXPORT(RtlTimeFieldsToTime, ExportTag::kImplemented);
DECLARE_XBOXKRNL_EXPORT1(RtlTimeFieldsToTime, kNone, kImplemented);
void RegisterRtlExports(xe::cpu::ExportResolver* export_resolver,
KernelState* kernel_state) {}