summaryrefslogtreecommitdiff
path: root/arch/riscv64/bits/signal.h
AgeCommit message (Collapse)AuthorLines
2024-02-29riscv: define REG_S1 and REG_S2Khem Raj-0/+2
These are used by applications to access members of mcontext, and are also defined by other libcs on linux.
2023-02-09fix wrong sigaction syscall ABI on mips*, or1k, microblaze, riscv64Rich Felker-1/+0
we wrongly defined a dummy SA_RESTORER flag on these archs, despite the kernel interface not actually having such a feature. on archs which lack SA_RESTORER, the kernel sigaction structure also lacks the restorer function pointer member, which means the signal mask appears at a different offset. the kernel was thereby interpreting the bits of the code address as part of the signal set to be masked while handling the signal. this patch removes the erroneous SA_RESTORER definitions from archs which do not have it, makes access to the member conditional on whether SA_RESTORER is defined for the arch, and removes the now-unused asm for the affected archs. because there are reportedly versions of qemu-user which also use the wrong ABI here, the old ksigaction struct size is preserved with an unused member at the end. this is harmless and mitigates the risk of such a bug turning into a buffer overflow onto the sigaction function's stack.
2020-12-06riscv64: fix inconsistent ucontext_t struct tagDrew DeVault-2/+2
ucontext.h depends on the internal struct tag name for namespacing reasons, and the intent was always for it to be consistent across archs anyway.
2020-02-04move riscv64 register index constants to signal.hRich Felker-0/+9
under _GNU_SOURCE for namespace cleanliness, analogous to other archs. the original placement in sys/reg.h seems not to have been motivated; such a header isn't even present on other implementations.
2019-10-02reintroduce riscv64 struct sigcontextRich Felker-6/+10
commit ab3eb89a8b83353cdaab12ed017a67a7730f90e9 removed it as part of correcting the mcontext_t definition, but there is still code using struct sigcontext and expecting the member names present in it, most notably libgcc_eh. almost all such usage is incorrect, but bring back struct sigcontext at least for now so as not to introduce regressions.
2019-09-29fix riscv64 signal.h namespace violations and ucontext API mismatchesRich Felker-26/+19
the top-level mcontext_t member names were namespace-violating in standards profiles before, and nested-level member names (some of them single-letter) were egregiously bad namespace impositions even in non-strict profiles. moreover, they mismatched those used in the public API first defined in glibc, breaking any code making use of them. unlike most archs, the public API used in glibc for riscv mcontext_t members was designed to be namespace-safe, so we can and should expose the members regardless of feature test macros. only the typedefs for greg_t, gregset_t, and fpregset_t need to be protected behind FTMs. the struct tags for mcontext_t and ucontext_t are also changed. for mcontext_t this is necessary to make the common definition across profiles namespace-safe. for ucontext_t, it's just a matter of matching the tag from the glibc-defined API. these changes are split off and expanded from a patch by Khem Raj.
2019-08-06fix risc64 conflict with kernel headersBaruch Siach-8/+8
Rename user registers struct definitions to avoid conflict with the asm/ptrace.h kernel header that defines the same structs. Use the __riscv_mc prefix as glibc does.
2019-06-14add riscv64 architecture supportRich Felker-0/+112
Author: Alex Suykov <alex.suykov@gmail.com> Author: Aric Belsito <lluixhi@gmail.com> Author: Drew DeVault <sir@cmpwn.com> Author: Michael Clark <mjc@sifive.com> Author: Michael Forney <mforney@mforney.org> Author: Stefan O'Rear <sorear2@gmail.com> This port has involved the work of many people over several years. I have tried to ensure that everyone with substantial contributions has been credited above; if any omissions are found they will be noted later in an update to the authors/contributors list in the COPYRIGHT file. The version committed here comes from the riscv/riscv-musl repo's commit 3fe7e2c75df78eef42dcdc352a55757729f451e2, with minor changes by me for issues found during final review: - a_ll/a_sc atomics are removed (according to the ISA spec, lr/sc are not safe to use in separate inline asm fragments) - a_cas[_p] is fixed to be a memory barrier - the call from the _start assembly into the C part of crt1/ldso is changed to allow for the possibility that the linker does not place them nearby each other. - DTP_OFFSET is defined correctly so that local-dynamic TLS works - reloc.h LDSO_ARCH logic is simplified and made explicit. - unused, non-functional crti/n asm files are removed. - an empty .sdata section is added to crt1 so that the __global_pointer reference is resolvable. - indentation style errors in some asm files are fixed.