-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clang-format, nits, hexify entry_syscall
- Loading branch information
Showing
4 changed files
with
68 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,43 @@ | ||
// Jason Crowder - February 2024 | ||
#include "backend.h" | ||
|
||
namespace linux_page_fault_test { | ||
|
||
constexpr bool LoggingOn = false; | ||
bool InsertTestcase(const uint8_t *Buffer, const size_t BufferSize) { | ||
return true; | ||
} | ||
|
||
template <typename... Args_t> | ||
void DebugPrint(const char *Format, const Args_t &...args) { | ||
if constexpr (LoggingOn) { | ||
fmt::print("linux_page_fault_test: "); | ||
fmt::print(fmt::runtime(Format), args...); | ||
} | ||
bool Init(const Options_t &Opts, const CpuState_t &) { | ||
if (!g_Backend->SetCrashBreakpoint("asm_exc_page_fault")) { | ||
fmt::print("Failed to insert crash breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
if (!g_Backend->SetCrashBreakpoint("asm_exc_divide_error")) { | ||
fmt::print("Failed to insert crash breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
bool InsertTestcase(const uint8_t *Buffer, const size_t BufferSize) { | ||
return true; | ||
} | ||
if (!g_Backend->SetCrashBreakpoint("force_sigsegv")) { | ||
fmt::print("Failed to insert crash breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
bool Init(const Options_t &Opts, const CpuState_t &) { | ||
if (!g_Backend->SetCrashBreakpoint("asm_exc_page_fault")) { | ||
fmt::print("Failed to insert crash breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
if (!g_Backend->SetCrashBreakpoint("asm_exc_divide_error")) { | ||
fmt::print("Failed to insert crash breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
if (!g_Backend->SetCrashBreakpoint("force_sigsegv")) { | ||
fmt::print("Failed to insert crash breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
if (!g_Backend->SetCrashBreakpoint("page_fault_oops")) { | ||
fmt::print("Failed to insert crash breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
if (!g_Backend->SetBreakpoint("done_with_test", [](Backend_t *Backend) { | ||
Backend->Stop(Ok_t()); | ||
})) { | ||
fmt::print("Failed to insert breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
return true; | ||
if (!g_Backend->SetCrashBreakpoint("page_fault_oops")) { | ||
fmt::print("Failed to insert crash breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
if (!g_Backend->SetBreakpoint("done_with_test", [](Backend_t *Backend) { | ||
Backend->Stop(Ok_t()); | ||
})) { | ||
fmt::print("Failed to insert breakpoint.\n"); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
Target_t linux_page_fault_test("linux_page_fault_test", Init, InsertTestcase); | ||
|
||
} | ||
} // namespace linux_page_fault_test |