-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Get mips64(el)-linux
working and start testing it
#21095
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
This should be ready for review. |
dd9545f
to
cb069d3
Compare
The kernel sets r7 to 0 (success) or -1 (error), and stores the result in r2. When r7 is -1 and the result is positive, it needs to be negated to get the errno value that higher-level code, such as errnoFromSyscall(), expects to see. The old code was missing the check that r2 is positive, but was also doing the r7 check incorrectly; since it can only be set to 0 or -1, the blez instruction would always branch. In practice, this fix is necessary for e.g. the ENOSYS error to be interpreted correctly. This manifested as hitting an unreachable branch when calling process_vm_readv() in std.debug.MemoryAccessor.
It is usually generic, so no point having it in arch bits.
These take 3-4 minutes to run on my machine, i.e. they're not affected by the LLVM compilation speed bug that affects mips32.
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.
This doubles the amount of time CI runs take. Let's proceed and see if it is manageable.
If it's too much, perhaps one category of testing can be performed on master branch only, and then any breakage can be reverted.
\\ syscall | ||
\\ blez $7, 1f | ||
\\ beq $7, $zero, 1f | ||
\\ blez $2, 1f | ||
\\ dsubu $2, $0, $2 | ||
\\ 1: |
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.
The equivalent musl code for all these syscall functions has only one daddu
instruction followed by syscall
. Any reason we can't do that?
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.
The reason we don't have that is because musl mixes inline assembly and C logic: https://git.musl-libc.org/cgit/musl/tree/arch/mips64/syscall_arch.h#n38
We could of course do the same, but I thought I'd just keep things simple.
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.
it's not really related to C logic, it's just using C syntax to get values in and out of registers. Zig's constraint strings are powerful enough to do the same. You're already doing it with ={$2}
to get the value out. You can do the same thing with the input values.
register long r4 __asm__("$4") = a;
is just
: "[a] {$4}" (a),
in zig.
@andrewrk that's because the CI results here were from before #21125 was merged. The extreme slowdown observed for MIPS is specific to O32; N64 runs in a normal amount of time. |
I see, thank you for pointing that out. |
No description provided.