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