summaryrefslogtreecommitdiff
path: root/arch/riscv64/pthread_arch.h
AgeCommit message (Collapse)AuthorLines
2020-08-27deduplicate __pthread_self thread pointer adjustment out of each archRich Felker-3/+3
the adjustment made is entirely a function of TLS_ABOVE_TP and TP_OFFSET. aside from avoiding repetition of the TP_OFFSET value and arithmetic, this change makes pthread_arch.h independent of the definition of struct __pthread from pthread_impl.h. this in turn will allow inclusion of pthread_arch.h to be moved to the top of pthread_impl.h so that it can influence the definition of the structure. previously, arch files were very inconsistent about the type used for the thread pointer. this change unifies the new __get_tp interface to always use uintptr_t, which is the most correct when performing arithmetic that may involve addresses outside the actual pointed-to object (due to TP_OFFSET).
2020-08-24deduplicate TP_ADJ logic out of each arch, replace with TP_OFFSETRich Felker-1/+0
the only part of TP_ADJ that was not uniquely determined by TLS_ABOVE_TP was the 0x7000 adjustment used mainly on mips and powerpc variants.
2019-09-29fix riscv64 signal.h namespace violations and ucontext API mismatchesRich Felker-1/+1
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-06-14add riscv64 architecture supportRich Felker-0/+14
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.