mem.h 2.3 KB

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