/* cf_regdefs.c - necessary coldfire definition for skyeye debugger Copyright (C) 2003 Skyeye Develop Group for help please send mail to 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 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 */ /* * 12/16/2006 Michael.Kang */ #include "skyeye2gdb.h" #include "skyeye_types.h" #include "memory.h" #define CF_NUM_REGS 18 extern struct _memory_core memory_core; static int cf_register_raw_size(int x){ return 4; } static int cf_register_byte(int x){ return (4 * x); } static int cf_store_register(int rn, unsigned char * memory){ WORD val = frommem(memory); if(0 <= rn < 8) memory_core.d[rn] = val ; else if(8 <= rn < 16 ) memory_core.a[rn-8] = val ; else if(16 == rn) memory_core.sr = val; else if(17 == rn) memory_core.pc = val; else return -1; return 0; } static int cf_fetch_register(int rn, unsigned char * memory){ WORD regval; if(0 <= rn < 8) regval = memory_core.d[rn]; else if(8 <= rn < 16 ) regval = memory_core.a[rn-8]; else if(16 == rn) regval = memory_core.sr; else if(17 == rn) regval = memory_core.pc; else return -1; tomem (memory, regval); return 0; } static register_defs_t cf_reg_defs; /* * register coldfire register type to the array */ void init_cf_register_defs(void){ cf_reg_defs.register_raw_size = cf_register_raw_size; cf_reg_defs.register_bytes = CF_NUM_REGS * 4; cf_reg_defs.register_byte = cf_register_byte; cf_reg_defs.num_regs = CF_NUM_REGS; cf_reg_defs.max_register_raw_size = 4; register_reg_type(cf_reg_defs); }