Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! [LibOS] Emulate in/out instructions as if they generate SIGSEGV
Signed-off-by: Nirjhar Roy <nirjhar.roy@fortanix.com>
- Loading branch information
1 parent
48834a7
commit 394fb63
Showing
6 changed files
with
91 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* SPDX-License-Identifier: LGPL-3.0-or-later */ | ||
/* Copyright (C) 2022 Fortnanix Inc | ||
* Nirjhar Roy <nirjhar.roy@fortanix.com> | ||
*/ | ||
|
||
/* This file contains functions that check various features and flags | ||
* specific to x86 | ||
*/ | ||
|
||
#include <stddef.h> | ||
|
||
#include "api.h" | ||
#include "cpu.h" | ||
|
||
bool is_x86_instr_legacy_prefix(uint8_t op) { | ||
uint8_t prefix_list[] = { | ||
/* Group 0 */ | ||
0xf0, /* LOCK prefix */ | ||
0xf2, /* REPNE/REPNZ prefix */ | ||
0xf3, /* REP or REPE/REPZ prefix */ | ||
/* Group 1 */ | ||
0x2e, /* CS segment override */ | ||
0x36, /* SS segment override */ | ||
0x3e, /* DS segment override */ | ||
0x26, /* ES segment override */ | ||
0x64, /* FS segment override */ | ||
0x65, /* GS segment override */ | ||
0x2e, /* Branch not taken */ | ||
0x3e, /* Branch taken */ | ||
/* Group 2 */ | ||
0x66, /* Operand-size override prefix */ | ||
/* Group 3 */ | ||
0x67, /* Address-size override prefix */ | ||
/* The rest of the prefixes aren't really applicable | ||
* for the instruction(s) we are checking. | ||
*/ | ||
}; | ||
for (size_t i = 0; i < ARRAY_SIZE(prefix_list); i++) { | ||
if (op == prefix_list[i]) | ||
return true; | ||
} | ||
return false; | ||
} |
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