Module Name: src Committed By: snj Date: Sun Feb 25 23:50:24 UTC 2018
Modified Files: src/sys/arch/aarch64/include [netbsd-8]: mcontext.h src/sys/arch/alpha/include [netbsd-8]: mcontext.h src/sys/arch/amd64/include [netbsd-8]: mcontext.h src/sys/arch/arm/include [netbsd-8]: mcontext.h src/sys/arch/hppa/include [netbsd-8]: mcontext.h src/sys/arch/i386/include [netbsd-8]: mcontext.h src/sys/arch/ia64/include [netbsd-8]: mcontext.h src/sys/arch/m68k/include [netbsd-8]: mcontext.h src/sys/arch/mips/include [netbsd-8]: mcontext.h src/sys/arch/or1k/include [netbsd-8]: mcontext.h src/sys/arch/powerpc/include [netbsd-8]: mcontext.h src/sys/arch/riscv/include [netbsd-8]: mcontext.h src/sys/arch/sh3/include [netbsd-8]: mcontext.h src/sys/arch/sparc/include [netbsd-8]: mcontext.h src/sys/arch/sparc64/include [netbsd-8]: mcontext.h src/sys/arch/vax/include [netbsd-8]: mcontext.h src/tests/lib/libc/sys [netbsd-8]: Makefile t_ucontext.c Log Message: Pull up following revision(s) (requested by kamil in ticket #552): sys/arch/aarch64/include/mcontext.h: 1.2 sys/arch/alpha/include/mcontext.h: 1.9 sys/arch/amd64/include/mcontext.h: 1.19 sys/arch/arm/include/mcontext.h: 1.19 sys/arch/hppa/include/mcontext.h: 1.9 sys/arch/i386/include/mcontext.h: 1.14 sys/arch/ia64/include/mcontext.h: 1.6 sys/arch/m68k/include/mcontext.h: 1.10 sys/arch/mips/include/mcontext.h: 1.22 sys/arch/or1k/include/mcontext.h: 1.2 sys/arch/powerpc/include/mcontext.h: 1.18 sys/arch/riscv/include/mcontext.h: 1.5 sys/arch/sh3/include/mcontext.h: 1.11 sys/arch/sparc/include/mcontext.h: 1.14-1.17 sys/arch/sparc64/include/mcontext.h: 1.10 sys/arch/vax/include/mcontext.h: 1.9 tests/lib/libc/sys/Makefile: 1.50 tests/lib/libc/sys/t_ucontext.c: 1.2 Introduce _UC_MACHINE_FP() as a macro _UC_MACHINE_FP() is a helper macro to extract from mcontext a frame pointer. Don't rely on this interface as a compiler might strip frame pointer or optimize it making this interface unreliable. For hppa assume a small frame context, for larger frames FP might be located in a different register (4 instead of 3). For ia64 there is no strict frame pointer, and registers might rotate. Reuse 79 following: ./gcc/config/ia64/ia64.h:#define HARD_FRAME_POINTER_REGNUM LOC_REG (79) Once ia64 will mature, this should be revisited. A macro can encapsulate a real function for extracting Frame Pointer on more complex CPUs / ABIs. For the remaining CPUs, reuse standard register as defined in appropriate ABI. The direct users of this macro are LLVM and GCC with Sanitizers. Proposed on tech-userlevel@. Sponsored by <The NetBSD Foundation> -- Improve _UC_MACHINE_FP() for SPARC/SPARC64 Introduce a static inline function _uc_machine_fp() that contains improved caluclation of a frame pointer. Algorithm: uptr *stk_ptr; # if defined (__arch64__) stk_ptr = (uptr *) (*sp + 2047); # else stk_ptr = (uptr *) *sp; # endif *bp = stk_ptr[15]; Noted by <mrg> -- Make _UC_MACHINE_FP() compile again and fix it so that it does not add the offset twice. -- fix _UC_MACHINE32_FP() -- use 32 bit pointer value so that [15] is the right offset. do this by using __greg32_t, which is only in the sparc64 version, and these are only useful there, so move them. -- Add new tests in lib/libc/sys/t_ucontext New tests: - ucontext_sp - ucontext_fp - ucontext_pc - ucontext_intrv They test respectively: - _UC_MACHINE_SP - _UC_MACHINE_FP - _UC_MACHINE_PC - _UC_MACHINE_INTRV These tests attempt to access and print the values from ucontext, without interpreting the values. This is a follow up of the _UC_MACHINE_FP() introduction. These tests use PRIxREGISTER, and require to be built with -D_KERNTYPES. Sponsored by <The NetBSD Foundation> To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.1.22.1 src/sys/arch/aarch64/include/mcontext.h cvs rdiff -u -r1.8 -r1.8.32.1 src/sys/arch/alpha/include/mcontext.h cvs rdiff -u -r1.18 -r1.18.20.1 src/sys/arch/amd64/include/mcontext.h cvs rdiff -u -r1.18 -r1.18.10.1 src/sys/arch/arm/include/mcontext.h cvs rdiff -u -r1.8 -r1.8.22.1 src/sys/arch/hppa/include/mcontext.h cvs rdiff -u -r1.12 -r1.12.22.1 src/sys/arch/i386/include/mcontext.h cvs rdiff -u -r1.5 -r1.5.8.1 src/sys/arch/ia64/include/mcontext.h cvs rdiff -u -r1.9 -r1.9.42.1 src/sys/arch/m68k/include/mcontext.h cvs rdiff -u -r1.21 -r1.21.10.1 src/sys/arch/mips/include/mcontext.h cvs rdiff -u -r1.1 -r1.1.12.1 src/sys/arch/or1k/include/mcontext.h cvs rdiff -u -r1.17 -r1.17.12.1 src/sys/arch/powerpc/include/mcontext.h cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/arch/riscv/include/mcontext.h cvs rdiff -u -r1.10 -r1.10.32.1 src/sys/arch/sh3/include/mcontext.h cvs rdiff -u -r1.13 -r1.13.32.1 src/sys/arch/sparc/include/mcontext.h cvs rdiff -u -r1.9 -r1.9.32.1 src/sys/arch/sparc64/include/mcontext.h cvs rdiff -u -r1.8 -r1.8.40.1 src/sys/arch/vax/include/mcontext.h cvs rdiff -u -r1.49 -r1.49.4.1 src/tests/lib/libc/sys/Makefile cvs rdiff -u -r1.1 -r1.1.34.1 src/tests/lib/libc/sys/t_ucontext.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.