Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Native-dependent code for BSD Unix running on i386's, for GDB. |
b6ba6518 KB |
2 | Copyright 1988, 1989, 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, |
3 | 2001 Free Software Foundation, Inc. | |
c906108c | 4 | |
c5aa993b | 5 | This file is part of GDB. |
c906108c | 6 | |
c5aa993b JM |
7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
c906108c | 11 | |
c5aa993b JM |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
c906108c | 16 | |
c5aa993b JM |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
21 | |
22 | #include "defs.h" | |
23 | ||
c906108c SS |
24 | #include <machine/reg.h> |
25 | ||
26 | /* this table must line up with REGISTER_NAMES in tm-i386.h */ | |
27 | /* symbols like 'tEAX' come from <machine/reg.h> */ | |
c5aa993b | 28 | static int tregmap[] = |
c906108c SS |
29 | { |
30 | tEAX, tECX, tEDX, tEBX, | |
31 | tESP, tEBP, tESI, tEDI, | |
32 | tEIP, tEFLAGS, tCS, tSS | |
33 | }; | |
34 | ||
35 | #ifdef sEAX | |
c5aa993b | 36 | static int sregmap[] = |
c906108c SS |
37 | { |
38 | sEAX, sECX, sEDX, sEBX, | |
39 | sESP, sEBP, sESI, sEDI, | |
40 | sEIP, sEFLAGS, sCS, sSS | |
41 | }; | |
42 | #else /* No sEAX */ | |
43 | ||
44 | /* FreeBSD has decided to collapse the s* and t* symbols. So if the s* | |
45 | ones aren't around, use the t* ones for sregmap too. */ | |
46 | ||
c5aa993b | 47 | static int sregmap[] = |
c906108c SS |
48 | { |
49 | tEAX, tECX, tEDX, tEBX, | |
50 | tESP, tEBP, tESI, tEDI, | |
51 | tEIP, tEFLAGS, tCS, tSS | |
52 | }; | |
53 | #endif /* No sEAX */ | |
54 | ||
55 | /* blockend is the value of u.u_ar0, and points to the | |
56 | place where ES is stored. */ | |
57 | ||
58 | int | |
fba45db2 | 59 | i386_register_u_addr (int blockend, int regnum) |
c906108c SS |
60 | { |
61 | /* The following condition is a kludge to get at the proper register map | |
62 | depending upon the state of pcb_flag. | |
63 | The proper condition would be | |
64 | if (u.u_pcb.pcb_flag & FM_TRAP) | |
65 | but that would require a ptrace call here and wouldn't work | |
66 | for corefiles. */ | |
67 | ||
68 | if (blockend < 0x1fcc) | |
69 | return (blockend + 4 * tregmap[regnum]); | |
70 | else | |
71 | return (blockend + 4 * sregmap[regnum]); | |
72 | } |