1 /* Copyright (C) 1997-2022 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library. If not, see 16 <https://www.gnu.org/licenses/>. */ 17 18 /* System V/m68k ABI compliant context switching support. */ 19 20 #ifndef _SYS_UCONTEXT_H 21 #define _SYS_UCONTEXT_H 1 22 23 #include <features.h> 24 25 #include <bits/types/sigset_t.h> 26 #include <bits/types/stack_t.h> 27 28 29 /* Type for general register. */ 30 typedef int greg_t; 31 32 /* Number of general registers. */ 33 #define __NGREG 18 34 #ifdef __USE_MISC 35 # define NGREG __NGREG 36 #endif 37 38 /* Container for all general registers. */ 39 typedef greg_t gregset_t[__NGREG]; 40 41 #ifdef __USE_MISC 42 /* Number of each register is the `gregset_t' array. */ 43 enum 44 { 45 R_D0 = 0, 46 # define R_D0 R_D0 47 R_D1 = 1, 48 # define R_D1 R_D1 49 R_D2 = 2, 50 # define R_D2 R_D2 51 R_D3 = 3, 52 # define R_D3 R_D3 53 R_D4 = 4, 54 # define R_D4 R_D4 55 R_D5 = 5, 56 # define R_D5 R_D5 57 R_D6 = 6, 58 # define R_D6 R_D6 59 R_D7 = 7, 60 # define R_D7 R_D7 61 R_A0 = 8, 62 # define R_A0 R_A0 63 R_A1 = 9, 64 # define R_A1 R_A1 65 R_A2 = 10, 66 # define R_A2 R_A2 67 R_A3 = 11, 68 # define R_A3 R_A3 69 R_A4 = 12, 70 # define R_A4 R_A4 71 R_A5 = 13, 72 # define R_A5 R_A5 73 R_A6 = 14, 74 # define R_A6 R_A6 75 R_A7 = 15, 76 # define R_A7 R_A7 77 R_SP = 15, 78 # define R_SP R_SP 79 R_PC = 16, 80 # define R_PC R_PC 81 R_PS = 17 82 # define R_PS R_PS 83 }; 84 85 /* Structure to describe FPU registers. */ 86 typedef struct 87 { 88 int f_pcr; 89 int f_psr; 90 int f_fpiaddr; 91 int f_fpregs[8][3]; 92 } fpregset_t; 93 #endif 94 95 #ifdef __USE_MISC 96 # define __ctx(fld) fld 97 #else 98 # define __ctx(fld) __ ## fld 99 #endif 100 101 /* Context to describe whole processor state. */ 102 typedef struct 103 { 104 int __ctx(version); 105 gregset_t __ctx(gregs); 106 } mcontext_t; 107 108 #ifdef __USE_MISC 109 # define MCONTEXT_VERSION 1 110 #endif 111 112 /* Userlevel context. */ 113 typedef struct ucontext_t 114 { 115 unsigned long int __ctx(uc_flags); 116 struct ucontext_t *uc_link; 117 sigset_t uc_sigmask; 118 stack_t uc_stack; 119 mcontext_t uc_mcontext; 120 long int __glibc_reserved1[201]; 121 } ucontext_t; 122 123 #undef __ctx 124 125 #endif /* sys/ucontext.h */ 126