summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2026-01-12 15:19:16 -0700
committerRusty Wagner <rusty.wagner@gmail.com>2026-05-22 16:30:57 -0400
commita4a3de2ad363b1bceb28f106e2cc6d811b3370b5 (patch)
tree7f281e99f4e96d3194d16c1fbbed409df34e1d92 /arch
parent705b4504c9e8e3f78311952f12793bfcb78a794e (diff)
Add handling of structure returns and parameters in Windows x86/x64 calling conventions
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/arch_x86.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/x86/arch_x86.cpp b/arch/x86/arch_x86.cpp
index aeeed4e7..83a476bf 100644
--- a/arch/x86/arch_x86.cpp
+++ b/arch/x86/arch_x86.cpp
@@ -3827,6 +3827,23 @@ public:
}
return result;
}
+
+ bool IsReturnTypeRegisterCompatible(BinaryView*, Type* type) override
+ {
+ if (!type)
+ return false;
+ if (type->IsFloat())
+ return true;
+ if (type->GetWidth() == 0 || type->GetWidth() == 1 || type->GetWidth() == 2 || type->GetWidth() == 4
+ || type->GetWidth() == 8)
+ return true;
+ return false;
+ }
+
+ std::optional<Variable> GetReturnedIndirectReturnValuePointer() override
+ {
+ return Variable::Register(XED_REG_EAX);
+ }
};
@@ -4060,6 +4077,36 @@ public:
{
return true;
}
+
+ bool IsReturnTypeRegisterCompatible(BinaryView*, Type* type) override
+ {
+ if (!type)
+ return false;
+ if (type->IsFloat())
+ return true;
+ return type->GetWidth() == 0 || type->GetWidth() == 1 || type->GetWidth() == 2 || type->GetWidth() == 4
+ || type->GetWidth() == 8;
+ }
+
+ std::optional<Variable> GetReturnedIndirectReturnValuePointer() override
+ {
+ return Variable::Register(XED_REG_RAX);
+ }
+
+ bool IsArgumentTypeRegisterCompatible(BinaryView*, Type* type) override
+ {
+ if (!type)
+ return false;
+ if (type->IsFloat())
+ return true;
+ return type->GetWidth() == 0 || type->GetWidth() == 1 || type->GetWidth() == 2 || type->GetWidth() == 4
+ || type->GetWidth() == 8;
+ }
+
+ bool IsNonRegisterArgumentIndirect(BinaryView*, Type*) override
+ {
+ return true;
+ }
};