aboutsummaryrefslogtreecommitdiff
path: root/gdb/config/m68k/tm-m68k.h
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-06-08 23:35:00 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-06-08 23:35:00 +0000
commite7ac0161ce22056a1cebe8b1a96946e5bca59cea (patch)
tree93bff659c57f2baf5e352ad1f480c469dba3fb96 /gdb/config/m68k/tm-m68k.h
parent45d8db87f0f9efa8b1edadc0022dc0b62a916105 (diff)
downloadgdb-e7ac0161ce22056a1cebe8b1a96946e5bca59cea.zip
gdb-e7ac0161ce22056a1cebe8b1a96946e5bca59cea.tar.gz
gdb-e7ac0161ce22056a1cebe8b1a96946e5bca59cea.tar.bz2
* Move config/m68k/tm-m68k.h (FRAME_FIND_SAVED_REGS) to
m68k-tdep.c (m68k_find_saved_regs). Don't duplicate code between 68881 and non-68881 cases. Check for a pair of movel instructions.
Diffstat (limited to 'gdb/config/m68k/tm-m68k.h')
-rw-r--r--gdb/config/m68k/tm-m68k.h118
1 files changed, 1 insertions, 117 deletions
diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h
index d58441a..7c39709 100644
--- a/gdb/config/m68k/tm-m68k.h
+++ b/gdb/config/m68k/tm-m68k.h
@@ -359,123 +359,7 @@ extern const struct ext_format ext_format_68881;
the address we return for it IS the sp for the next frame. */
#if !defined (FRAME_FIND_SAVED_REGS)
-#if defined (HAVE_68881)
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
-{ register int regnum; \
- register int regmask; \
- register CORE_ADDR next_addr; \
- register CORE_ADDR pc; \
- int nextinsn; \
- bzero (&frame_saved_regs, sizeof frame_saved_regs); \
- if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \
- && (frame_info)->pc <= (frame_info)->frame) \
- { next_addr = (frame_info)->frame; \
- pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\
- else \
- { pc = get_pc_function_start ((frame_info)->pc); \
- /* Verify we have a link a6 instruction next; \
- if not we lose. If we win, find the address above the saved \
- regs using the amount of storage from the link instruction. */\
- if (044016 == read_memory_integer (pc, 2)) \
- next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; \
- else if (047126 == read_memory_integer (pc, 2)) \
- next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; \
- else goto lose; \
- /* If have an addal #-n, sp next, adjust next_addr. */ \
- if ((0177777 & read_memory_integer (pc, 2)) == 0157774) \
- next_addr += read_memory_integer (pc += 2, 4), pc += 4; \
- } \
- /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */ \
- regmask = read_memory_integer (pc + 2, 2); \
- /* But before that can come an fmovem. Check for it. */ \
- nextinsn = 0xffff & read_memory_integer (pc, 2); \
- if (0xf227 == nextinsn \
- && (regmask & 0xff00) == 0xe000) \
- { pc += 4; /* Regmask's low bit is for register fp7, the first pushed */ \
- for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1) \
- if (regmask & 1) \
- (frame_saved_regs).regs[regnum] = (next_addr -= 12); \
- regmask = read_memory_integer (pc + 2, 2); } \
- if (0044327 == read_memory_integer (pc, 2)) \
- { pc += 4; /* Regmask's low bit is for register 0, the first written */ \
- for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) \
- if (regmask & 1) \
- (frame_saved_regs).regs[regnum] = (next_addr += 4) - 4; } \
- else if (0044347 == read_memory_integer (pc, 2)) \
- { pc += 4; /* Regmask's low bit is for register 15, the first pushed */ \
- for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \
- if (regmask & 1) \
- (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
- else if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2))) \
- { regnum = 0xf & read_memory_integer (pc, 2); pc += 2; \
- (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
- /* fmovemx to index of sp may follow. */ \
- regmask = read_memory_integer (pc + 2, 2); \
- nextinsn = 0xffff & read_memory_integer (pc, 2); \
- if (0xf236 == nextinsn \
- && (regmask & 0xff00) == 0xf000) \
- { pc += 10; /* Regmask's low bit is for register fp0, the first written */ \
- for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1) \
- if (regmask & 1) \
- (frame_saved_regs).regs[regnum] = (next_addr += 12) - 12; \
- regmask = read_memory_integer (pc + 2, 2); } \
- /* clrw -(sp); movw ccr,-(sp) may follow. */ \
- if (0x426742e7 == read_memory_integer (pc, 4)) \
- (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4); \
- lose: ; \
- (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8; \
- (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \
- (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4; \
-}
-#else /* no 68881. */
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
-{ register int regnum; \
- register int regmask; \
- register CORE_ADDR next_addr; \
- register CORE_ADDR pc; \
- bzero (&frame_saved_regs, sizeof frame_saved_regs); \
- if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 4 \
- && (frame_info)->pc <= (frame_info)->frame) \
- { next_addr = (frame_info)->frame; \
- pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4; }\
- else \
- { pc = get_pc_function_start ((frame_info)->pc); \
- /* Verify we have a link a6 instruction next; \
- if not we lose. If we win, find the address above the saved \
- regs using the amount of storage from the link instruction. */\
- if (044016 == read_memory_integer (pc, 2)) \
- next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; \
- else if (047126 == read_memory_integer (pc, 2)) \
- next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; \
- else goto lose; \
- /* If have an addal #-n, sp next, adjust next_addr. */ \
- if ((0177777 & read_memory_integer (pc, 2)) == 0157774) \
- next_addr += read_memory_integer (pc += 2, 4), pc += 4; \
- } \
- /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */ \
- regmask = read_memory_integer (pc + 2, 2); \
- if (0044327 == read_memory_integer (pc, 2)) \
- { pc += 4; /* Regmask's low bit is for register 0, the first written */ \
- for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) \
- if (regmask & 1) \
- (frame_saved_regs).regs[regnum] = (next_addr += 4) - 4; } \
- else if (0044347 == read_memory_integer (pc, 2)) \
- { pc += 4; /* Regmask's low bit is for register 15, the first pushed */ \
- for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \
- if (regmask & 1) \
- (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
- else if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2))) \
- { regnum = 0xf & read_memory_integer (pc, 2); pc += 2; \
- (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
- /* clrw -(sp); movw ccr,-(sp) may follow. */ \
- if (0x426742e7 == read_memory_integer (pc, 4)) \
- (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4); \
- lose: ; \
- (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8; \
- (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \
- (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4; \
-}
-#endif /* no 68881. */
+#define FRAME_FIND_SAVED_REGS(fi,fsr) m68k_find_saved_regs ((fi), &(fsr))
#endif /* no FIND_FRAME_SAVED_REGS. */