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

x86-interrupt calling convention leads to wrong error code in debug mode #57270

Open
phil-opp opened this Issue Jan 2, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@phil-opp
Copy link
Contributor

phil-opp commented Jan 2, 2019

When using the x86-interrupt calling convention for an exception with error code, the error code is wrong in debug mode. I checked the assembly code and it seems like it loads the first field of the exception stack frame instead of the error code, i.e. it is off by 8 bytes, so this seems to be a bug in LLVM. The interesting thing is that the error code is correct in release mode.

It worked correctly with nightly (9389e23a8 2017-12-31), so it is a regression. I'm currently trying different Rust versions to find out when the problem was introduced:

Nightly Works?
(9389e23 2017-12-31) Yes
(8ccab7e 2018-01-31) Yes
(bd98fe0 2018-02-06) Yes
(3bcda48 2018-02-09) Yes
(45fba43 2018-02-10) No
(b8398d9 2018-02-11) No
(4d2d3fc 2018-02-13) No
(0ff9872 2018-02-28) No
(1ffb321 2018-05-31) No
(f4a421e 2018-12-13) No

Edit: The problem was introduced between the 2018-02-09 and the 2018-02-10 nightly. These are the relevant commits: 3bcda48...45fba43. I think it was most likely the upgrade to LLVM 6 in #47828, which was huge.

See phil-opp/blog_os#513 for more context.

@phil-opp

This comment has been minimized.

Copy link
Contributor

phil-opp commented Jan 3, 2019

I think I found the problem. I'm currently preparing a LLVM patch.

@phil-opp

This comment has been minimized.

Copy link
Contributor

phil-opp commented Jan 3, 2019

I submitted a patch upstream: https://reviews.llvm.org/D56275.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment