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

Reverse syscall override return register ordering #284

Merged
merged 3 commits into from
May 4, 2022
Merged

Conversation

bboston7
Copy link
Contributor

@bboston7 bboston7 commented May 2, 2022

When a user overrides a system call on an architecture that supports returning two values from a system call and they provide a context containing the result of the system call in the form

empty :> v0 :> v1

macaw will perform the register assignment

r0 := v1
r1 := v0

This change reverses this behavior so that the assignment becomes

r0 := v0
r1 := v1

This brings the expected ordering of the result context in agreement
with the left-to-right ordering of the argument context:

empty :> arg1 :> arg2 :> ...

When a user overrides a system call on an architecture that supports
returning two values from a system call (one for success, another for errors)
and they provide a context containing the result of the system call in
the form

```
empty :> result_value :> error_value
```

macaw will perform the register assignment

```
result_register := error_value
error_register := result_value
```

This change reverses this behavior so that the assignment becomes

```
result_register := result_value
error_register := error_value
```

This brings the expected ordering of the result context in agreement
with the left-to-right ordering of the argument context:

```
empty :> arg1 :> arg2 :> ...
```
@bboston7 bboston7 added arch:aarch32 AArch32 (32 bit ARM) issues arch:x86 x86 issues arch:riscv RISC-V issues labels May 2, 2022
@bboston7 bboston7 requested a review from travitch May 2, 2022 23:42
@travitch
Copy link
Contributor

travitch commented May 4, 2022

I just want to note that "result value" and "error value" is not necessarily an accurate characterization. There are simply some syscalls that return two values (though very few).

Copy link
Contributor

@travitch travitch left a comment

Choose a reason for hiding this comment

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

Approved, aside from the documentation request

@bboston7
Copy link
Contributor Author

bboston7 commented May 4, 2022

I just want to note that "result value" and "error value" is not necessarily an accurate characterization. There are simply some syscalls that return two values (though very few).

Thanks. I updated the description to reflect this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch:aarch32 AArch32 (32 bit ARM) issues arch:riscv RISC-V issues arch:x86 x86 issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants