summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgibbed <rick@gibbed.us>2019-08-25 16:18:14 -0500
committerRick Gibbed <rick@gibbed.us>2019-08-25 17:02:42 -0500
commit015e91140a11bb5977df2d6d065cf831a848ad9e (patch)
treee6924c6dff36b93d79685b6f98a6925ded50e38d
parent920b5c583934d35e6c9bb9bfa73af00bf0de72ba (diff)
[x64] Don't have a zeroed unwind info as the first slot.
-rw-r--r--src/xenia/cpu/backend/x64/x64_code_cache_win.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/xenia/cpu/backend/x64/x64_code_cache_win.cc b/src/xenia/cpu/backend/x64/x64_code_cache_win.cc
index 66c16d9cf..35496c746 100644
--- a/src/xenia/cpu/backend/x64/x64_code_cache_win.cc
+++ b/src/xenia/cpu/backend/x64/x64_code_cache_win.cc
@@ -212,12 +212,11 @@ bool Win32X64CodeCache::Initialize() {
Win32X64CodeCache::UnwindReservation
Win32X64CodeCache::RequestUnwindReservation(uint8_t* entry_address) {
+ assert_false(unwind_table_count_ >= kMaximumFunctionCount);
UnwindReservation unwind_reservation;
unwind_reservation.data_size = xe::round_up(kUnwindInfoSize, 16);
- unwind_reservation.table_slot = ++unwind_table_count_;
+ unwind_reservation.table_slot = unwind_table_count_++;
unwind_reservation.entry_address = entry_address;
- assert_false(unwind_table_count_ >= kMaximumFunctionCount);
-
return unwind_reservation;
}
@@ -274,7 +273,7 @@ void Win32X64CodeCache::InitializeUnwindEntry(
unwind_code = &unwind_info->UnwindCode[unwind_info->CountOfCodes++];
unwind_code->CodeOffset = prolog_stack_alloc_offset;
unwind_code->UnwindOp = UWOP_ALLOC_SMALL;
- unwind_code->OpInfo = func_info.stack_size / 8 - 1;
+ unwind_code->OpInfo = (func_info.stack_size / 8) - 1;
} else {
// TODO(benvanik): take as parameters?
@@ -314,7 +313,7 @@ void Win32X64CodeCache::InitializeUnwindEntry(
void* Win32X64CodeCache::LookupUnwindInfo(uint64_t host_pc) {
return std::bsearch(
- &host_pc, unwind_table_.data(), unwind_table_count_ + 1,
+ &host_pc, unwind_table_.data(), unwind_table_count_,
sizeof(RUNTIME_FUNCTION),
[](const void* key_ptr, const void* element_ptr) {
auto key =