Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Stephane Carrez <stcarrez@nerim.fr>
To: gdb-patches@sources.redhat.com
Subject: [PATCH]: Add support for page register in HC12 gdb
Date: Tue, 13 Aug 2002 09:20:00 -0000	[thread overview]
Message-ID: <3D594DC2.3060201@nerim.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 510 bytes --]

Hi!

I've committed this patch on mainline to be able to read/write the 68HC12 page
register.  The patch also fixes register sizes since A, B and CCR are 8-bit wide
(but it doesn't matter very much...)

	Stephane

2002-08-13  Stephane Carrez  <stcarrez@nerim.fr>

	* m68hc11-tdep.c (HARD_PAGE_REGNUM): Define for 68HC12 page register.
	(M68HC11_LAST_HARD_REG, m68hc11_register_names): Update.
	(m68hc11_register_virtual_type): Return a 8-bit type for 8-bit
	registers.
	(m68hc11_register_raw_size): Likewise.


[-- Attachment #2: m68hc11-tdep.c.diffs --]
[-- Type: text/plain, Size: 2151 bytes --]

Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.25
diff -u -p -r1.25 m68hc11-tdep.c
--- m68hc11-tdep.c	13 Aug 2002 13:10:42 -0000	1.25
+++ m68hc11-tdep.c	13 Aug 2002 16:12:54 -0000
@@ -55,7 +55,14 @@ Foundation, Inc., 59 Temple Place - Suit
 #define HARD_A_REGNUM   5
 #define HARD_B_REGNUM   6
 #define HARD_CCR_REGNUM 7
-#define M68HC11_LAST_HARD_REG (HARD_CCR_REGNUM)
+
+/* 68HC12 page number register.
+   Note: to keep a compatibility with gcc register naming, we must
+   not have to rename FP and other soft registers.  The page register
+   is a real hard register and must therefore be counted by NUM_REGS.
+   For this it has the same number as Z register (which is not used).  */
+#define HARD_PAGE_REGNUM 8
+#define M68HC11_LAST_HARD_REG (HARD_PAGE_REGNUM)
 
 /* Z is replaced by X or Y by gcc during machine reorg.
    ??? There is no way to get it and even know whether
@@ -114,7 +121,7 @@ static char *
 m68hc11_register_names[] =
 {
   "x",    "d",    "y",    "sp",   "pc",   "a",    "b",
-  "ccr",  "z",    "frame","tmp",  "zs",   "xy",   0,
+  "ccr",  "page", "frame","tmp",  "zs",   "xy",   0,
   "d1",   "d2",   "d3",   "d4",   "d5",   "d6",   "d7",
   "d8",   "d9",   "d10",  "d11",  "d12",  "d13",  "d14",
   "d15",  "d16",  "d17",  "d18",  "d19",  "d20",  "d21",
@@ -891,7 +898,17 @@ m68hc11_call_dummy_address (void)
 static struct type *
 m68hc11_register_virtual_type (int reg_nr)
 {
-  return builtin_type_uint16;
+  switch (reg_nr)
+    {
+    case HARD_PAGE_REGNUM:
+    case HARD_A_REGNUM:
+    case HARD_B_REGNUM:
+    case HARD_CCR_REGNUM:
+      return builtin_type_uint8;
+
+    default:
+      return builtin_type_uint16;
+    }
 }
 
 static void
@@ -1014,7 +1031,17 @@ m68hc11_register_byte (int reg_nr)
 static int
 m68hc11_register_raw_size (int reg_nr)
 {
-  return M68HC11_REG_SIZE;
+  switch (reg_nr)
+    {
+    case HARD_PAGE_REGNUM:
+    case HARD_A_REGNUM:
+    case HARD_B_REGNUM:
+    case HARD_CCR_REGNUM:
+      return 1;
+
+    default:
+      return M68HC11_REG_SIZE;
+    }
 }
 
 static int

             reply	other threads:[~2002-08-13 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-13  9:20 Stephane Carrez [this message]
2002-08-13 13:54 ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D594DC2.3060201@nerim.fr \
    --to=stcarrez@nerim.fr \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox