GDB (API)
|
00001 /* Native-dependent code for NetBSD/sparc. 00002 00003 Copyright (C) 2002-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 #include "defs.h" 00021 #include "regcache.h" 00022 #include "target.h" 00023 00024 #include "sparc-tdep.h" 00025 #include "sparc-nat.h" 00026 00027 /* Support for debugging kernel virtual memory images. */ 00028 00029 #include <sys/types.h> 00030 #include <machine/pcb.h> 00031 00032 #include "bsd-kvm.h" 00033 00034 static int 00035 sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) 00036 { 00037 /* The following is true for NetBSD 1.6.2: 00038 00039 The pcb contains %sp, %pc, %psr and %wim. From this information 00040 we reconstruct the register state as it would look when we just 00041 returned from cpu_switch(). */ 00042 00043 /* The stack pointer shouldn't be zero. */ 00044 if (pcb->pcb_sp == 0) 00045 return 0; 00046 00047 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp); 00048 regcache_raw_supply (regcache, SPARC_O7_REGNUM, &pcb->pcb_pc); 00049 regcache_raw_supply (regcache, SPARC32_PSR_REGNUM, &pcb->pcb_psr); 00050 regcache_raw_supply (regcache, SPARC32_WIM_REGNUM, &pcb->pcb_wim); 00051 regcache_raw_supply (regcache, SPARC32_PC_REGNUM, &pcb->pcb_pc); 00052 00053 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1); 00054 00055 return 1; 00056 } 00057 00058 00059 /* Provide a prototype to silence -Wmissing-prototypes. */ 00060 void _initialize_sparcnbsd_nat (void); 00061 00062 void 00063 _initialize_sparcnbsd_nat (void) 00064 { 00065 sparc_gregset = &sparc32nbsd_gregset; 00066 sparc_fpregset = &sparc32_bsd_fpregset; 00067 00068 /* We've got nothing to add to the generic SPARC target. */ 00069 add_target (sparc_target ()); 00070 00071 /* Support debugging kernel virtual memory images. */ 00072 bsd_kvm_add_target (sparc32nbsd_supply_pcb); 00073 }