Commit | Line | Data |
---|---|---|
6d685882 JG |
1 | /* 386BSD host interface. |
2 | Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | #include "defs.h" | |
21 | ||
22 | #include <machine/reg.h> | |
23 | ||
24 | \f | |
25 | /* this table must line up with REGISTER_NAMES in tm-i386.h */ | |
26 | /* symbols like 'tEAX' come from <machine/reg.h> */ | |
27 | static int tregmap[] = | |
28 | { | |
29 | tEAX, tECX, tEDX, tEBX, | |
30 | tESP, tEBP, tESI, tEDI, | |
31 | tEIP, tEFLAGS, tCS, tSS | |
32 | }; | |
33 | static int sregmap[] = | |
34 | { | |
35 | sEAX, sECX, sEDX, sEBX, | |
36 | sESP, sEBP, sESI, sEDI, | |
37 | sEIP, sEFLAGS, sCS, sSS | |
38 | }; | |
39 | ||
40 | /* blockend is the value of u.u_ar0, and points to the | |
41 | place where ES is stored. */ | |
42 | ||
43 | int | |
44 | i386_register_u_addr (blockend, regnum) | |
45 | int blockend; | |
46 | int regnum; | |
47 | { | |
48 | /* The following condition is a kludge to get at the proper register map | |
49 | depending upon the state of pcb_flag. | |
50 | The proper condition would be | |
51 | if (u.u_pcb.pcb_flag & FM_TRAP) | |
52 | but that would require a ptrace call here and wouldn't work | |
53 | for corefiles. */ | |
54 | ||
55 | if (blockend < 0x1fcc) | |
56 | return (blockend + 4 * tregmap[regnum]); | |
57 | else | |
58 | return (blockend + 4 * sregmap[regnum]); | |
59 | } |