Linux/LoongArch doesn't preserve temporary registers across syscalls,
so we have to explicitly mark them as clobbered to avoid trashing local variables.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_loongarch64.inc | ||
---|---|---|
25 | Only this part is needed. |
Comment Actions
Edited the patch summary for you so it's more concise. The code changes look good. Thanks!
Comment Actions
LGTM.
But I see the comments in this file:
// Kernel ABI... // syscall number is passed in a7 // (http://man7.org/linux/man-pages/man2/syscall.2.html) results are return in // a0 and a1 (http://man7.org/linux/man-pages/man2/syscall.2.html) arguments // are passed in: a0-a7 (confirmed by inspecting glibc sources).
// results are return in a0 and a1
Is this correct?
Upon return, `a0` contains the return value
Comment Actions
No. Another of my stupid errors, caused by copying from RISC-V without a close inspection.
Comment Actions
-// Kernel ABI... -// syscall number is passed in a7 -// (http://man7.org/linux/man-pages/man2/syscall.2.html) results are return in -// a0 and a1 (http://man7.org/linux/man-pages/man2/syscall.2.html) arguments -// are passed in: a0-a7 (confirmed by inspecting glibc sources). +// Kernel ABI: +// https://lore.kernel.org/loongarch/1f353678-3398-e30b-1c87-6edb278f74db@xen0n.name/T/#m1613bc86c2d7bf5f6da92bd62984302bfd699a2f +// syscall number is placed in a7 +// parameters, if present, are placed in a0-a6 +// upon return: +// the return value is placed in a0 +// t0-t8 should be considered clobbered +// all other registers are preserved
Is it possible to add this part into this diff? If not I'll create a new diff.
Comment Actions
ok, I will change the comment and submit again
compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_loongarch64.inc | ||
---|---|---|
25 | yes, you are right, the handle_syscall saved a0~a7 already |
Only this part is needed.