* [PATCH]: Add support for page register in HC12 gdb
@ 2002-08-13 9:20 Stephane Carrez
2002-08-13 13:54 ` Andrew Cagney
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Carrez @ 2002-08-13 9:20 UTC (permalink / raw)
To: gdb-patches
[-- 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]: Add support for page register in HC12 gdb
2002-08-13 9:20 [PATCH]: Add support for page register in HC12 gdb Stephane Carrez
@ 2002-08-13 13:54 ` Andrew Cagney
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2002-08-13 13:54 UTC (permalink / raw)
To: Stephane Carrez; +Cc: gdb-patches
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.
Just FYI, register_raw_size() is no longer needed, you can now delete
that function. Same goes for register_byte(). In both cases the
default does the ``sensible'' thing :-)
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-08-13 20:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-13 9:20 [PATCH]: Add support for page register in HC12 gdb Stephane Carrez
2002-08-13 13:54 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox