home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / GDB / GDB-4.13 / GDB-4 / gdb-4.13 / gdb / i386b-nat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-07  |  2.0 KB  |  72 lines

  1. /* Native-dependent code for BSD Unix running on i386's, for GDB.
  2.    Copyright 1988, 1989, 1991, 1992 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. #include <machine/reg.h>
  22.  
  23. /* this table must line up with REGISTER_NAMES in tm-i386.h */
  24. /* symbols like 'tEAX' come from <machine/reg.h> */
  25. static int tregmap[] = 
  26. {
  27.   tEAX, tECX, tEDX, tEBX,
  28.   tESP, tEBP, tESI, tEDI,
  29.   tEIP, tEFLAGS, tCS, tSS
  30. };
  31.  
  32. #ifdef sEAX
  33. static int sregmap[] = 
  34. {
  35.   sEAX, sECX, sEDX, sEBX,
  36.   sESP, sEBP, sESI, sEDI,
  37.   sEIP, sEFLAGS, sCS, sSS
  38. };
  39. #else /* No sEAX */
  40.  
  41. /* NetBSD has decided to collapse the s* and t* symbols.  So if the s*
  42.    ones aren't around, use the t* ones for sregmap too.  */
  43.  
  44. static int sregmap[] = 
  45. {
  46.   tEAX, tECX, tEDX, tEBX,
  47.   tESP, tEBP, tESI, tEDI,
  48.   tEIP, tEFLAGS, tCS, tSS
  49. };
  50. #endif /* No sEAX */
  51.  
  52. /* blockend is the value of u.u_ar0, and points to the
  53.    place where ES is stored.  */
  54.  
  55. int
  56. i386_register_u_addr (blockend, regnum)
  57.      int blockend;
  58.      int regnum;
  59. {
  60.   /* The following condition is a kludge to get at the proper register map
  61.      depending upon the state of pcb_flag.
  62.      The proper condition would be
  63.      if (u.u_pcb.pcb_flag & FM_TRAP)
  64.      but that would require a ptrace call here and wouldn't work
  65.      for corefiles.  */
  66.  
  67.   if (blockend < 0x1fcc)
  68.     return (blockend + 4 * tregmap[regnum]);
  69.   else
  70.     return (blockend + 4 * sregmap[regnum]);
  71. }
  72.