Home | History | Annotate | Download | only in include
History log of /src/sys/arch/m68k/include/mcontext.h
RevisionDateAuthorComments
 1.16  30-Nov-2024  christos Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.15  04-Nov-2024  christos Undo previous lwp.h change.
 1.14  03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.13  18-May-2024  thorpej branches: 1.13.2;
Clean up the <sys/ucontext.h> <-> <machine/mcontext.h> interface up
a little:
- Define _UC_MD_BIT* constants for the available machine-dependent bits,
and use those constants to define the machine-dependent bits as well
as the machine-independent bits that have machine-dependent values.
- Explicitly generate an error if _UC_TLSBASE, _UC_SETSTACK, or
_UC_CLRSTACK are not defined by <machine/mcontext.h>.
 1.12  04-Oct-2020  rin Add missing __{BEGIN,END}_DECLS in order to catch up with
sanitizer_linux_libcdep.cc rev 1.17:

http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc#rev1.17

Fix build with HAVE_GCC=9.
 1.11  07-Sep-2020  mrg pass a pointer conversion via uintptr_t *and* the desired type casts.
avoids new GCC 9 warnings with C++ code.
 1.10  15-Feb-2018  kamil 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>
 1.9  22-Nov-2011  joerg branches: 1.9.42;
Add TLS support for m68k.
 1.8  24-Feb-2011  joerg branches: 1.8.4;
Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.7  23-Feb-2011  joerg Fix ucontext32_t on AMD64. Add optional compile time assertions for
ucontext_t and ucontext32_t to ensure that they don't change.
Provide the constants for AMD64, ARM, i386, and M68K.
 1.6  28-Apr-2008  martin branches: 1.6.22; 1.6.28; 1.6.30;
Remove clause 3 and 4 from TNF licenses
 1.5  11-Dec-2005  christos branches: 1.5.74; 1.5.76; 1.5.78;
merge ktrace-lwp.
 1.4  08-Oct-2003  thorpej Add some accessor macros for the ucontext:
* _UC_MACHINE_PC() - access the program counter
* _UC_MACHINE_INTRV() - access the integer return value register
* _UC_MACHINE_SET_PC() - set the program counter (this requires
special handling on some platforms).
 1.3  22-Sep-2003  cl SA_SIGINFO support for m68k
 1.2  17-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1  10-Nov-2001  scw branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.7  10-Jan-2003  thorpej On second thought, make __mc_frame _KERNEL || __M68K_MCONTEXT_PRIVATE.
 1.1.2.6  10-Jan-2003  thorpej Expose the remainder of the frame/fpframe in the mcontext to userland
(and namespace-cleanse the member names in doing so).
 1.1.2.5  28-Dec-2001  nathanw Add a macro, _UC_MACHINE_SP(), to fetch the user stack pointer from
a ucontext_t.
 1.1.2.4  02-Dec-2001  scw Add a comment about the padding in mcontext_t, and simplify fpregs.
 1.1.2.3  25-Nov-2001  scw When restoring thread context, check the _UC_USER bit and DTRT when
checking frame format and fpu saved state.

The whole `full fpu state cannot be saved/restored from userland' needs
more thought.

XXX: _UC_USER really ought to be defined in <sys/ucontext.h> ...
 1.1.2.2  21-Nov-2001  scw Add an MD flag for uc_flags which indicates if the exception frame
area of m68k's mcontext_t structure has valid contents.

In cpu_getcontext(), set the flag for all frame formats >= FMT4 such
that cpu_setcontext() does The Right Thing with both user and kernel
saved contexts.

Make null FP frame detection work for the 68060's FPU, and ensure we
always do at least an fsave/frestore when saving/restoring FPU regs.

Both kernel and user-level get/set context calls pass all Nathan's
context tests now.
 1.1.2.1  10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.2.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1  03-Aug-2004  skrll Sync with HEAD
 1.5.78.1  16-May-2008  yamt sync with head.
 1.5.76.1  18-May-2008  yamt sync with head.
 1.5.74.1  02-Jun-2008  mjf Sync with HEAD.
 1.6.30.1  05-Mar-2011  bouyer Sync with HEAD
 1.6.28.1  06-Jun-2011  jruoho Sync with HEAD.
 1.6.22.1  05-Mar-2011  rmind sync with head
 1.8.4.1  17-Apr-2012  yamt sync with head
 1.9.42.3  21-Mar-2018  martin Pull up the following, requested by kamil in ticket #552:

external/gpl3/gcc{.old}/dist/libsanitizer/asan/asan_linux.cc 1.4
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-1.5
sys/arch/hppa/include/mcontext.h 1.10
sys/arch/ia64/include/mcontext.h 1.7

- Introduce _UC_MACHINE_FP(). _UC_MACHINE_FP() is a helper
macro to extract from mcontext a frame pointer.
- Add new tests in lib/libc/sys/t_ucontext:
* ucontext_sp (testing _UC_MACHINE_SP)
* ucontext_fp (testing _UC_MACHINE_FP)
* ucontext_pc (testing _UC_MACHINE_PC)
* ucontext_intrv (testing _UC_MACHINE_INTRV)

Add a dummy implementation of _UC_MACHINE_INTRV() for ia64.

Implement _UC_MACHINE_INTRV() for hppa.

Make the t_ucontext.c test more portable.

We now have _UC_MACHINE_FP.
 1.9.42.2  26-Feb-2018  snj revert ticket 552, which broke the build
 1.9.42.1  25-Feb-2018  snj 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>
 1.13.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed