gdb.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* i386/gdb.h - i386 specific definitions for the remote GDB stub */
  2. /*
  3. * Copyright (C) 2006 Lubomir Kundrak
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #ifndef GRUB_GDB_CPU_HEADER
  20. #define GRUB_GDB_CPU_HEADER 1
  21. #define GRUB_GDB_LAST_TRAP 31
  22. /* You may have to edit the bottom of machdep.S when adjusting
  23. GRUB_GDB_LAST_TRAP. */
  24. #define GRUB_MACHINE_NR_REGS 16
  25. #define EAX 0
  26. #define ECX 1
  27. #define EDX 2
  28. #define EBX 3
  29. #define ESP 4
  30. #define EBP 5
  31. #define ESI 6
  32. #define EDI 7
  33. #define EIP 8
  34. #define EFLAGS 9
  35. #define CS 10
  36. #define SS 11
  37. #define DS 12
  38. #define ES 13
  39. #define FS 14
  40. #define GS 15
  41. #define PC EIP
  42. #define FP EBP
  43. #define SP ESP
  44. #define PS EFLAGS
  45. #ifndef ASM_FILE
  46. #include <grub/gdb.h>
  47. #define GRUB_CPU_TRAP_GATE 15
  48. struct grub_cpu_interrupt_gate
  49. {
  50. grub_uint16_t offset_lo;
  51. grub_uint16_t selector;
  52. grub_uint8_t unused;
  53. grub_uint8_t gate;
  54. grub_uint16_t offset_hi;
  55. } GRUB_PACKED;
  56. struct grub_cpu_idt_descriptor
  57. {
  58. grub_uint16_t limit;
  59. grub_uint32_t base;
  60. } GRUB_PACKED;
  61. extern void (*grub_gdb_trapvec[]) (void);
  62. void grub_gdb_idtinit (void);
  63. void grub_gdb_idtrestore (void);
  64. void grub_gdb_trap (int trap_no) __attribute__ ((regparm(3)));
  65. #endif /* ! ASM */
  66. #endif /* ! GRUB_GDB_CPU_HEADER */