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 |
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 |
|
|
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]; |
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) |
119 |
|
|
120 |
|
#if REAL_ADDRESSING |
121 |
|
const uintptr MEMBaseDiff = 0; |
122 |
< |
#endif |
116 |
< |
#if DIRECT_ADDRESSING |
122 |
> |
#elif DIRECT_ADDRESSING |
123 |
|
extern uintptr MEMBaseDiff; |
124 |
|
#endif |
125 |
|
|
170 |
|
{ |
171 |
|
return do_get_virtual_address(addr); |
172 |
|
} |
167 |
– |
static __inline__ int valid_address(uaecptr addr, uae_u32 size) |
168 |
– |
{ |
169 |
– |
return 1; |
170 |
– |
} |
173 |
|
#else |
174 |
|
static __inline__ uae_u32 get_long(uaecptr addr) |
175 |
|
{ |
201 |
|
} |
202 |
|
/* gb-- deliberately not implemented since it shall not be used... */ |
203 |
|
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 |
– |
} |
204 |
|
#endif /* DIRECT_ADDRESSING || REAL_ADDRESSING */ |
205 |
|
|
206 |
|
#endif /* MEMORY_H */ |