Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSE XMM0 ABI #923

Merged
merged 3 commits into from
Feb 21, 2019
Merged

SSE XMM0 ABI #923

merged 3 commits into from
Feb 21, 2019

Conversation

turnersr
Copy link
Contributor

The following code allows ymm registers to be cast to smaller register. This new casting operation is used to extract xmm registers from ymm registers in order to support monomorphic functions in sse. The SysV ABI is extended to receive more arguments and can now recognize functions that read and write to xmm0.

…rs. This new casting operation is used to extract xmm registers from ymm registers in order to support monomorphic functions in sse. The SysV ABI is updated to recognize functions that read and write to xmm0.
Copy link
Member

@ivg ivg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flt function may terminate with an out-of-the-bound exception, we need to fix it.
Additionally, if you think that we need float right now, then it is easy to extend the code with it, the only difference is that we need to cast them to 32 bit instead of 64.

let flt = function
| Ret_0 -> xmm 0
| Ret_1 -> xmm 1
| Arg n -> xmm n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function will blow up with an exception if we will try to pass more than 16 floats, and will be just incorrect if we will try to pass more than 8, as according to SysV AMD64 ABI only xmms0-xmms7 are used for arguments passing, while the rest XMM8-XMM15 are used as scratch registers. So it should be something like this:

| Arg n -> if n < 8 then xmm n else stack Int.(n-8)

Note, this is still an under-approximation, as it will only work for monomorphic functions, but better than terminating analysis with an exception :)

plugins/x86/x86_abi.ml Outdated Show resolved Hide resolved
@ivg ivg merged commit 09a2521 into BinaryAnalysisPlatform:master Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants