amd64-netbsd-nat.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Native-dependent code for NetBSD/amd64.
  2. Copyright (C) 2003-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #include "defs.h"
  15. #include "target.h"
  16. #include "netbsd-nat.h"
  17. #include "amd64-tdep.h"
  18. #include "amd64-bsd-nat.h"
  19. #include "amd64-nat.h"
  20. /* Mapping between the general-purpose registers in NetBSD/amd64
  21. `struct reg' format and GDB's register cache layout for
  22. NetBSD/i386.
  23. Note that most (if not all) NetBSD/amd64 registers are 64-bit,
  24. while the NetBSD/i386 registers are all 32-bit, but since we're
  25. little-endian we get away with that. */
  26. /* From <machine/reg.h>. */
  27. static int amd64nbsd32_r_reg_offset[] =
  28. {
  29. 14 * 8, /* %eax */
  30. 3 * 8, /* %ecx */
  31. 2 * 8, /* %edx */
  32. 13 * 8, /* %ebx */
  33. 24 * 8, /* %esp */
  34. 12 * 8, /* %ebp */
  35. 1 * 8, /* %esi */
  36. 0 * 8, /* %edi */
  37. 21 * 8, /* %eip */
  38. 23 * 8, /* %eflags */
  39. 22 * 8, /* %cs */
  40. 25 * 8, /* %ss */
  41. 18 * 8, /* %ds */
  42. 17 * 8, /* %es */
  43. 16 * 8, /* %fs */
  44. 15 * 8 /* %gs */
  45. };
  46. static amd64_bsd_nat_target<nbsd_nat_target> the_amd64_nbsd_nat_target;
  47. void _initialize_amd64nbsd_nat ();
  48. void
  49. _initialize_amd64nbsd_nat ()
  50. {
  51. amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset;
  52. amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset);
  53. amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;
  54. add_inf_child_target (&the_amd64_nbsd_nat_target);
  55. }