feat: move CrashReport.cpp/hpp
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* CrashReport.hpp
|
||||
* Structured crash report for userspace process faults
|
||||
* Copyright (c) 2026 Daniel Hammer
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
namespace CrashReport {
|
||||
|
||||
static constexpr int MaxReports = 8;
|
||||
|
||||
struct Report {
|
||||
int pid;
|
||||
char processName[64];
|
||||
uint8_t exceptionVector;
|
||||
char exceptionName[32];
|
||||
|
||||
uint64_t faultingAddress;
|
||||
uint64_t instructionPointer;
|
||||
uint64_t stackPointer;
|
||||
uint64_t codeSegment;
|
||||
uint64_t flags;
|
||||
uint64_t stackSegment;
|
||||
|
||||
// Page fault error code bits (vector 0xE / page fault only)
|
||||
uint8_t pfPresent : 1;
|
||||
uint8_t pfWrite : 1;
|
||||
uint8_t pfUser : 1;
|
||||
uint8_t pfReservedWrite : 1;
|
||||
uint8_t pfInstructionFetch : 1;
|
||||
uint8_t pfProtectionKey : 1;
|
||||
uint8_t pfShadowStack : 1;
|
||||
uint8_t pfSGX : 1;
|
||||
|
||||
uint64_t timestampTick;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
// Kernel-side ring buffer (written by exception handlers, read by SYS_CRASH_REPORT)
|
||||
extern Report g_reports[MaxReports];
|
||||
extern int g_reportHead;
|
||||
extern int g_reportCount;
|
||||
|
||||
// Add a report to the kernel ring buffer
|
||||
void AddReport(const Report& report);
|
||||
|
||||
} // namespace CrashReport
|
||||
Reference in New Issue
Block a user