Skip to content

Commit

Permalink
Add support for 512-bit args in the x64/x86 backends.
Browse files Browse the repository at this point in the history
  • Loading branch information
CensoredUsername committed Apr 18, 2024
1 parent 5dede16 commit ff52335
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion plugin/src/arch/x64/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ fn match_format_string(ctx: &Context, fmt: &Opdata, args: &[CleanArg]) -> Result
// W: matches CR8
// X: matches st0

// b, w, d, q, o, h match a byte, word, doubleword, quadword, octword and hexadecword
// b, w, d, q, o, h, t match a byte, word (2 bytes), doubleword (4 bytes), quadword (8 bytes), 16 bytes, 32 bytes and 64 bytes
// p matches a PWORD (10 bytes)
// f matches an FWORD (6 bytes)
// * matches all possible sizes for this operand (w/d for i, w/d/q for r/v, o/h for y/w and everything for m)
Expand Down Expand Up @@ -1134,6 +1134,7 @@ fn match_format_string(ctx: &Context, fmt: &Opdata, args: &[CleanArg]) -> Result
(b'p', _) => size == Size::B_10,
(b'o', _) => size == Size::B_16,
(b'h', _) => size == Size::B_32,
(b't', _) => size == Size::B_64,
// what is allowed for wildcards
(b'*', b'k') |
(b'*', b'l') |
Expand Down
1 change: 1 addition & 0 deletions plugin/src/arch/x64/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ fn format_arg(ty: u8, mut size: u8, opsize: u8) -> Cow<'static, str> {
b'p' => "80",
b'o' => "128",
b'h' => "256",
b't' => "512",
_ => ""
}
}
Expand Down
10 changes: 6 additions & 4 deletions plugin/src/arch/x64/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn is_prefix(ident: &syn::Ident) -> bool {

/// if a size hint is present in the parse stream, returning the indicated size
fn eat_size_hint(ctx: &Context, input: parse::ParseStream) -> Option<Size> {
const X86_SIZES: [(&str, Size); 9] = [
const X86_SIZES: [(&str, Size); 10] = [
("BYTE", Size::BYTE),
("WORD", Size::B_2),
("DWORD", Size::B_4),
Expand All @@ -79,9 +79,10 @@ fn eat_size_hint(ctx: &Context, input: parse::ParseStream) -> Option<Size> {
("QWORD", Size::B_8),
("TWORD", Size::B_10),
("OWORD", Size::B_16),
("YWORD", Size::B_32)
("YWORD", Size::B_32),
("ZWORD", Size::B_64)
];
const X64_SIZES: [(&str, Size); 9] = [
const X64_SIZES: [(&str, Size); 10] = [
("BYTE", Size::BYTE),
("WORD", Size::B_2),
("DWORD", Size::B_4),
Expand All @@ -90,7 +91,8 @@ fn eat_size_hint(ctx: &Context, input: parse::ParseStream) -> Option<Size> {
("QWORD", Size::B_8),
("TWORD", Size::B_10),
("OWORD", Size::B_16),
("YWORD", Size::B_32)
("YWORD", Size::B_32),
("ZWORD", Size::B_64)
];

let sizes = match ctx.mode {
Expand Down

0 comments on commit ff52335

Please sign in to comment.