nm-i386v42mp.h revision 130803
1295041Sbr/* Native support for i386 running SVR4.
2295972Sbr   Copyright 1986, 1987, 1989, 1992, 1996, 1997, 1998
3295041Sbr   Free Software Foundation, Inc.
4295041Sbr   Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu), July 1988.
5295041Sbr
6295041Sbr   This file is part of GDB.
7295041Sbr
8295041Sbr   This program is free software; you can redistribute it and/or modify
9295041Sbr   it under the terms of the GNU General Public License as published by
10295041Sbr   the Free Software Foundation; either version 2 of the License, or
11295041Sbr   (at your option) any later version.
12295041Sbr
13295041Sbr   This program is distributed in the hope that it will be useful,
14295041Sbr   but WITHOUT ANY WARRANTY; without even the implied warranty of
15295041Sbr   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16295041Sbr   GNU General Public License for more details.
17295041Sbr
18295041Sbr   You should have received a copy of the GNU General Public License
19295041Sbr   along with this program; if not, write to the Free Software
20295041Sbr   Foundation, Inc., 59 Temple Place - Suite 330,
21295041Sbr   Boston, MA 02111-1307, USA.  */
22295041Sbr
23295041Sbr#ifndef NM_I386V42MP_H
24295041Sbr#define NM_I386V42MP_H
25295041Sbr
26295041Sbr#include "config/nm-sysv4.h"
27295041Sbr
28295041Sbr/* define to select for other sysv4.2mp weirdness (see procfs.c) */
29295041Sbr
30295041Sbr#define UNIXWARE
31295041Sbr
32295041Sbr#if 0
33295041Sbr/* The following macros extract process and lwp/thread ids from a
34295041Sbr   composite id.
35295041Sbr
36295041Sbr   For consistency with UnixWare core files, allocate bits 0-15 for
37295041Sbr   process ids and bits 16 and up for lwp ids.  Reserve bit 31 for
38295041Sbr   negative return values to indicate exceptions, and use bit 30 as a
39295041Sbr   flag to indicate a user-mode thread, leaving 14 bits for lwp
40295041Sbr   ids. */
41295041Sbr
42295041Sbr/* Number of bits in composite id allocated to process number. */
43295041Sbr#define PIDBITS 16
44295041Sbr
45295041Sbr/* Return the process id stored in composite PID. */
46295041Sbr#define PIDGET(PID)             (((PID) & ((1 << PIDBITS) - 1)))
47295041Sbr
48295041Sbr/* Return the thread or lwp id stored in composite PID. */
49295041Sbr#define TIDGET(PID)             (((PID) & 0x3fffffff) >> PIDBITS)
50295041Sbr#define LIDGET(PID)             TIDGET(PID)
51295041Sbr
52295041Sbr/* Construct a composite id from lwp LID and the process portion of
53295041Sbr   composite PID. */
54295041Sbr#define MERGEPID(PID, LID)      (PIDGET(PID) | ((LID) << PIDBITS))
55295041Sbr#define MKLID(PID, LID)         MERGEPID(PID, LID)
56295041Sbr
57295041Sbr/* Construct a composite id from thread TID and the process portion of
58295041Sbr   composite PID. */
59295041Sbr#define MKTID(PID, TID)         (MERGEPID(PID, TID) | 0x40000000)
60295041Sbr
61295041Sbr/* Return whether PID contains a user-space thread id. */
62295041Sbr#define ISTID(PID)              ((PID) & 0x40000000)
63295041Sbr#endif
64295041Sbr
65295041Sbr/* New definitions of the ptid stuff.  Due to the way the
66295041Sbr   code is structured in uw-thread.c, I'm overloading the thread id
67295041Sbr   and lwp id onto the lwp field.  The tid field is used to indicate
68295041Sbr   whether the lwp is a tid or not.
69295041Sbr
70295041Sbr   FIXME: Check that core file support is not broken.  (See original
71295041Sbr   #if 0'd comments above.)
72295041Sbr   FIXME: Restructure uw-thread.c so that the struct ptid fields
73295041Sbr   can be used as intended. */
74295041Sbr
75295041Sbr/* Return the process id stored in composite PID. */
76295041Sbr#define PIDGET(PID) (ptid_get_pid (PID))
77295041Sbr
78295041Sbr/* Return the thread or lwp id stored in composite PID. */
79295041Sbr#define TIDGET(PID) (ptid_get_lwp (PID))
80295041Sbr#define LIDGET(PID) TIDGET(PID)
81295041Sbr
82295041Sbr#define MERGEPID(PID, LID) (ptid_build ((PID), (LID), 0))
83295041Sbr#define MKLID(PID, LID) (ptid_build ((PID), (LID), 0))
84295041Sbr
85295041Sbr/* Construct a composite id from thread TID and the process portion of
86295041Sbr   composite PID. */
87295041Sbr#define MKTID(PID, TID) (ptid_build ((PID), (TID), 1))
88295041Sbr
89295041Sbr/* Return whether PID contains a user-space thread id. */
90295041Sbr#define ISTID(PID) (ptid_get_tid (PID))
91295041Sbr
92295972Sbr#endif /* NM_I386V42MP_H */
93295041Sbr