mem.h revision 1.1.1.1
1/* mem.h --- interface to memory for M32C simulator. 2 3Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011 4Free Software Foundation, Inc. 5Contributed by Red Hat, Inc. 6 7This file is part of the GNU simulators. 8 9This program is free software; you can redistribute it and/or modify 10it under the terms of the GNU General Public License as published by 11the Free Software Foundation; either version 3 of the License, or 12(at your option) any later version. 13 14This program is distributed in the hope that it will be useful, 15but WITHOUT ANY WARRANTY; without even the implied warranty of 16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17GNU General Public License for more details. 18 19You should have received a copy of the GNU General Public License 20along with this program. If not, see <http://www.gnu.org/licenses/>. */ 21 22enum mem_content_type { 23 MC_UNINIT, 24 MC_DATA, 25 MC_PUSHED_PC, 26 MC_NUM_TYPES 27}; 28 29enum mem_ptr_action 30{ 31 MPA_WRITING, 32 MPA_READING, 33 MPA_CONTENT_TYPE, 34 MPA_DECODE_CACHE 35}; 36 37void init_mem (void); 38void mem_usage_stats (void); 39unsigned long mem_usage_cycles (void); 40 41/* rx_mem_ptr returns a pointer which is valid as long as the address 42 requested remains within the same page. */ 43#define PAGE_BITS 12 44#define PAGE_SIZE (1 << PAGE_BITS) 45#define NONPAGE_MASK (~(PAGE_SIZE-1)) 46 47unsigned char *rx_mem_ptr (unsigned long address, enum mem_ptr_action action); 48#ifdef RXC_never 49RX_Opcode_Decoded **rx_mem_decode_cache (unsigned long address); 50#endif 51 52void mem_put_qi (int address, unsigned char value); 53void mem_put_hi (int address, unsigned short value); 54void mem_put_psi (int address, unsigned long value); 55void mem_put_si (int address, unsigned long value); 56 57void mem_put_blk (int address, void *bufptr, int nbytes); 58 59unsigned char mem_get_pc (int address); 60 61unsigned char mem_get_qi (int address); 62unsigned short mem_get_hi (int address); 63unsigned long mem_get_psi (int address); 64unsigned long mem_get_si (int address); 65 66void mem_get_blk (int address, void *bufptr, int nbytes); 67 68int sign_ext (int v, int bits); 69 70void mem_set_content_type (int address, enum mem_content_type type); 71void mem_set_content_range (int start_address, int end_address, enum mem_content_type type); 72enum mem_content_type mem_get_content_type (int address); 73