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.8 by asvitkine, 2009-03-03T08:01:48Z

# 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 21 | Line 23
23   typedef uae_u32 (REGPARAM2 *mem_get_func)(uaecptr) REGPARAM;
24   typedef void (REGPARAM2 *mem_put_func)(uaecptr, uae_u32) REGPARAM;
25   typedef uae_u8 *(REGPARAM2 *xlate_func)(uaecptr) REGPARAM;
24 typedef int (REGPARAM2 *check_func)(uaecptr, uae_u32) REGPARAM;
26  
27   #undef DIRECT_MEMFUNCS_SUCCESSFUL
28  
# Line 42 | Line 43 | typedef struct {
43       * This doesn't work for all memory banks, so this function may call
44       * abort(). */
45      xlate_func xlateaddr;
45    /* To prevent calls to abort(), use check before calling xlateaddr.
46     * It checks not only that the memory bank can do xlateaddr, but also
47     * that the pointer points to an area of at least the specified size.
48     * This is used for example to translate bitplane pointers in custom.c */
49    check_func check;
46   } addrbank;
47  
48   extern uae_u8 filesysory[65536];
# Line 57 | Line 53 | extern addrbank frame_bank;    // Frame buf
53  
54   /* Default memory access functions */
55  
60 extern int REGPARAM2 default_check(uaecptr addr, uae_u32 size) REGPARAM;
56   extern uae_u8 *REGPARAM2 default_xlate(uaecptr addr) REGPARAM;
57  
58   #define bankindex(addr) (((uaecptr)(addr)) >> 16)
# Line 86 | Line 81 | extern void map_banks(addrbank *bank, in
81  
82   #else
83  
89 extern uae_u32 alongget(uaecptr addr);
90 extern uae_u32 awordget(uaecptr addr);
84   extern uae_u32 longget(uaecptr addr);
85   extern uae_u32 wordget(uaecptr addr);
86   extern uae_u32 byteget(uaecptr addr);
# Line 108 | Line 101 | extern void byteput(uaecptr addr, uae_u3
101  
102   #endif
103  
104 + #endif /* !DIRECT_ADDRESSING && !REAL_ADDRESSING */
105 +
106   #if REAL_ADDRESSING
107 + const uintptr MEMBaseDiff = 0;
108 + #elif DIRECT_ADDRESSING
109 + extern uintptr MEMBaseDiff;
110 + #endif
111 +
112 + #if REAL_ADDRESSING || DIRECT_ADDRESSING
113 + static __inline__ uae_u8 *do_get_real_address(uaecptr addr)
114 + {
115 +        return (uae_u8 *)MEMBaseDiff + addr;
116 + }
117 + static __inline__ uae_u32 do_get_virtual_address(uae_u8 *addr)
118 + {
119 +        return (uintptr)addr - MEMBaseDiff;
120 + }
121   static __inline__ uae_u32 get_long(uaecptr addr)
122   {
123 <    return ntohl(*(uae_u32 *)addr);
123 >    uae_u32 * const m = (uae_u32 *)do_get_real_address(addr);
124 >    return do_get_mem_long(m);
125   }
126   static __inline__ uae_u32 get_word(uaecptr addr)
127   {
128 <    return ntohs(*(uae_u16 *)addr);
128 >    uae_u16 * const m = (uae_u16 *)do_get_real_address(addr);
129 >    return do_get_mem_word(m);
130   }
131   static __inline__ uae_u32 get_byte(uaecptr addr)
132   {
133 <    return *(uae_u8 *)addr;
133 >    uae_u8 * const m = (uae_u8 *)do_get_real_address(addr);
134 >    return do_get_mem_byte(m);
135   }
136   static __inline__ void put_long(uaecptr addr, uae_u32 l)
137   {
138 <    *(uae_u32 *)addr = htonl(l);
138 >    uae_u32 * const m = (uae_u32 *)do_get_real_address(addr);
139 >    do_put_mem_long(m, l);
140   }
141   static __inline__ void put_word(uaecptr addr, uae_u32 w)
142   {
143 <    *(uae_u16 *)addr = htons(w);
143 >    uae_u16 * const m = (uae_u16 *)do_get_real_address(addr);
144 >    do_put_mem_word(m, w);
145   }
146   static __inline__ void put_byte(uaecptr addr, uae_u32 b)
147   {
148 <    *(uae_u8 *)addr = b;
148 >    uae_u8 * const m = (uae_u8 *)do_get_real_address(addr);
149 >    do_put_mem_byte(m, b);
150   }
151   static __inline__ uae_u8 *get_real_address(uaecptr addr)
152   {
153 <    return (uae_u8 *)addr;
153 >        return do_get_real_address(addr);
154   }
155 < static __inline__ int valid_address(uaecptr addr, uae_u32 size)
155 > static __inline__ uae_u32 get_virtual_address(uae_u8 *addr)
156   {
157 <    return 1;
157 >        return do_get_virtual_address(addr);
158   }
159   #else
160   static __inline__ uae_u32 get_long(uaecptr addr)
# Line 166 | Line 181 | static __inline__ void put_byte(uaecptr
181   {
182      byteput_1(addr, b);
183   }
169
184   static __inline__ uae_u8 *get_real_address(uaecptr addr)
185   {
186      return get_mem_bank(addr).xlateaddr(addr);
187   }
188 + /* gb-- deliberately not implemented since it shall not be used... */
189 + extern uae_u32 get_virtual_address(uae_u8 *addr);
190 + #endif /* DIRECT_ADDRESSING || REAL_ADDRESSING */
191  
192 < static __inline__ int valid_address(uaecptr addr, uae_u32 size)
176 < {
177 <    return get_mem_bank(addr).check(addr, size);
178 < }
179 < #endif
192 > #endif /* MEMORY_H */
193  
181 #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines