]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/m68hc11/sim-main.h
Updated copyright notices for most files.
[thirdparty/binutils-gdb.git] / sim / m68hc11 / sim-main.h
index c8933a0791f13d7e02543063f1665f96ba4938ec..bd6d3110729e824ae329784d4045dc18bbe51489 100644 (file)
@@ -1,22 +1,22 @@
 /* sim-main.h -- Simulator for Motorola 68HC11 & 68HC12
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2007, 2008
+   Free Software Foundation, Inc.
    Written by Stephane Carrez (stcarrez@nerim.fr)
 
 This file is part of GDB, the GNU debugger.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _SIM_MAIN_H
 #define _SIM_MAIN_H
@@ -79,8 +79,8 @@ enum cpu_type
 #define A_REGNUM        5
 #define B_REGNUM        6
 #define PSW_REGNUM     7
-#define Z_REGNUM        8
-#define PAGE_REGNUM     9
+#define PAGE_REGNUM     8
+#define Z_REGNUM        9
 
 typedef struct m6811_regs {
     unsigned short      d;
@@ -108,6 +108,8 @@ extern void print_io_reg_desc (SIM_DESC sd, io_reg_desc *desc, int val,
                               int mode);
 extern void print_io_byte (SIM_DESC sd, const char *name,
                           io_reg_desc *desc, uint8 val, uint16 addr);
+extern void print_io_word (SIM_DESC sd, const char *name,
+                          io_reg_desc *desc, uint16 val, uint16 addr);
 
 
 /* List of special 68HC11&68HC12 instructions that are not handled by the
@@ -198,6 +200,7 @@ struct _sim_cpu {
 
   /* The mode in which the CPU is configured (MODA and MODB pins).  */
   unsigned int          cpu_mode;
+  const char*           cpu_start_mode;
 
   /* The cpu being configured.  */
   enum cpu_type         cpu_type;
@@ -208,6 +211,14 @@ struct _sim_cpu {
   
   uint8                 ios[MAX_PORTS];
 
+  /* Memory bank parameters which describe how the memory bank window
+     is mapped in memory and how to convert it in virtual address.  */
+  uint16                bank_start;
+  uint16                bank_end;
+  address_word          bank_virtual;
+  unsigned              bank_shift;
+  
+
   struct hw            *hw_cpu;
 
   /* ... base type ... */
@@ -235,7 +246,7 @@ struct _sim_cpu {
 #define cpu_get_sp(PROC)           ((PROC)->cpu_regs.sp)
 #define cpu_get_a(PROC)            ((PROC->cpu_regs.d >> 8) & 0x0FF)
 #define cpu_get_b(PROC)            ((PROC->cpu_regs.d) & 0x0FF)
-#define cpu_get_page(PROC)         (PROC->cpu_regs.page)
+#define cpu_get_page(PROC)         ((PROC)->cpu_regs.page)
 
 /* 68HC12 specific and Motorola internal registers.  */
 #define cpu_get_tmp3(PROC)         (0)
@@ -244,7 +255,7 @@ struct _sim_cpu {
 #define cpu_set_d(PROC,VAL)        (((PROC)->cpu_regs.d) = (VAL))
 #define cpu_set_x(PROC,VAL)        (((PROC)->cpu_regs.ix) = (VAL))
 #define cpu_set_y(PROC,VAL)        (((PROC)->cpu_regs.iy) = (VAL))
-#define cpu_set_page(PROC,VAL)     ((PROC->cpu_regs.page) = (VAL))
+#define cpu_set_page(PROC,VAL)     (((PROC)->cpu_regs.page) = (VAL))
 
 /* 68HC12 specific and Motorola internal registers.  */
 #define cpu_set_tmp3(PROC,VAL)     (0)
@@ -295,9 +306,10 @@ extern void cpu_memory_exception (struct _sim_cpu *proc,
 inline address_word
 phys_to_virt (sim_cpu *cpu, address_word addr)
 {
-  if (addr >= 0x8000 && addr < 0xc000)
-    return ((address_word) (addr) - 0x8000)
-      + (((address_word) cpu->cpu_regs.page) << 14) + 0x01000000;
+  if (addr >= cpu->bank_start && addr < cpu->bank_end)
+    return ((address_word) (addr - cpu->bank_start)
+            + (((address_word) cpu->cpu_regs.page) << cpu->bank_shift)
+            + cpu->bank_virtual);
   else
     return (address_word) (addr);
 }
@@ -580,7 +592,9 @@ extern void sim_set_profile (int n);
 extern void sim_set_profile_size (int n);
 extern void sim_board_reset (SIM_DESC sd);
 
-extern const char *cycle_to_string (sim_cpu *cpu, signed64 t);
+#define PRINT_TIME  0x01
+#define PRINT_CYCLE 0x02
+extern const char *cycle_to_string (sim_cpu *cpu, signed64 t, int flags);
 
 #endif