--- trunk/src/include/cpu_avr.h 2007/10/08 16:19:23 20 +++ trunk/src/include/cpu_avr.h 2007/10/08 16:19:37 22 @@ -2,7 +2,7 @@ #define CPU_AVR_H /* - * Copyright (C) 2005 Anders Gavare. All rights reserved. + * Copyright (C) 2005-2006 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * - * $Id: cpu_avr.h,v 1.10 2005/11/16 21:15:19 debug Exp $ + * $Id: cpu_avr.h,v 1.14 2006/02/09 22:40:27 debug Exp $ */ #include "misc.h" @@ -38,7 +38,7 @@ #define N_AVR_REGS 32 -#define AVR_N_IC_ARGS 2 +#define AVR_N_IC_ARGS 3 #define AVR_INSTR_ALIGNMENT_SHIFT 1 #define AVR_IC_ENTRIES_SHIFT 11 #define AVR_IC_ENTRIES_PER_PAGE (1 << AVR_IC_ENTRIES_SHIFT) @@ -47,31 +47,9 @@ #define AVR_ADDR_TO_PAGENR(a) ((a) >> (AVR_IC_ENTRIES_SHIFT \ + AVR_INSTR_ALIGNMENT_SHIFT)) -struct avr_instr_call { - void (*f)(struct cpu *, struct avr_instr_call *); - int len; - size_t arg[AVR_N_IC_ARGS]; -}; - -/* Translation cache struct for each physical page: */ -struct avr_tc_physpage { - struct avr_instr_call ics[AVR_IC_ENTRIES_PER_PAGE + 1]; - uint32_t next_ofs; /* or 0 for end of chain */ - uint32_t physaddr; - int flags; -}; - - -#define AVR_N_VPH_ENTRIES 1048576 +DYNTRANS_MISC_DECLARATIONS(avr,AVR,uint64_t) -#define AVR_MAX_VPH_TLB_ENTRIES 256 -struct avr_vpg_tlb_entry { - unsigned char valid; - unsigned char writeflag; - uint32_t vaddr_page; - uint32_t paddr_page; - unsigned char *host_page; -}; +#define AVR_MAX_VPH_TLB_ENTRIES 128 #define SREG_NAMES "cznvshti" @@ -109,33 +87,15 @@ /* * Instruction translation cache: */ - - /* cur_ic_page is a pointer to an array of AVR_IC_ENTRIES_PER_PAGE - instruction call entries. next_ic points to the next such - call to be executed. */ - struct avr_tc_physpage *cur_physpage; - struct avr_instr_call *cur_ic_page; - struct avr_instr_call *next_ic; - - void (*combination_check)(struct cpu *, - struct avr_instr_call *, int low_addr); + DYNTRANS_ITC(avr) /* - * Virtual -> physical -> host address translation: + * 32-bit virtual -> physical -> host address translation: * - * host_load and host_store point to arrays of AVR_N_VPH_ENTRIES - * pointers (to host pages); phys_addr points to an array of - * AVR_N_VPH_ENTRIES uint32_t. + * (All 32 bits are not really needed on AVRs.) */ - - struct avr_vpg_tlb_entry vph_tlb_entry[AVR_MAX_VPH_TLB_ENTRIES]; - unsigned char *host_load[AVR_N_VPH_ENTRIES]; - unsigned char *host_store[AVR_N_VPH_ENTRIES]; - uint32_t phys_addr[AVR_N_VPH_ENTRIES]; - struct avr_tc_physpage *phys_page[AVR_N_VPH_ENTRIES]; - - uint32_t phystranslation[AVR_N_VPH_ENTRIES/32]; - uint8_t vaddr_to_tlbindex[AVR_N_VPH_ENTRIES]; + VPH_TLBS(avr,AVR) + VPH32(avr,AVR,uint32_t,uint8_t) };