From e00c6f20919e18b51b9bbbdad0a1eb0f131b0483 Mon Sep 17 00:00:00 2001 From: rakslice Date: Thu, 8 Oct 2020 21:53:41 -0700 Subject: [PATCH 1/4] ix86_instruction_skip: x86_64: handle address size prefix (cherry picked from commit 05b3236afd71886826d6e4784ca4e708f67aaa80) --- SheepShaver/src/CrossPlatform/sigsegv.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SheepShaver/src/CrossPlatform/sigsegv.cpp b/SheepShaver/src/CrossPlatform/sigsegv.cpp index d117366e..3dabbc45 100644 --- a/SheepShaver/src/CrossPlatform/sigsegv.cpp +++ b/SheepShaver/src/CrossPlatform/sigsegv.cpp @@ -1018,6 +1018,16 @@ static bool ix86_skip_instruction(SIGSEGV_REGISTER_TYPE * regs) transfer_size = SIZE_WORD; } +#if defined(__x86_64__) || defined(_M_X64) + bool x86_64_address_32 = false; + if (*eip == 0x67) { + eip++; + len++; + x86_64_address_32 = true; + } + // FIXME do something with this +#endif + // REX prefix #if defined(__x86_64__) || defined(_M_X64) struct rex_t { From 497b5bc5a9ffbf1e8a74ad808423be0223099920 Mon Sep 17 00:00:00 2001 From: rakslice Date: Tue, 20 Oct 2020 19:57:24 -0700 Subject: [PATCH 2/4] cleanup (cherry picked from commit 72a1513a360118b03b7c29be519125f7d5f7cc8e) --- SheepShaver/src/CrossPlatform/sigsegv.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SheepShaver/src/CrossPlatform/sigsegv.cpp b/SheepShaver/src/CrossPlatform/sigsegv.cpp index 3dabbc45..2c6491f5 100644 --- a/SheepShaver/src/CrossPlatform/sigsegv.cpp +++ b/SheepShaver/src/CrossPlatform/sigsegv.cpp @@ -1019,6 +1019,7 @@ static bool ix86_skip_instruction(SIGSEGV_REGISTER_TYPE * regs) } #if defined(__x86_64__) || defined(_M_X64) + // Address size override bool x86_64_address_32 = false; if (*eip == 0x67) { eip++; From 85f8971d8d4fe5c8b3c3cd78550ab69e95600323 Mon Sep 17 00:00:00 2001 From: rakslice Date: Tue, 1 Dec 2020 19:55:45 -0800 Subject: [PATCH 3/4] remove x64 instruction skip 32-bit address flag we don't need to save for anything --- SheepShaver/src/CrossPlatform/sigsegv.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/SheepShaver/src/CrossPlatform/sigsegv.cpp b/SheepShaver/src/CrossPlatform/sigsegv.cpp index 2c6491f5..70a43be2 100644 --- a/SheepShaver/src/CrossPlatform/sigsegv.cpp +++ b/SheepShaver/src/CrossPlatform/sigsegv.cpp @@ -1020,13 +1020,11 @@ static bool ix86_skip_instruction(SIGSEGV_REGISTER_TYPE * regs) #if defined(__x86_64__) || defined(_M_X64) // Address size override - bool x86_64_address_32 = false; if (*eip == 0x67) { + // 32-bit address eip++; len++; - x86_64_address_32 = true; } - // FIXME do something with this #endif // REX prefix From f198632834b25af86c9f99d7823b2bc683778ec4 Mon Sep 17 00:00:00 2001 From: rakslice Date: Tue, 1 Dec 2020 23:33:38 -0800 Subject: [PATCH 4/4] corresponding change for BII sigsegv.cpp --- BasiliskII/src/CrossPlatform/sigsegv.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BasiliskII/src/CrossPlatform/sigsegv.cpp b/BasiliskII/src/CrossPlatform/sigsegv.cpp index 73ca8330..10a78171 100755 --- a/BasiliskII/src/CrossPlatform/sigsegv.cpp +++ b/BasiliskII/src/CrossPlatform/sigsegv.cpp @@ -1018,6 +1018,15 @@ static bool ix86_skip_instruction(SIGSEGV_REGISTER_TYPE * regs) transfer_size = SIZE_WORD; } +#if defined(__x86_64__) || defined(_M_X64) + // Address size override + if (*eip == 0x67) { + // 32-bit address + eip++; + len++; + } +#endif + // REX prefix #if defined(__x86_64__) || defined(_M_X64) struct rex_t {