From bc6e53a15ec74e9f1c9e54227a21064cb8565954 Mon Sep 17 00:00:00 2001 From: TC Wan Date: Thu, 2 Dec 2010 17:27:40 +0800 Subject: added instruction decode tables Work in Progress --- Debugger/debug_macros.h | 63 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 13 deletions(-) (limited to 'Debugger/debug_macros.h') diff --git a/Debugger/debug_macros.h b/Debugger/debug_macros.h index 44ded9d..416022e 100644 --- a/Debugger/debug_macros.h +++ b/Debugger/debug_macros.h @@ -16,7 +16,6 @@ #ifndef __DEBUG_MACROS_H__ #define __DEBUG_MACROS_H__ -#include "_c_arm_macros.h" /** @addtogroup debug_macros */ @@ -38,6 +37,43 @@ .endm +/* _dbg_thumbDecodeEntry + * Load Thumb Instruction Decoder Entry + * On entry: + * instrreg is the register to load the instruction into + * instrmask is the register to load the instruction mask into + * codehandler is the register to load the code handling routine into + * indexreg contains decode table index value + * NOTE: instrreg, instrmask, codehandler must be in increasing register number order + */ + .macro _dbg_thumbDecodeEntry instrreg, instrmask, codehandler, indexreg + + ldr \instrmask, =debug_thumbDecodeTable /* Temporary register */ + add \instrmask, \instrmask, \indexreg, lsl #3 + ldm \instrmask, {\instrreg, \codehandler} /* LSHW: IID, MSHW: IBM */ + mov \instrmask, \instrreg, lsr #16 + and \instrreg, \instrreg, #HLFWRD0 + .endm + +/* _dbg_armDecodeEntry + * Load ARM Instruction Decoder Entry + * On entry: + * instrreg is the register to load the instruction into + * instrmask is the register to load the instruction mask into + * codehandler is the register to load the code handling routine into + * indexreg contains decode table index value + * NOTE: instrreg, instrmask, codehandler must be in increasing register number order + */ + .macro _dbg_armDecodeEntry instrreg, instrmask, codehandler, indexreg + + ldr \instrmask, =debug_thumbDecodeTable /* Temporary register */ + add \instrmask, \instrmask, \indexreg, lsl #3 + add \instrmask, \instrmask, \indexreg, lsl #2 /* 12 byte entries */ + ldm \instrmask, {\instrreg, \instrmask, \codehandler} + .endm + + + /* _dbg_stpcpy * _dbg_stpcpy macro * On entry: @@ -120,19 +156,20 @@ bl byte2ascii /* R1 points to NULL character after the prefix */ .endm -/* _index2dbgstackaddr - * Convert debugger stack index to Debugger Stack register address +/* _getdbgregisterfromindex + * Retrieve register contents from debugger stack given index * - * On entry: - * indexreg contains debugger stack index value (0-max entries) - * On exit: - * indexreg: Breakpoint index (preserved) - * addrreg: Debugger Stack Register Address - */ - .macro _index2dbgstackaddr indexreg, addrreg - ldr \addrreg, =__debugger_stack_bottom__ - add \addrreg, \addrreg, \indexreg, lsl #2 /* Calculate Debugger Stack Register Address */ - .endm + * On entry: + * indexreg contains debugger stack index value (0-max entries) + * On exit: + * indexreg: Breakpoint index (preserved) + * contentsreg: Register Contents for given index + */ + .macro _getdbgregisterfromindex indexreg, contentsreg + ldr \contentsreg, =__debugger_stack_bottom__ + ldr \contentsreg, [\contentsreg, \indexreg, lsl #2] + .endm + /* _index2bkptindex_addr * Convert Breakpoint index to breakpoing entry address -- cgit v1.2.3