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.3 by gbeauche, 2001-06-26T22:35:42Z vs.
Revision 1.9 by asvitkine, 2012-03-30T01:25:46Z

# Line 1 | Line 1
1 < /*
2 <  * UAE - The Un*x Amiga Emulator
3 <  *
4 <  * memory management
5 <  *
6 <  * Copyright 1995 Bernd Schmidt
7 <  */
1 > /*
2 > * UAE - The Un*x Amiga Emulator
3 > *
4 > * memory management
5 > *
6 > * Copyright 1995 Bernd Schmidt
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 as published by
10 > * the Free Software Foundation; either version 2 of the License, or
11 > * (at your option) any later version.
12 > *
13 > * This program is distributed in the hope that it will be useful,
14 > * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 > * GNU General Public License for more details.
17 > *
18 > * You should have received a copy of the GNU General Public License
19 > * along with this program; if not, write to the Free Software
20 > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 > */
22  
23   #ifndef UAE_MEMORY_H
24   #define UAE_MEMORY_H
# Line 23 | Line 37
37   typedef uae_u32 (REGPARAM2 *mem_get_func)(uaecptr) REGPARAM;
38   typedef void (REGPARAM2 *mem_put_func)(uaecptr, uae_u32) REGPARAM;
39   typedef uae_u8 *(REGPARAM2 *xlate_func)(uaecptr) REGPARAM;
26 typedef int (REGPARAM2 *check_func)(uaecptr, uae_u32) REGPARAM;
40  
41   #undef DIRECT_MEMFUNCS_SUCCESSFUL
42  
# Line 44 | Line 57 | typedef struct {
57       * This doesn't work for all memory banks, so this function may call
58       * abort(). */
59      xlate_func xlateaddr;
47    /* To prevent calls to abort(), use check before calling xlateaddr.
48     * It checks not only that the memory bank can do xlateaddr, but also
49     * that the pointer points to an area of at least the specified size.
50     * This is used for example to translate bitplane pointers in custom.c */
51    check_func check;
60   } addrbank;
61  
62   extern uae_u8 filesysory[65536];
# Line 59 | Line 67 | extern addrbank frame_bank;    // Frame buf
67  
68   /* Default memory access functions */
69  
62 extern int REGPARAM2 default_check(uaecptr addr, uae_u32 size) REGPARAM;
70   extern uae_u8 *REGPARAM2 default_xlate(uaecptr addr) REGPARAM;
71  
72   #define bankindex(addr) (((uaecptr)(addr)) >> 16)
# Line 88 | Line 95 | extern void map_banks(addrbank *bank, in
95  
96   #else
97  
91 extern uae_u32 alongget(uaecptr addr);
92 extern uae_u32 awordget(uaecptr addr);
98   extern uae_u32 longget(uaecptr addr);
99   extern uae_u32 wordget(uaecptr addr);
100   extern uae_u32 byteget(uaecptr addr);
# Line 114 | Line 119 | extern void byteput(uaecptr addr, uae_u3
119  
120   #if REAL_ADDRESSING
121   const uintptr MEMBaseDiff = 0;
122 < #define do_get_real_address(a)          ((uae_u8 *)(a))
118 < #define do_get_virtual_address(a)       ((uae_u32)(a))
119 < #endif /* REAL_ADDRESSING */
120 <
121 < #if DIRECT_ADDRESSING
122 > #elif DIRECT_ADDRESSING
123   extern uintptr MEMBaseDiff;
124 < #define do_get_real_address(a)          ((uae_u8 *)(a) + MEMBaseDiff)
124 < #define do_get_virtual_address(a)       ((uae_u32)(a) - MEMBaseDiff)
125 < #endif /* DIRECT_ADDRESSING */
124 > #endif
125  
126   #if REAL_ADDRESSING || DIRECT_ADDRESSING
127 + static __inline__ uae_u8 *do_get_real_address(uaecptr addr)
128 + {
129 +        return (uae_u8 *)MEMBaseDiff + addr;
130 + }
131 + static __inline__ uae_u32 do_get_virtual_address(uae_u8 *addr)
132 + {
133 +        return (uintptr)addr - MEMBaseDiff;
134 + }
135   static __inline__ uae_u32 get_long(uaecptr addr)
136   {
137      uae_u32 * const m = (uae_u32 *)do_get_real_address(addr);
# Line 163 | Line 170 | static __inline__ uae_u32 get_virtual_ad
170   {
171          return do_get_virtual_address(addr);
172   }
166 static __inline__ int valid_address(uaecptr addr, uae_u32 size)
167 {
168    return 1;
169 }
173   #else
174   static __inline__ uae_u32 get_long(uaecptr addr)
175   {
# Line 198 | Line 201 | static __inline__ uae_u8 *get_real_addre
201   }
202   /* gb-- deliberately not implemented since it shall not be used... */
203   extern uae_u32 get_virtual_address(uae_u8 *addr);
201 static __inline__ int valid_address(uaecptr addr, uae_u32 size)
202 {
203    return get_mem_bank(addr).check(addr, size);
204 }
204   #endif /* DIRECT_ADDRESSING || REAL_ADDRESSING */
205  
206   #endif /* MEMORY_H */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines