/[dynamips]/upstream/dynamips-0.2.6-RC3/memory.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /upstream/dynamips-0.2.6-RC3/memory.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.6-RC2/memory.h revision 3 by dpavlin, Sat Oct 6 16:05:34 2007 UTC upstream/dynamips-0.2.6-RC3/memory.h revision 4 by dpavlin, Sat Oct 6 16:06:49 2007 UTC
# Line 6  Line 6 
6  #ifndef __MEMORY_H__  #ifndef __MEMORY_H__
7  #define __MEMORY_H__  #define __MEMORY_H__
8    
 #ifndef DYNAMIPS_ASM  
9  #include <sys/types.h>  #include <sys/types.h>
10  #include "utils.h"  #include "utils.h"
 #endif  
11    
12  /* MTS operation */  /* MTS operation */
13  #define MTS_READ  0  #define MTS_READ  0
# Line 39  Line 37 
37  #define MTS_ACC_T   0x00000004   /* TLB Exception */  #define MTS_ACC_T   0x00000004   /* TLB Exception */
38  #define MTS_ACC_U   0x00000006   /* Unexistent */  #define MTS_ACC_U   0x00000006   /* Unexistent */
39    
 /* 32-bit Virtual Address seen by MTS */  
 #define MTS32_LEVEL1_BITS  10  
 #define MTS32_LEVEL2_BITS  10  
 #define MTS32_OFFSET_BITS  12  
   
 /* Each level-1 entry covers 4 Mb */  
 #define MTS32_LEVEL1_SIZE  (1 << (MTS32_LEVEL2_BITS + MTS32_OFFSET_BITS))  
 #define MTS32_LEVEL1_MASK  (MTS32_LEVEL1_SIZE - 1)  
   
 /* Each level-2 entry covers 4 Kb */  
 #define MTS32_LEVEL2_SIZE  (1 << MTS32_OFFSET_BITS)  
 #define MTS32_LEVEL2_MASK  (MTS32_LEVEL2_SIZE - 1)  
   
40  /* Hash table size for MTS64 (default: [shift:16,bits:12]) */  /* Hash table size for MTS64 (default: [shift:16,bits:12]) */
41  #define MTS64_HASH_SHIFT   15  #define MTS64_HASH_SHIFT   15
42  #define MTS64_HASH_BITS    15  #define MTS64_HASH_BITS    15
# Line 59  Line 44 
44  #define MTS64_HASH_MASK    (MTS64_HASH_SIZE - 1)  #define MTS64_HASH_MASK    (MTS64_HASH_SIZE - 1)
45    
46  /* MTS64 hash on virtual addresses */  /* MTS64 hash on virtual addresses */
47  #define MTS64_HASH(vaddr) (((vaddr) >> MTS64_HASH_SHIFT) & MTS64_HASH_MASK)  #define MTS64_HASH(vaddr)  (((vaddr) >> MTS64_HASH_SHIFT) & MTS64_HASH_MASK)
48    
49  /* Number of entries per chunk */  /* Hash table size for MTS32 (default: [shift:15,bits:15]) */
50  #define MTS64_CHUNK_SIZE   256  #define MTS32_HASH_SHIFT   15
51    #define MTS32_HASH_BITS    15
52    #define MTS32_HASH_SIZE    (1 << MTS32_HASH_BITS)
53    #define MTS32_HASH_MASK    (MTS32_HASH_SIZE - 1)
54    
55  #ifndef DYNAMIPS_ASM  /* MTS32 hash on virtual addresses */
56  /* MTS32: Level 1 & 2 arrays */  #define MTS32_HASH(vaddr)  (((vaddr) >> MTS32_HASH_SHIFT) & MTS32_HASH_MASK)
 typedef struct mts32_l1_array mts32_l1_array_t;  
 struct mts32_l1_array {  
    m_iptr_t entry[1 << MTS32_LEVEL1_BITS];  
 };  
