ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/memory.h
(Generate patch)

Comparing BasiliskII/src/uae_cpu/memory.h (file contents):
Revision 1.1 by cebix, 1999-10-03T14:16:26Z vs.
Revision 1.6 by gbeauche, 2005-06-05T07:32:23Z

# Line 9 | Line 9
9   #ifndef UAE_MEMORY_H
10   #define UAE_MEMORY_H
11  
12 + #if !DIRECT_ADDRESSING && !REAL_ADDRESSING
13 +
14   /* Enabling this adds one additional native memory reference per 68k memory
15   * access, but saves one shift (on the x86). Enabling this is probably
16   * better for the cache. My favourite benchmark (PP2) doesn't show a
# Line 86 | Line 88 | extern void map_banks(addrbank *bank, in
88  
89   #else
90  
89 extern uae_u32 alongget(uaecptr addr);
90 extern uae_u32 awordget(uaecptr addr);
91   extern uae_u32 longget(uaecptr addr);
92   extern uae_u32 wordget(uaecptr addr);
93   extern uae_u32 byteget(uaecptr addr);
# Line 108 | Line 108 | extern void byteput(uaecptr addr, uae_u3
108  
109   #endif
110  
111 + #endif /* !DIRECT_ADDRESSING && !REAL_ADDRESSING */
112 +
113   #if REAL_ADDRESSING
114 + const uintptr MEMBaseDiff = 0;
115 + #endif
116 + #if DIRECT_ADDRESSING
117 + extern uintptr MEMBaseDiff;
118 + #endif
119 +
120 + #if REAL_ADDRESSING || DIRECT_ADDRESSING
121 + static __inline__ uae_u8 *do_get_real_address(uaecptr addr)
122 + {
123 +        return (uae_u8 *)MEMBaseDiff + addr;
124 + }
125 + static __inline__ uae_u32 do_get_virtual_address(uae_u8 *addr)
126 + {
127 +        return (uintptr)addr - MEMBaseDiff;
128 + }
129   static __inline__ uae_u32 get_long(uaecptr addr)
130   {
131 <    return ntohl(*(uae_u32 *)addr);
131 >    uae_u32 * const m = (uae_u32 *)do_get_real_address(addr);
132 >    return do_get_mem_long(m);
133   }
134   static __inline__ uae_u32 get_word(uaecptr addr)
135   {
136 <    return ntohs(*(uae_u16 *)addr);
136 >    uae_u16 * const m = (uae_u16 *)do_get_real_address(addr);
137 >    return do_get_mem_word(m);
138   }
139   static __inline__ uae_u32 get_byte(uaecptr addr)
140   {
141 <    return *(uae_u8 *)addr;
141 >    uae_u8 * const m = (uae_u8 *)do_get_real_address(addr);
142 >    return do_get_mem_byte(m);
143   }
144   static __inline__ void put_long(uaecptr addr, uae_u32 l)
145   {
146 <    *(uae_u32 *)addr = htonl(l);
146 >    uae_u32 * const m = (uae_u32 *)do_get_real_address(addr);
147 >    do_put_mem_long(m, l);
148   }
149   static __inline__ void put_word(uaecptr addr, uae_u32 w)
150   {
151 <    *(uae_u16 *)addr = htons(w);
151 >    uae_u16 * const m = (uae_u16 *)do_get_real_address(addr);
152 >    do_put_mem_word(m, w);
153   }
154   static __inline__ void put_byte(uaecptr addr, uae_u32 b)
155   {
156 <    *(uae_u8 *)addr = b;
156 >    uae_u8 * const m = (uae_u8 *)do_get_real_address(addr);
157 >    do_put_mem_byte(m, b);
158   }
159   static __inline__ uae_u8 *get_real_address(uaecptr addr)
160   {
161 <    return (uae_u8 *)addr;
161 >        return do_get_real_address(addr);
162 > }
163 > static __inline__ uae_u32 get_virtual_address(uae_u8 *addr)
164 > {
165 >        return do_get_virtual_address(addr);
166   }
167   static __inline__ int valid_address(uaecptr addr, uae_u32 size)
168   {
# Line 166 | Line 193 | static __inline__ void put_byte(uaecptr
193   {
194      byteput_1(addr, b);
195   }
169
196   static __inline__ uae_u8 *get_real_address(uaecptr addr)
197   {
198      return get_mem_bank(addr).xlateaddr(addr);
199   }
200 <
200 > /* gb-- deliberately not implemented since it shall not be used... */
201 > extern uae_u32 get_virtual_address(uae_u8 *addr);
202   static __inline__ int valid_address(uaecptr addr, uae_u32 size)
203   {
204      return get_mem_bank(addr).check(addr, size);
205   }
206 < #endif
206 > #endif /* DIRECT_ADDRESSING || REAL_ADDRESSING */
207 >
208 > #endif /* MEMORY_H */
209  
181 #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines