1 /* Native-dependent code for NetBSD/i386.
3 Copyright 2004, 2005 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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. */
27 #include "i386-tdep.h"
28 #include "i386bsd-nat.h"
30 /* Support for debugging kernel virtual memory images. */
32 #include <sys/types.h>
33 #include <machine/frame.h>
34 #include <machine/pcb.h>
39 i386nbsd_supply_pcb (struct regcache
*regcache
, struct pcb
*pcb
)
41 struct switchframe sf
;
43 /* The following is true for NetBSD 1.6.2:
45 The pcb contains %esp and %ebp at the point of the context switch
46 in cpu_switch(). At that point we have a stack frame as
47 described by `struct switchframe', which for NetBSD 1.6.2 has the
56 we reconstruct the register state as it would look when we just
57 returned from cpu_switch(). */
59 /* The stack pointer shouldn't be zero. */
60 if (pcb
->pcb_esp
== 0)
63 read_memory (pcb
->pcb_esp
, (gdb_byte
*)&sf
, sizeof sf
);
64 pcb
->pcb_esp
+= sizeof (struct switchframe
);
65 regcache_raw_supply (regcache
, I386_EDI_REGNUM
, &sf
.sf_edi
);
66 regcache_raw_supply (regcache
, I386_ESI_REGNUM
, &sf
.sf_esi
);
67 regcache_raw_supply (regcache
, I386_EBP_REGNUM
, &pcb
->pcb_ebp
);
68 regcache_raw_supply (regcache
, I386_ESP_REGNUM
, &pcb
->pcb_esp
);
69 regcache_raw_supply (regcache
, I386_EBX_REGNUM
, &sf
.sf_ebx
);
70 regcache_raw_supply (regcache
, I386_EIP_REGNUM
, &sf
.sf_eip
);
76 /* Provide a prototype to silence -Wmissing-prototypes. */
77 void _initialize_i386nbsd_nat (void);
80 _initialize_i386nbsd_nat (void)
82 /* We've got nothing to add to the common *BSD/i386 target. */
83 add_target (i386bsd_target ());
85 /* Support debugging kernel virtual memory images. */
86 bsd_kvm_add_target (i386nbsd_supply_pcb
);
This page took 0.030802 seconds and 4 git commands to generate.