/[pcsx2_0.9.7]/trunk/pcsx2/vtlb.h
ViewVC logotype

Annotation of /trunk/pcsx2/vtlb.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 3709 byte(s)
committing r3113 initial commit again...
1 william 31
2     #pragma once
3    
4     // Specialized function pointers for each read type
5     typedef mem8_t __fastcall vtlbMemR8FP(u32 addr);
6     typedef mem16_t __fastcall vtlbMemR16FP(u32 addr);
7     typedef mem32_t __fastcall vtlbMemR32FP(u32 addr);
8     typedef void __fastcall vtlbMemR64FP(u32 addr,mem64_t* data);
9     typedef void __fastcall vtlbMemR128FP(u32 addr,mem128_t* data);
10    
11     // Specialized function pointers for each write type
12     typedef void __fastcall vtlbMemW8FP(u32 addr,mem8_t data);
13     typedef void __fastcall vtlbMemW16FP(u32 addr,mem16_t data);
14     typedef void __fastcall vtlbMemW32FP(u32 addr,mem32_t data);
15     typedef void __fastcall vtlbMemW64FP(u32 addr,const mem64_t* data);
16     typedef void __fastcall vtlbMemW128FP(u32 addr,const mem128_t* data);
17    
18     typedef u32 vtlbHandler;
19    
20     extern void vtlb_Core_Alloc();
21     extern void vtlb_Core_Shutdown();
22     extern void vtlb_Init();
23     extern void vtlb_Reset();
24     extern void vtlb_Term();
25     extern u8* vtlb_malloc( uint size, uint align );
26     extern void vtlb_free( void* pmem, uint size );
27    
28    
29     extern vtlbHandler vtlb_NewHandler();
30    
31     extern vtlbHandler vtlb_RegisterHandler(
32     vtlbMemR8FP* r8,vtlbMemR16FP* r16,vtlbMemR32FP* r32,vtlbMemR64FP* r64,vtlbMemR128FP* r128,
33     vtlbMemW8FP* w8,vtlbMemW16FP* w16,vtlbMemW32FP* w32,vtlbMemW64FP* w64,vtlbMemW128FP* w128
34     );
35    
36     extern void vtlb_ReassignHandler( vtlbHandler rv,
37     vtlbMemR8FP* r8,vtlbMemR16FP* r16,vtlbMemR32FP* r32,vtlbMemR64FP* r64,vtlbMemR128FP* r128,
38     vtlbMemW8FP* w8,vtlbMemW16FP* w16,vtlbMemW32FP* w32,vtlbMemW64FP* w64,vtlbMemW128FP* w128
39     );
40    
41    
42     extern void vtlb_MapHandler(vtlbHandler handler,u32 start,u32 size);
43     extern void vtlb_MapBlock(void* base,u32 start,u32 size,u32 blocksize=0);
44     extern void* vtlb_GetPhyPtr(u32 paddr);
45     //extern void vtlb_Mirror(u32 new_region,u32 start,u32 size); // -> not working yet :(
46    
47     //virtual mappings
48     extern void vtlb_VMap(u32 vaddr,u32 paddr,u32 sz);
49     extern void vtlb_VMapBuffer(u32 vaddr,void* buffer,u32 sz);
50     extern void vtlb_VMapUnmap(u32 vaddr,u32 sz);
51    
52     //Memory functions
53    
54     extern mem8_t __fastcall vtlb_memRead8(u32 mem);
55     extern mem16_t __fastcall vtlb_memRead16(u32 mem);
56     extern u32 __fastcall vtlb_memRead32(u32 mem);
57     extern void __fastcall vtlb_memRead64(u32 mem, u64 *out);
58     extern void __fastcall vtlb_memRead128(u32 mem, u64 *out);
59     extern void __fastcall vtlb_memWrite8 (u32 mem, mem8_t value);
60     extern void __fastcall vtlb_memWrite16(u32 mem, mem16_t value);
61     extern void __fastcall vtlb_memWrite32(u32 mem, u32 value);
62     extern void __fastcall vtlb_memWrite64(u32 mem, const u64* value);
63     extern void __fastcall vtlb_memWrite128(u32 mem, const u64* value);
64    
65     extern void vtlb_DynGenWrite(u32 sz);
66     extern void vtlb_DynGenRead32(u32 bits, bool sign);
67     extern void vtlb_DynGenRead64(u32 sz);
68    
69     extern void vtlb_DynGenWrite_Const( u32 bits, u32 addr_const );
70     extern void vtlb_DynGenRead64_Const( u32 bits, u32 addr_const );
71     extern void vtlb_DynGenRead32_Const( u32 bits, bool sign, u32 addr_const );
72    
73     namespace vtlb_private
74     {
75     static const uint VTLB_ALLOC_SIZE = 0x2900000; //this is a bit more than required
76    
77     static const uint VTLB_PAGE_BITS = 12;
78     static const uint VTLB_PAGE_MASK = 4095;
79     static const uint VTLB_PAGE_SIZE = 4096;
80    
81     static const uint VTLB_PMAP_ITEMS = 0x20000000 / VTLB_PAGE_SIZE;
82     static const uint VTLB_PMAP_SZ = 0x20000000;
83     static const uint VTLB_VMAP_ITEMS = 0x100000000ULL / VTLB_PAGE_SIZE;
84    
85     struct MapData
86     {
87     u8* alloc_base; //base of the memory array
88     int alloc_current; //current base
89    
90     s32 pmap[VTLB_PMAP_ITEMS]; //512KB
91     s32 vmap[VTLB_VMAP_ITEMS]; //4MB
92    
93     // first indexer -- 8/16/32/64/128 bit tables [values 0-4]
94     // second indexer -- read/write [0 or 1]
95     // third indexer -- 128 possible handlers!
96     void* RWFT[5][2][128];
97     };
98    
99     extern __aligned(64) MapData vtlbdata;
100     }

  ViewVC Help
Powered by ViewVC 1.1.22