-
Couldn't load subscription status.
- Fork 10
Map errno to fixed values #119
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
Conversation
|
I understand the motivation, and it makes sense to me. I wonder if there was no previous discussions about this libc/errno mismatch between guest and host on the mailing list before? If not, we could consider sending the patch there, instead. Anyways, if we decide to move forward with this approach, not that we also have to map the values from the arm-compatible semihosting interface (see |
target/hexagon/hexswi.c
Outdated
|
|
||
| #ifndef CONFIG_USER_ONLY | ||
|
|
||
| enum { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reasoning behind the order below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
none, I just copied them in order they were defined in dinkumware
but yes we can fix that before merge, this PR was more of a proposal
https://github.com/qemu/qemu/blob/master/linux-user/generic/target_errno_defs.h for system mode, I can see MIPS and xtensa do this explicitly, I am not sure how others do this |
|
regarding qemu-hexagon should use |
Sorry, what I meant by "qemu-hexagon" is "the hexagon version of qemu". I should have said "qemu-system-hexagon" |
|
@quic-k why did you close this? |
|
@quic-akaryaki was trying to rebase, it closed automatically, I will reopen it |
Problem :
this is what happens currently
because the LIBC that compiles QEMU and the LIBC that is using semi-hosting are different, it is possible that we misinterpret the errno value
Example:
LIBC that compiles QEMU says :
LIBC that is using semi-hosting interface :
so if errno is set to EPERM by LIBC that compiles QEMU, it will be read as EACCES by the LIBC that is using the semi-hosting interface
Solution :
Map A->B in QEMU and then B->C in LIBC that is using semi-hosting
Here,
A : errno values in LIBC that compiles QEMU
B : fixed errno values defined by Hexagon semi-hosting spec
C : errno values in LIBC that is using semi-hosting interface
What happens when we do this mapping:
Note : The TARGET_HEX_* enum values are similar to errno macros in Dinkumware to ensure compatibility.
We can document these constants in Hexagon semihosting spec