replace nob with ms' build, move disk creation to build.bat, major comment cleanup, remove old and stupid tests, overhaul interrupt management with per-CPU vector allocation, affinity migration and safe teardown, add proper IOAPIC routing and PCI MSI/MSI-X/INTx support, migrate drivers to the new interrupt API, integrate ACPICA with a proper OS services layer, move ACPI firmware events, power button handling and S5 shutdown into acpi.sys, add parallel driver startup and atomic publication, replace PnP arrays with dynamic lists, redesign service startup again to be asynchronous, add delayed startup mode for services, allow omitting keys in services.ini, fix acpi ec deferred work handling, fix kernel threads having garbage exit code.
This commit is contained in:
1 parent
d36f19509c
commit
36eef8f58d
696 files changed
+147281
-7530
No files matched your search
+3
-81
@@ -30,7 +30,6 @@ static const HAL_API* gDebugHal;
|
||||
#define KE_DEBUG_LOG_LINE_SIZE 1024u
|
||||
#define KE_FATAL_OUTPUT_LINE_SIZE 2048u
|
||||
#define KE_STACK_DUMP_SLOT_COUNT 12u
|
||||
#define KE_RBP_CALL_STACK_DEPTH 16u
|
||||
|
||||
static SPINLOCK gDebugPrintLock = SPINLOCK_INIT;
|
||||
static char* gDebugLogBuffer;
|
||||
@@ -458,7 +457,6 @@ static const char* KiResolveModuleEx(PROCESS* proc, uintptr_t addr,
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
// Implements the resolve Module operation.
|
||||
static const char* KiResolveModule(PROCESS* proc, uintptr_t addr) {
|
||||
return KiResolveModuleEx(proc, addr, (uintptr_t*)0, (size_t*)0);
|
||||
}
|
||||
@@ -639,28 +637,6 @@ static void KiDumpModules(PROCESS* proc) {
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Returns whether a range is inside the current kernel stack.
|
||||
static bool KiKernelStackContains(const THREAD* thread, uintptr_t addr, size_t size) {
|
||||
if (!thread || !thread->KernelStackBase || !thread->KernelStackTop || !addr || size == 0)
|
||||
return false;
|
||||
if (size - 1u > (size_t)(UINTPTR_MAX - addr))
|
||||
return false;
|
||||
|
||||
uintptr_t base = (uintptr_t)thread->KernelStackBase;
|
||||
uintptr_t top = thread->KernelStackTop;
|
||||
uintptr_t end = addr + size;
|
||||
return addr >= base && end <= top;
|
||||
}
|
||||
|
||||
// Returns whether the fault frame is using the current kernel stack.
|
||||
static bool KiFaultFrameOnKernelStack(const THREAD* thread, const KFAULT_FRAME* f) {
|
||||
if (!f || !thread)
|
||||
return false;
|
||||
return KiKernelStackContains(thread, (uintptr_t)f->Rsp, sizeof(uint64_t));
|
||||
}
|
||||
|
||||
#endif
|
||||
// Dumps stack words near RSP.
|
||||
static void KiDumpStack(PROCESS* proc, uintptr_t rsp) {
|
||||
KiFaultPrintf("Stack @ %016llx:\n", (unsigned long long)rsp);
|
||||
@@ -684,58 +660,8 @@ static void KiDumpStack(PROCESS* proc, uintptr_t rsp) {
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Dumps a best-effort frame-pointer call stack.
|
||||
static void KiDumpRbpCallStack(PROCESS* proc, THREAD* thread, const KFAULT_FRAME* f) {
|
||||
uintptr_t rbp = f ? (uintptr_t)f->Rbp : 0;
|
||||
KiFaultPrintf("RBP call stack @ %016llx:\n", (unsigned long long)rbp);
|
||||
if (!rbp) {
|
||||
KiFaultPrintf(" <no RBP captured>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int kernelStack = KiFaultFrameOnKernelStack(thread, f);
|
||||
for (uint32_t depth = 0; depth < KE_RBP_CALL_STACK_DEPTH; depth++) {
|
||||
if (rbp & (sizeof(uint64_t) - 1u)) {
|
||||
KiFaultPrintf(" stop: unaligned RBP %016llx\n",
|
||||
(unsigned long long)rbp);
|
||||
return;
|
||||
}
|
||||
if (kernelStack && !KiKernelStackContains(thread, rbp, sizeof(uint64_t) * 2u)) {
|
||||
KiFaultPrintf(" stop: RBP outside kernel stack %016llx\n",
|
||||
(unsigned long long)rbp);
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t next = 0;
|
||||
uint64_t ret = 0;
|
||||
if (!KiUserReadU64(rbp, &next) || !KiUserReadU64(rbp + sizeof(uint64_t), &ret)) {
|
||||
KiFaultPrintf(" stop: frame unreadable at %016llx\n",
|
||||
(unsigned long long)rbp);
|
||||
return;
|
||||
}
|
||||
|
||||
KiFaultPrintf(" #%02u rbp=%016llx ret=",
|
||||
(unsigned)depth,
|
||||
(unsigned long long)rbp);
|
||||
KiPrintAddressValue(proc, (uintptr_t)ret);
|
||||
KiFaultPrintf(" next=%016llx\n", (unsigned long long)next);
|
||||
|
||||
if (!next)
|
||||
return;
|
||||
if ((uintptr_t)next <= rbp) {
|
||||
KiFaultPrintf(" stop: non-forward RBP chain %016llx -> %016llx\n",
|
||||
(unsigned long long)rbp,
|
||||
(unsigned long long)next);
|
||||
return;
|
||||
}
|
||||
rbp = (uintptr_t)next;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
// Dumps a fault frame.
|
||||
static void KiDumpFaultFrame(PROCESS* proc, THREAD* thread, const KFAULT_FRAME* f) {
|
||||
static void KiDumpFaultFrame(PROCESS* proc, const KFAULT_FRAME* f) {
|
||||
if (!f) return;
|
||||
|
||||
KiFaultPrintf("Regs:\n");
|
||||
@@ -771,9 +697,6 @@ static void KiDumpFaultFrame(PROCESS* proc, THREAD* thread, const KFAULT_FRAME*
|
||||
}
|
||||
|
||||
KiDumpStack(proc, (uintptr_t)f->Rsp);
|
||||
#if 0
|
||||
KiDumpRbpCallStack(proc, thread, f);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void KiPrintCrashHeader(PROCESS* proc, int vector, uintptr_t rip,
|
||||
@@ -804,7 +727,6 @@ static void KiPrintCrashHeader(PROCESS* proc, int vector, uintptr_t rip,
|
||||
(unsigned long long)errCode);
|
||||
}
|
||||
|
||||
// Implements the finish Faulted Process operation.
|
||||
static _Noreturn void KiFinishFaultedProcess(PROCESS* proc, THREAD* thread, KSTATUS exitStatus) {
|
||||
int exitCode = (int)exitStatus;
|
||||
if (proc) (void)KeTerminateProcess(proc, exitCode);
|
||||
@@ -849,7 +771,7 @@ static _Noreturn void KiPanicKernelFault(PROCESS* proc, THREAD* thread, const KF
|
||||
thread,
|
||||
proc ? proc->ProcessId : 0,
|
||||
proc ? proc->Name : "<none>");
|
||||
KiDumpFaultFrame(proc, thread, frame);
|
||||
KiDumpFaultFrame(proc, frame);
|
||||
if (vector == 14) {
|
||||
MmDebugDescribeAddress((uintptr_t)frame->Cr2);
|
||||
if (frame->Rip) MmDebugDescribeAddress((uintptr_t)frame->Rip);
|
||||
@@ -894,7 +816,7 @@ static _Noreturn void KiTerminateUserFault(PROCESS* proc, THREAD* thread, const
|
||||
(uintptr_t)frame->Rip,
|
||||
(uintptr_t)frame->ErrorCode,
|
||||
(uintptr_t)frame->Cr2);
|
||||
KiDumpFaultFrame(proc, thread, frame);
|
||||
KiDumpFaultFrame(proc, frame);
|
||||
KiDumpModules(proc);
|
||||
|
||||
KiFinishFaultedProcess(proc, thread, KeExceptionProcessExitStatus((uint32_t)frame->Vector));
|
||||
|
||||
Reference in new issue
Block a user