Commit | Line | Data |
---|---|---|
b8a9943d DE |
1 | /* m32rx simulator support code |
2 | Copyright (C) 1997, 1998 Free Software Foundation, Inc. | |
3 | Contributed by Cygnus Support. | |
4 | ||
5 | This file is part of GDB, the GNU debugger. | |
6 | ||
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, or (at your option) | |
10 | any later version. | |
11 | ||
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. | |
16 | ||
17 | You should have received a copy of the GNU General Public License along | |
18 | with this program; if not, write to the Free Software Foundation, Inc., | |
19 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #define WANT_CPU | |
22 | #define WANT_CPU_M32RX | |
23 | ||
24 | #include "sim-main.h" | |
25 | #include <signal.h> | |
26 | #include "libiberty.h" | |
27 | #include "bfd.h" | |
28 | /* FIXME: need to provide general mechanism for accessing target files | |
29 | these. For now this is a hack to avoid getting the host version. */ | |
30 | #include "../../libgloss/m32r/sys/syscall.h" | |
31 | #include "targ-vals.h" | |
32 | \f | |
33 | /* The contents of BUF are in target byte order. */ | |
34 | ||
35 | void | |
36 | m32rx_fetch_register (sd, rn, buf) | |
37 | SIM_DESC sd; | |
38 | int rn; | |
39 | unsigned char *buf; | |
40 | { | |
41 | SIM_CPU *current_cpu = STATE_CPU (sd, 0); | |
42 | ||
43 | if (rn < 16) | |
44 | SETTWI (buf, GET_H_GR (rn)); | |
45 | else if (rn < 21) | |
46 | SETTWI (buf, GET_H_CR (rn - 16)); | |
47 | else switch (rn) { | |
48 | case PC_REGNUM: | |
49 | SETTWI (buf, GET_H_PC ()); | |
50 | break; | |
51 | case ACCL_REGNUM: | |
52 | SETTWI (buf, GETLODI (GET_H_ACCUM ())); | |
53 | break; | |
54 | case ACCH_REGNUM: | |
55 | SETTWI (buf, GETHIDI (GET_H_ACCUM ())); | |
56 | break; | |
57 | #if 0 | |
58 | case 23: *reg = STATE_CPU_CPU (sd, 0)->h_cond; break; | |
59 | case 24: *reg = STATE_CPU_CPU (sd, 0)->h_sm; break; | |
60 | case 25: *reg = STATE_CPU_CPU (sd, 0)->h_bsm; break; | |
61 | case 26: *reg = STATE_CPU_CPU (sd, 0)->h_ie; break; | |
62 | case 27: *reg = STATE_CPU_CPU (sd, 0)->h_bie; break; | |
63 | case 28: *reg = STATE_CPU_CPU (sd, 0)->h_bcarry; break; /* rename: bc */ | |
64 | case 29: memcpy (buf, &STATE_CPU_CPU (sd, 0)->h_bpc, sizeof(WI)); break; /* duplicate */ | |
65 | #endif | |
66 | default: abort (); | |
67 | } | |
68 | } | |
69 | ||
70 | /* The contents of BUF are in target byte order. */ | |
71 | ||
72 | void | |
73 | m32rx_store_register (sd, rn, buf) | |
74 | SIM_DESC sd; | |
75 | int rn; | |
76 | unsigned char *buf; | |
77 | { | |
78 | SIM_CPU *current_cpu = STATE_CPU (sd, 0); | |
79 | ||
80 | if (rn < 16) | |
81 | SET_H_GR (rn, GETTWI (buf)); | |
82 | else if (rn < 21) | |
83 | SET_H_CR (rn - 16, GETTWI (buf)); | |
84 | else switch (rn) { | |
85 | case PC_REGNUM: | |
86 | SET_H_PC (GETTWI (buf)); | |
87 | break; | |
88 | case ACCL_REGNUM: | |
89 | SETLODI (CPU (h_accum), GETTWI (buf)); | |
90 | break; | |
91 | case ACCH_REGNUM: | |
92 | SETHIDI (CPU (h_accum), GETTWI (buf)); | |
93 | break; | |
94 | #if 0 | |
95 | case 23: STATE_CPU_CPU (sd, 0)->h_cond = *reg; break; | |
96 | case 24: STATE_CPU_CPU (sd, 0)->h_sm = *reg; break; | |
97 | case 25: STATE_CPU_CPU (sd, 0)->h_bsm = *reg; break; | |
98 | case 26: STATE_CPU_CPU (sd, 0)->h_ie = *reg; break; | |
99 | case 27: STATE_CPU_CPU (sd, 0)->h_bie = *reg; break; | |
100 | case 28: STATE_CPU_CPU (sd, 0)->h_bcarry = *reg; break; /* rename: bc */ | |
101 | case 29: memcpy (&STATE_CPU_CPU (sd, 0)->h_bpc, buf, sizeof(DI)); break; /* duplicate */ | |
102 | #endif | |
103 | } | |
104 | } | |
105 | ||
106 | /* Cover fn to access h-accums. */ | |
107 | ||
108 | UDI | |
109 | m32rx_h_accums_get (SIM_CPU *current_cpu, UINT accum) | |
110 | { | |
111 | return 0; | |
112 | } |