/[pearpc]/src/cpu/cpu_generic/ppc_mmu.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

Annotation of /src/cpu/cpu_generic/ppc_mmu.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Wed Sep 5 17:11:21 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 4771 byte(s)
import upstream CVS
1 dpavlin 1 /*
2     * PearPC
3     * ppc_mmu.h
4     *
5     * Copyright (C) 2003, 2004 Sebastian Biallas (sb@biallas.net)
6     * Copyright (C) 2004 Daniel Foesch (dfoesch@cs.nmsu.edu)
7     *
8     * This program is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License version 2 as
10     * published by the Free Software Foundation.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20     */
21    
22     #ifndef __PPC_MMU_H__
23     #define __PPC_MMU_H__
24    
25     #include "system/types.h"
26    
27     extern byte *gMemory;
28     extern uint32 gMemorySize;
29    
30     #define PPC_MMU_READ 1
31     #define PPC_MMU_WRITE 2
32     #define PPC_MMU_CODE 4
33     #define PPC_MMU_SV 8
34     #define PPC_MMU_NO_EXC 16
35    
36     #define PPC_MMU_OK 0
37     #define PPC_MMU_EXC 1
38     #define PPC_MMU_FATAL 2
39    
40     int FASTCALL ppc_effective_to_physical(uint32 addr, int flags, uint32 &result);
41     bool FASTCALL ppc_mmu_set_sdr1(uint32 newval, bool quiesce);
42     void ppc_mmu_tlb_invalidate();
43    
44     int FASTCALL ppc_read_physical_dword(uint32 addr, uint64 &result);
45     int FASTCALL ppc_read_physical_word(uint32 addr, uint32 &result);
46     int FASTCALL ppc_read_physical_half(uint32 addr, uint16 &result);
47     int FASTCALL ppc_read_physical_byte(uint32 addr, uint8 &result);
48    
49     int FASTCALL ppc_read_effective_code(uint32 addr, uint32 &result);
50     int FASTCALL ppc_read_effective_dword(uint32 addr, uint64 &result);
51     int FASTCALL ppc_read_effective_word(uint32 addr, uint32 &result);
52     int FASTCALL ppc_read_effective_half(uint32 addr, uint16 &result);
53     int FASTCALL ppc_read_effective_byte(uint32 addr, uint8 &result);
54    
55     int FASTCALL ppc_write_physical_dword(uint32 addr, uint64 data);
56     int FASTCALL ppc_write_physical_word(uint32 addr, uint32 data);
57     int FASTCALL ppc_write_physical_half(uint32 addr, uint16 data);
58     int FASTCALL ppc_write_physical_byte(uint32 addr, uint8 data);
59    
60     int FASTCALL ppc_write_effective_dword(uint32 addr, uint64 data);
61     int FASTCALL ppc_write_effective_word(uint32 addr, uint32 data);
62     int FASTCALL ppc_write_effective_half(uint32 addr, uint16 data);
63     int FASTCALL ppc_write_effective_byte(uint32 addr, uint8 data);
64    
65     int FASTCALL ppc_direct_physical_memory_handle(uint32 addr, byte *&ptr);
66     int FASTCALL ppc_direct_effective_memory_handle(uint32 addr, byte *&ptr);
67     int FASTCALL ppc_direct_effective_memory_handle_code(uint32 addr, byte *&ptr);
68     bool FASTCALL ppc_mmu_page_create(uint32 ea, uint32 pa);
69     bool FASTCALL ppc_mmu_page_free(uint32 ea);
70     bool FASTCALL ppc_init_physical_memory(uint size);
71    
72     /*
73     pte: (page table entry)
74     1st word:
75     0 V Valid
76     1-24 VSID Virtual Segment ID
77     25 H Hash function
78     26-31 API Abbreviated page index
79     2nd word:
80     0-19 RPN Physical page number
81     20-22 res
82     23 R Referenced bit
83     24 C Changed bit
84     25-28 WIMG Memory/cache control bits
85     29 res
86     30-31 PP Page protection bits
87     */
88    
89     /*
90     * MMU Opcodes
91     */
92     void ppc_opc_dcbz();
93    
94     void ppc_opc_lbz();
95     void ppc_opc_lbzu();
96     void ppc_opc_lbzux();
97     void ppc_opc_lbzx();
98     void ppc_opc_lfd();
99     void ppc_opc_lfdu();
100     void ppc_opc_lfdux();
101     void ppc_opc_lfdx();
102     void ppc_opc_lfs();
103     void ppc_opc_lfsu();
104     void ppc_opc_lfsux();
105     void ppc_opc_lfsx();
106     void ppc_opc_lha();
107     void ppc_opc_lhau();
108     void ppc_opc_lhaux();
109     void ppc_opc_lhax();
110     void ppc_opc_lhbrx();
111     void ppc_opc_lhz();
112     void ppc_opc_lhzu();
113     void ppc_opc_lhzux();
114     void ppc_opc_lhzx();
115     void ppc_opc_lmw();
116     void ppc_opc_lswi();
117     void ppc_opc_lswx();
118     void ppc_opc_lwarx();
119     void ppc_opc_lwbrx();
120     void ppc_opc_lwz();
121     void ppc_opc_lwzu();
122     void ppc_opc_lwzux();
123     void ppc_opc_lwzx();
124     void ppc_opc_lvx(); /* for altivec support */
125     void ppc_opc_lvxl();
126     void ppc_opc_lvebx();
127     void ppc_opc_lvehx();
128     void ppc_opc_lvewx();
129     void ppc_opc_lvsl();
130     void ppc_opc_lvsr();
131     void ppc_opc_dst();
132    
133     void ppc_opc_stb();
134     void ppc_opc_stbu();
135     void ppc_opc_stbux();
136     void ppc_opc_stbx();
137     void ppc_opc_stfd();
138     void ppc_opc_stfdu();
139     void ppc_opc_stfdux();
140     void ppc_opc_stfdx();
141     void ppc_opc_stfiwx();
142     void ppc_opc_stfs();
143     void ppc_opc_stfsu();
144     void ppc_opc_stfsux();
145     void ppc_opc_stfsx();
146     void ppc_opc_sth();
147     void ppc_opc_sthbrx();
148     void ppc_opc_sthu();
149     void ppc_opc_sthux();
150     void ppc_opc_sthx();
151     void ppc_opc_stmw();
152     void ppc_opc_stswi();
153     void ppc_opc_stswx();
154     void ppc_opc_stw();
155     void ppc_opc_stwbrx();
156     void ppc_opc_stwcx_();
157     void ppc_opc_stwu();
158     void ppc_opc_stwux();
159     void ppc_opc_stwx();
160     void ppc_opc_stvx(); /* for altivec support */
161     void ppc_opc_stvxl();
162     void ppc_opc_stvebx();
163     void ppc_opc_stvehx();
164     void ppc_opc_stvewx();
165     void ppc_opc_dstst();
166     void ppc_opc_dss();
167    
168     #endif
169    

  ViewVC Help
Powered by ViewVC 1.1.26