--- BasiliskII/src/uae_cpu/memory.h 2001/06/26 22:35:42 1.3 +++ BasiliskII/src/uae_cpu/memory.h 2012/03/30 01:25:46 1.9 @@ -1,10 +1,24 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * memory management - * - * Copyright 1995 Bernd Schmidt - */ +/* + * UAE - The Un*x Amiga Emulator + * + * memory management + * + * Copyright 1995 Bernd Schmidt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef UAE_MEMORY_H #define UAE_MEMORY_H @@ -23,7 +37,6 @@ typedef uae_u32 (REGPARAM2 *mem_get_func)(uaecptr) REGPARAM; typedef void (REGPARAM2 *mem_put_func)(uaecptr, uae_u32) REGPARAM; typedef uae_u8 *(REGPARAM2 *xlate_func)(uaecptr) REGPARAM; -typedef int (REGPARAM2 *check_func)(uaecptr, uae_u32) REGPARAM; #undef DIRECT_MEMFUNCS_SUCCESSFUL @@ -44,11 +57,6 @@ typedef struct { * This doesn't work for all memory banks, so this function may call * abort(). */ xlate_func xlateaddr; - /* To prevent calls to abort(), use check before calling xlateaddr. - * It checks not only that the memory bank can do xlateaddr, but also - * that the pointer points to an area of at least the specified size. - * This is used for example to translate bitplane pointers in custom.c */ - check_func check; } addrbank; extern uae_u8 filesysory[65536]; @@ -59,7 +67,6 @@ extern addrbank frame_bank; // Frame buf /* Default memory access functions */ -extern int REGPARAM2 default_check(uaecptr addr, uae_u32 size) REGPARAM; extern uae_u8 *REGPARAM2 default_xlate(uaecptr addr) REGPARAM; #define bankindex(addr) (((uaecptr)(addr)) >> 16) @@ -88,8 +95,6 @@ extern void map_banks(addrbank *bank, in #else -extern uae_u32 alongget(uaecptr addr); -extern uae_u32 awordget(uaecptr addr); extern uae_u32 longget(uaecptr addr); extern uae_u32 wordget(uaecptr addr); extern uae_u32 byteget(uaecptr addr); @@ -114,17 +119,19 @@ extern void byteput(uaecptr addr, uae_u3 #if REAL_ADDRESSING const uintptr MEMBaseDiff = 0; -#define do_get_real_address(a) ((uae_u8 *)(a)) -#define do_get_virtual_address(a) ((uae_u32)(a)) -#endif /* REAL_ADDRESSING */ - -#if DIRECT_ADDRESSING +#elif DIRECT_ADDRESSING extern uintptr MEMBaseDiff; -#define do_get_real_address(a) ((uae_u8 *)(a) + MEMBaseDiff) -#define do_get_virtual_address(a) ((uae_u32)(a) - MEMBaseDiff) -#endif /* DIRECT_ADDRESSING */ +#endif #if REAL_ADDRESSING || DIRECT_ADDRESSING +static __inline__ uae_u8 *do_get_real_address(uaecptr addr) +{ + return (uae_u8 *)MEMBaseDiff + addr; +} +static __inline__ uae_u32 do_get_virtual_address(uae_u8 *addr) +{ + return (uintptr)addr - MEMBaseDiff; +} static __inline__ uae_u32 get_long(uaecptr addr) { uae_u32 * const m = (uae_u32 *)do_get_real_address(addr); @@ -163,10 +170,6 @@ static __inline__ uae_u32 get_virtual_ad { return do_get_virtual_address(addr); } -static __inline__ int valid_address(uaecptr addr, uae_u32 size) -{ - return 1; -} #else static __inline__ uae_u32 get_long(uaecptr addr) { @@ -198,10 +201,6 @@ static __inline__ uae_u8 *get_real_addre } /* gb-- deliberately not implemented since it shall not be used... */ extern uae_u32 get_virtual_address(uae_u8 *addr); -static __inline__ int valid_address(uaecptr addr, uae_u32 size) -{ - return get_mem_bank(addr).check(addr, size); -} #endif /* DIRECT_ADDRESSING || REAL_ADDRESSING */ #endif /* MEMORY_H */