1 /* Native support for i386 running SVR4. 2 Copyright 1986, 1987, 1989, 1992, 1996, 1997, 1998 3 Free Software Foundation, Inc. 4 Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu), July 1988. 5 6 This file is part of GDB. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place - Suite 330, 21 Boston, MA 02111-1307, USA. */ 22 23 #ifndef NM_I386V42MP_H 24 #define NM_I386V42MP_H 25 26 #include "config/nm-sysv4.h" 27 28 /* define to select for other sysv4.2mp weirdness (see procfs.c) */ 29 30 #define UNIXWARE 31 32 #if 0 33 /* The following macros extract process and lwp/thread ids from a 34 composite id. 35 36 For consistency with UnixWare core files, allocate bits 0-15 for 37 process ids and bits 16 and up for lwp ids. Reserve bit 31 for 38 negative return values to indicate exceptions, and use bit 30 as a 39 flag to indicate a user-mode thread, leaving 14 bits for lwp 40 ids. */ 41 42 /* Number of bits in composite id allocated to process number. */ 43 #define PIDBITS 16 44 45 /* Return the process id stored in composite PID. */ 46 #define PIDGET(PID) (((PID) & ((1 << PIDBITS) - 1))) 47 48 /* Return the thread or lwp id stored in composite PID. */ 49 #define TIDGET(PID) (((PID) & 0x3fffffff) >> PIDBITS) 50 #define LIDGET(PID) TIDGET(PID) 51 52 /* Construct a composite id from lwp LID and the process portion of 53 composite PID. */ 54 #define MERGEPID(PID, LID) (PIDGET(PID) | ((LID) << PIDBITS)) 55 #define MKLID(PID, LID) MERGEPID(PID, LID) 56 57 /* Construct a composite id from thread TID and the process portion of 58 composite PID. */ 59 #define MKTID(PID, TID) (MERGEPID(PID, TID) | 0x40000000) 60 61 /* Return whether PID contains a user-space thread id. */ 62 #define ISTID(PID) ((PID) & 0x40000000) 63 #endif 64 65 /* New definitions of the ptid stuff. Due to the way the 66 code is structured in uw-thread.c, I'm overloading the thread id 67 and lwp id onto the lwp field. The tid field is used to indicate 68 whether the lwp is a tid or not. 69 70 FIXME: Check that core file support is not broken. (See original 71 #if 0'd comments above.) 72 FIXME: Restructure uw-thread.c so that the struct ptid fields 73 can be used as intended. */ 74 75 /* Return the process id stored in composite PID. */ 76 #define PIDGET(PID) (ptid_get_pid (PID)) 77 78 /* Return the thread or lwp id stored in composite PID. */ 79 #define TIDGET(PID) (ptid_get_lwp (PID)) 80 #define LIDGET(PID) TIDGET(PID) 81 82 #define MERGEPID(PID, LID) (ptid_build ((PID), (LID), 0)) 83 #define MKLID(PID, LID) (ptid_build ((PID), (LID), 0)) 84 85 /* Construct a composite id from thread TID and the process portion of 86 composite PID. */ 87 #define MKTID(PID, TID) (ptid_build ((PID), (TID), 1)) 88 89 /* Return whether PID contains a user-space thread id. */ 90 #define ISTID(PID) (ptid_get_tid (PID)) 91 92 /* This is the amount to subtract from u.u_ar0 93 to get the offset in the core file of the register values. */ 94 #define KERNEL_U_ADDR 0xe0000000 95 96 #endif /* NM_I386V42MP_H */ 97