1 /* OBSOLETE /* Low level interface to ns532 running mach 3.0. */
2 /* OBSOLETE Copyright 1992, 1993, 1998, 2000, 2001 Free Software Foundation, Inc. */
4 /* OBSOLETE This file is part of GDB. */
6 /* OBSOLETE This program is free software; you can redistribute it and/or modify */
7 /* OBSOLETE it under the terms of the GNU General Public License as published by */
8 /* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
9 /* OBSOLETE (at your option) any later version. */
11 /* OBSOLETE This program is distributed in the hope that it will be useful, */
12 /* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* OBSOLETE GNU General Public License for more details. */
16 /* OBSOLETE You should have received a copy of the GNU General Public License */
17 /* OBSOLETE along with this program; if not, write to the Free Software */
18 /* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */
19 /* OBSOLETE Boston, MA 02111-1307, USA. */ */
21 /* OBSOLETE#include "defs.h" */
22 /* OBSOLETE#include "inferior.h" */
23 /* OBSOLETE#include "regcache.h" */
25 /* OBSOLETE#include <stdio.h> */
27 /* OBSOLETE#include <mach.h> */
28 /* OBSOLETE#include <mach/message.h> */
29 /* OBSOLETE#include <mach/exception.h> */
30 /* OBSOLETE#include <mach_error.h> */
32 /* OBSOLETE#define private static */
35 /* OBSOLETE/* Find offsets to thread states at compile time. */
36 /* OBSOLETE * If your compiler does not grok this, calculate offsets */
37 /* OBSOLETE * offsets yourself and use them (or get a compatible compiler :-) */
40 /* OBSOLETE#define REG_N_OFFSET(reg) (int)(&((struct ns532_combined_state *)0)->ts.reg) */
41 /* OBSOLETE#define REG_F_OFFSET(reg) (int)(&((struct ns532_combined_state *)0)->fs.reg) */
43 /* OBSOLETE/* at reg_offset[i] is the offset to the ns532_combined_state */
44 /* OBSOLETE * location where the gdb registers[i] is stored. */
47 /* OBSOLETEstatic int reg_offset[] = */
49 /* OBSOLETE REG_N_OFFSET (r0), REG_N_OFFSET (r1), REG_N_OFFSET (r2), REG_N_OFFSET (r3), */
50 /* OBSOLETE REG_N_OFFSET (r4), REG_N_OFFSET (r5), REG_N_OFFSET (r6), REG_N_OFFSET (r7), */
51 /* OBSOLETE REG_F_OFFSET (l0a), REG_F_OFFSET (l0b), REG_F_OFFSET (l2a), REG_F_OFFSET (l2b), */
52 /* OBSOLETE REG_F_OFFSET (l4a), REG_F_OFFSET (l4b), REG_F_OFFSET (l6a), REG_F_OFFSET (l6b), */
53 /* OBSOLETEREG_N_OFFSET (sp), REG_N_OFFSET (fp), REG_N_OFFSET (pc), REG_N_OFFSET (psr), */
54 /* OBSOLETE REG_F_OFFSET (fsr), */
55 /* OBSOLETE REG_F_OFFSET (l0a), REG_F_OFFSET (l1a), REG_F_OFFSET (l2a), REG_F_OFFSET (l3a), */
56 /* OBSOLETE REG_F_OFFSET (l4a), REG_F_OFFSET (l5a), REG_F_OFFSET (l6a), REG_F_OFFSET (l7a), */
59 /* OBSOLETE#define REG_ADDRESS(state,regnum) ((char *)(state)+reg_offset[regnum]) */
61 /* OBSOLETE/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM */
62 /* OBSOLETE * Caller knows that the regs handled in one transaction are of same size. */
64 /* OBSOLETE#define FETCH_REGS(state, regnum, count) \ */
65 /* OBSOLETE memcpy (®isters[REGISTER_BYTE (regnum)], \ */
66 /* OBSOLETE (char *)state+reg_offset[ regnum ], \ */
67 /* OBSOLETE count*REGISTER_SIZE) */
69 /* OBSOLETE/* Store COUNT contiguous registers to thread STATE starting from REGNUM */ */
70 /* OBSOLETE#define STORE_REGS(state, regnum, count) \ */
71 /* OBSOLETE memcpy ((char *)state+reg_offset[ regnum ], \ */
72 /* OBSOLETE ®isters[REGISTER_BYTE (regnum)], \ */
73 /* OBSOLETE count*REGISTER_SIZE) */
76 /* OBSOLETE * Fetch inferiors registers for gdb. */
77 /* OBSOLETE * REGNO specifies which (as gdb views it) register, -1 for all. */
81 /* OBSOLETEfetch_inferior_registers (int regno) */
83 /* OBSOLETE kern_return_t ret; */
84 /* OBSOLETE thread_state_data_t state; */
85 /* OBSOLETE unsigned int stateCnt = NS532_COMBINED_STATE_COUNT; */
86 /* OBSOLETE int index; */
88 /* OBSOLETE if (!MACH_PORT_VALID (current_thread)) */
89 /* OBSOLETE error ("fetch inferior registers: Invalid thread"); */
91 /* OBSOLETE if (must_suspend_thread) */
92 /* OBSOLETE setup_thread (current_thread, 1); */
94 /* OBSOLETE ret = thread_get_state (current_thread, */
95 /* OBSOLETE NS532_COMBINED_STATE, */
97 /* OBSOLETE &stateCnt); */
99 /* OBSOLETE if (ret != KERN_SUCCESS) */
100 /* OBSOLETE warning ("fetch_inferior_registers: %s ", */
101 /* OBSOLETE mach_error_string (ret)); */
103 /* OBSOLETE /* It may be more effective to store validate all of them, */
104 /* OBSOLETE * since we fetched them all anyway */
106 /* OBSOLETE else if (regno != -1) */
107 /* OBSOLETE supply_register (regno, (char *) state + reg_offset[regno]); */
111 /* OBSOLETE for (index = 0; index < NUM_REGS; index++) */
112 /* OBSOLETE supply_register (index, (char *) state + reg_offset[index]); */
115 /* OBSOLETE if (must_suspend_thread) */
116 /* OBSOLETE setup_thread (current_thread, 0); */
119 /* OBSOLETE/* Store our register values back into the inferior. */
120 /* OBSOLETE * If REGNO is -1, do this for all registers. */
121 /* OBSOLETE * Otherwise, REGNO specifies which register */
123 /* OBSOLETE * On mach3 all registers are always saved in one call. */
126 /* OBSOLETEstore_inferior_registers (int regno) */
128 /* OBSOLETE kern_return_t ret; */
129 /* OBSOLETE thread_state_data_t state; */
130 /* OBSOLETE unsigned int stateCnt = NS532_COMBINED_STATE_COUNT; */
131 /* OBSOLETE register int index; */
133 /* OBSOLETE if (!MACH_PORT_VALID (current_thread)) */
134 /* OBSOLETE error ("store inferior registers: Invalid thread"); */
136 /* OBSOLETE if (must_suspend_thread) */
137 /* OBSOLETE setup_thread (current_thread, 1); */
139 /* OBSOLETE /* Fetch the state of the current thread */ */
140 /* OBSOLETE ret = thread_get_state (current_thread, */
141 /* OBSOLETE NS532_COMBINED_STATE, */
142 /* OBSOLETE state, */
143 /* OBSOLETE &stateCnt); */
145 /* OBSOLETE if (ret != KERN_SUCCESS) */
147 /* OBSOLETE warning ("store_inferior_registers (get): %s", */
148 /* OBSOLETE mach_error_string (ret)); */
149 /* OBSOLETE if (must_suspend_thread) */
150 /* OBSOLETE setup_thread (current_thread, 0); */
151 /* OBSOLETE return; */
154 /* OBSOLETE /* move gdb's registers to thread's state */
156 /* OBSOLETE * Since we save all registers anyway, save the ones */
157 /* OBSOLETE * that gdb thinks are valid (e.g. ignore the regno */
158 /* OBSOLETE * parameter) */
161 /* OBSOLETE if (regno != -1) */
162 /* OBSOLETE STORE_REGS (state, regno, 1); */
166 /* OBSOLETE for (index = 0; index < NUM_REGS; index++) */
167 /* OBSOLETE STORE_REGS (state, index, 1); */
170 /* OBSOLETE /* Write gdb's current view of register to the thread */
172 /* OBSOLETE ret = thread_set_state (current_thread, */
173 /* OBSOLETE NS532_COMBINED_STATE, */
174 /* OBSOLETE state, */
175 /* OBSOLETE NS532_COMBINED_STATE_COUNT); */
177 /* OBSOLETE if (ret != KERN_SUCCESS) */
178 /* OBSOLETE warning ("store_inferior_registers (set): %s", */
179 /* OBSOLETE mach_error_string (ret)); */
181 /* OBSOLETE if (must_suspend_thread) */
182 /* OBSOLETE setup_thread (current_thread, 0); */
This page took 0.033098 seconds and 4 git commands to generate.