home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gdb-4.16-base.tgz / gdb-4.16-base.tar / fsf / gdb / sim / ppc / vm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-21  |  3.1 KB  |  147 lines

  1. /*  This file is part of the program psim.
  2.  
  3.     Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
  4.  
  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 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18.  
  19.     */
  20.  
  21.  
  22. #ifndef _VM_H_
  23. #define _VM_H_
  24.  
  25. typedef struct _vm vm;
  26. typedef struct _vm_data_map vm_data_map;
  27. typedef struct _vm_instruction_map vm_instruction_map;
  28.  
  29.  
  30. /* each PowerPC requires two virtual memory maps */
  31.  
  32. INLINE_VM\
  33. (vm *) vm_create
  34. (core *memory);
  35.  
  36. INLINE_VM\
  37. (vm_data_map *) vm_create_data_map
  38. (vm *memory);
  39.  
  40. INLINE_VM\
  41. (vm_instruction_map *) vm_create_instruction_map
  42. (vm *memory);
  43.  
  44.  
  45. /* address translation, if the translation is invalid
  46.    these will not return */
  47.  
  48. INLINE_VM\
  49. (unsigned_word) vm_real_data_addr
  50. (vm_data_map *data_map,
  51.  unsigned_word ea,
  52.  int is_read,
  53.  cpu *processor,
  54.  unsigned_word cia);
  55.  
  56. INLINE_VM\
  57. (unsigned_word) vm_real_instruction_addr
  58. (vm_instruction_map *instruction_map,
  59.  cpu *processor,
  60.  unsigned_word cia);
  61.  
  62.  
  63. /* block transfers */
  64.  
  65. INLINE_VM\
  66. (int) vm_data_map_read_buffer
  67. (vm_data_map *map,
  68.  void *target,
  69.  unsigned_word addr,
  70.  unsigned len);
  71.  
  72. INLINE_VM\
  73. (int) vm_data_map_write_buffer
  74. (vm_data_map *map,
  75.  const void *source,
  76.  unsigned_word addr,
  77.  unsigned len,
  78.  int violate_read_only_section);
  79.  
  80.  
  81. /* fetch the next instruction from memory */
  82.  
  83. INLINE_VM\
  84. (instruction_word) vm_instruction_map_read
  85. (vm_instruction_map *instruction_map,
  86.  cpu *processor,
  87.  unsigned_word cia);
  88.  
  89.  
  90. /* read data from memory */
  91.  
  92. #define DECLARE_VM_DATA_MAP_READ_N(N) \
  93. INLINE_VM\
  94. (unsigned_##N) vm_data_map_read_##N \
  95. (vm_data_map *map, \
  96.  unsigned_word ea, \
  97.  cpu *processor, \
  98.  unsigned_word cia);
  99.  
  100. DECLARE_VM_DATA_MAP_READ_N(1)
  101. DECLARE_VM_DATA_MAP_READ_N(2)
  102. DECLARE_VM_DATA_MAP_READ_N(4)
  103. DECLARE_VM_DATA_MAP_READ_N(8)
  104. DECLARE_VM_DATA_MAP_READ_N(word)
  105.  
  106.  
  107. /* write data to memory */
  108.  
  109. #define DECLARE_VM_DATA_MAP_WRITE_N(N) \
  110. INLINE_VM\
  111. (void) vm_data_map_write_##N \
  112. (vm_data_map *map, \
  113.  unsigned_word addr, \
  114.  unsigned_##N val, \
  115.  cpu *processor, \
  116.  unsigned_word cia);
  117.  
  118. DECLARE_VM_DATA_MAP_WRITE_N(1)
  119. DECLARE_VM_DATA_MAP_WRITE_N(2)
  120. DECLARE_VM_DATA_MAP_WRITE_N(4)
  121. DECLARE_VM_DATA_MAP_WRITE_N(8)
  122. DECLARE_VM_DATA_MAP_WRITE_N(word)
  123.  
  124.  
  125. /* update vm data structures due to a synchronization point */
  126.  
  127. INLINE_VM\
  128. (void) vm_synchronize_context
  129. (vm *memory,
  130.  spreg *sprs,
  131.  sreg *srs,
  132.  msreg msr);
  133.  
  134.  
  135. /* update vm data structures due to a TLB operation */
  136.  
  137. INLINE_VM\
  138. (void) vm_page_tlb_invalidate_entry
  139. (vm *memory,
  140.  unsigned_word ea);
  141.  
  142. INLINE_VM\
  143. (void) vm_page_tlb_invalidate_all
  144. (vm *memory);
  145.  
  146. #endif
  147.