146283Sdfr/* Native support for i386 running SVR4.
298944Sobrien   Copyright 1986, 1987, 1989, 1992, 1996, 1997, 1998
398944Sobrien   Free Software Foundation, Inc.
446283Sdfr   Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu), July 1988.
546283Sdfr
698944Sobrien   This file is part of GDB.
746283Sdfr
898944Sobrien   This program is free software; you can redistribute it and/or modify
998944Sobrien   it under the terms of the GNU General Public License as published by
1098944Sobrien   the Free Software Foundation; either version 2 of the License, or
1198944Sobrien   (at your option) any later version.
1246283Sdfr
1398944Sobrien   This program is distributed in the hope that it will be useful,
1498944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1598944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1698944Sobrien   GNU General Public License for more details.
1746283Sdfr
1898944Sobrien   You should have received a copy of the GNU General Public License
1998944Sobrien   along with this program; if not, write to the Free Software
2098944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
2198944Sobrien   Boston, MA 02111-1307, USA.  */
2246283Sdfr
23130803Smarcel#ifndef NM_I386V42MP_H
24130803Smarcel#define NM_I386V42MP_H
25130803Smarcel
26130803Smarcel#include "config/nm-sysv4.h"
27130803Smarcel
28130803Smarcel/* define to select for other sysv4.2mp weirdness (see procfs.c) */
29130803Smarcel
30130803Smarcel#define UNIXWARE
31130803Smarcel
32130803Smarcel#if 0
33130803Smarcel/* The following macros extract process and lwp/thread ids from a
34130803Smarcel   composite id.
35130803Smarcel
36130803Smarcel   For consistency with UnixWare core files, allocate bits 0-15 for
37130803Smarcel   process ids and bits 16 and up for lwp ids.  Reserve bit 31 for
38130803Smarcel   negative return values to indicate exceptions, and use bit 30 as a
39130803Smarcel   flag to indicate a user-mode thread, leaving 14 bits for lwp
40130803Smarcel   ids. */
41130803Smarcel
42130803Smarcel/* Number of bits in composite id allocated to process number. */
43130803Smarcel#define PIDBITS 16
44130803Smarcel
45130803Smarcel/* Return the process id stored in composite PID. */
46130803Smarcel#define PIDGET(PID)             (((PID) & ((1 << PIDBITS) - 1)))
47130803Smarcel
48130803Smarcel/* Return the thread or lwp id stored in composite PID. */
49130803Smarcel#define TIDGET(PID)             (((PID) & 0x3fffffff) >> PIDBITS)
50130803Smarcel#define LIDGET(PID)             TIDGET(PID)
51130803Smarcel
52130803Smarcel/* Construct a composite id from lwp LID and the process portion of
53130803Smarcel   composite PID. */
54130803Smarcel#define MERGEPID(PID, LID)      (PIDGET(PID) | ((LID) << PIDBITS))
55130803Smarcel#define MKLID(PID, LID)         MERGEPID(PID, LID)
56130803Smarcel
57130803Smarcel/* Construct a composite id from thread TID and the process portion of
58130803Smarcel   composite PID. */
59130803Smarcel#define MKTID(PID, TID)         (MERGEPID(PID, TID) | 0x40000000)
60130803Smarcel
61130803Smarcel/* Return whether PID contains a user-space thread id. */
62130803Smarcel#define ISTID(PID)              ((PID) & 0x40000000)
63130803Smarcel#endif
64130803Smarcel
65130803Smarcel/* New definitions of the ptid stuff.  Due to the way the
66130803Smarcel   code is structured in uw-thread.c, I'm overloading the thread id
67130803Smarcel   and lwp id onto the lwp field.  The tid field is used to indicate
68130803Smarcel   whether the lwp is a tid or not.
69130803Smarcel
70130803Smarcel   FIXME: Check that core file support is not broken.  (See original
71130803Smarcel   #if 0'd comments above.)
72130803Smarcel   FIXME: Restructure uw-thread.c so that the struct ptid fields
73130803Smarcel   can be used as intended. */
74130803Smarcel
75130803Smarcel/* Return the process id stored in composite PID. */
76130803Smarcel#define PIDGET(PID) (ptid_get_pid (PID))
77130803Smarcel
78130803Smarcel/* Return the thread or lwp id stored in composite PID. */
79130803Smarcel#define TIDGET(PID) (ptid_get_lwp (PID))
80130803Smarcel#define LIDGET(PID) TIDGET(PID)
81130803Smarcel
82130803Smarcel#define MERGEPID(PID, LID) (ptid_build ((PID), (LID), 0))
83130803Smarcel#define MKLID(PID, LID) (ptid_build ((PID), (LID), 0))
84130803Smarcel
85130803Smarcel/* Construct a composite id from thread TID and the process portion of
86130803Smarcel   composite PID. */
87130803Smarcel#define MKTID(PID, TID) (ptid_build ((PID), (TID), 1))
88130803Smarcel
89130803Smarcel/* Return whether PID contains a user-space thread id. */
90130803Smarcel#define ISTID(PID) (ptid_get_tid (PID))
91130803Smarcel
92130803Smarcel#endif /* NM_I386V42MP_H */
93