57    
58  typedef struct mts32_l2_array mts32_l2_array_t;  /* Number of entries per chunk */
59  struct mts32_l2_array {  #define MTS64_CHUNK_SIZE   256
60     m_iptr_t entry[1 << MTS32_LEVEL2_BITS];  #define MTS32_CHUNK_SIZE   256
    mts32_l2_array_t *next;  
 };  
61    
62  /* MTS64: chunk definition */  /* MTS64: chunk definition */
63  struct mts64_chunk {  struct mts64_chunk {
# Line 84  struct mts64_chunk { Line 66  struct mts64_chunk {
66     u_int count;     u_int count;
67  };  };
68    
69    /* MTS32: chunk definition */
70    struct mts32_chunk {
71       mts32_entry_t entry[MTS32_CHUNK_SIZE];
72       struct mts32_chunk *next;
73       u_int count;
74    };
75    
76  /* Show the last memory accesses */  /* Show the last memory accesses */
77  void memlog_dump(cpu_mips_t *cpu);  void memlog_dump(cpu_mips_t *cpu);
78    
 /* Allocate an L1 array */  
 mts32_l1_array_t *mts32_alloc_l1_array(m_iptr_t val);  
   
 /* Allocate an L2 array */  
 mts32_l2_array_t *mts32_alloc_l2_array(cpu_mips_t *cpu,m_iptr_t val);  
   
 /* Initialize an empty MTS32 subsystem */  
 int mts32_init_empty(cpu_mips_t *cpu);  
   
 /* Free memory used by MTS32 */  
 void mts32_shutdown(cpu_mips_t *cpu);  
   
 /* Map a physical address to the specified virtual address */  
 void mts32_map(cpu_mips_t *cpu,m_uint64_t vaddr,  
                m_uint64_t paddr,m_uint32_t len,  
                int cache_access);  
   
 /* Unmap a memory zone */  
 void mts32_unmap(cpu_mips_t *cpu,m_uint64_t vaddr,m_uint32_t len,  
                  m_uint32_t val);  
   
 /* Map all devices for kernel mode */  
 void mts32_km_map_all_dev(cpu_mips_t *cpu);  
   
 /* Initialize the MTS64 subsystem for the specified CPU */  
 int mts64_init(cpu_mips_t *cpu);  
   
 /* Free memory used by MTS64 */  
 void mts64_shutdown(cpu_mips_t *cpu);  
   
 /* Show MTS64 detailed information (debugging only!) */  
 void mts64_show_stats(cpu_mips_t *cpu);  
   
 /* Initialize memory access vectors */  
 void mts_init_memop_vectors(cpu_mips_t *cpu);  
   
79  /* Shutdown MTS subsystem */  /* Shutdown MTS subsystem */
80  void mts_shutdown(cpu_mips_t *cpu);  void mts_shutdown(cpu_mips_t *cpu);
81    
82    /* Set the address mode */
83    int mts_set_addr_mode(cpu_mips_t *cpu,u_int addr_mode);
84    
85  /* Copy a memory block from VM physical RAM to real host */  /* Copy a memory block from VM physical RAM to real host */
86  void physmem_copy_from_vm(vm_instance_t *vm,void *real_buffer,  void physmem_copy_from_vm(vm_instance_t *vm,void *real_buffer,
87                            m_uint64_t paddr,size_t len);                            m_uint64_t paddr,size_t len);
# Line 156  size_t physmem_strlen(vm_instance_t *vm, Line 112  size_t physmem_strlen(vm_instance_t *vm,
112  /* Physical memory dump (32-bit words) */  /* Physical memory dump (32-bit words) */
113  void physmem_dump_vm(vm_instance_t *vm,m_uint64_t paddr,m_uint32_t u32_count);  void physmem_dump_vm(vm_instance_t *vm,m_uint64_t paddr,m_uint32_t u32_count);
114    
 #endif /* DYNAMIPS_ASM */  
   
115  #endif  #endif

Legend:
Removed from v.3  
changed lines
  Added in v.4

  ViewVC Help
Powered by ViewVC 1.1.26