modified to map memory dynamically based on a static memory map
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
# can be either "Y" or "N" (without quotes). "Y" for using the m68k-elf-, "N" for using the m68k-atari-mint
|
||||
# toolchain
|
||||
COMPILE_ELF=N
|
||||
COMPILE_ELF=Y
|
||||
|
||||
ifeq (Y,$(COMPILE_ELF))
|
||||
TCPREFIX=m68k-elf-
|
||||
|
||||
@@ -56,11 +56,22 @@
|
||||
|
||||
#define SCA_PAGE_ID 6 /* indicates video memory page */
|
||||
|
||||
/*
|
||||
* MMU page sizes
|
||||
*/
|
||||
#define MMU_PAGE_SIZE_1M 0
|
||||
#define MMU_PAGE_SIZE_4K 1
|
||||
#define MMU_PAGE_SIZE_8K 2
|
||||
#define MMU_PAGE_SIZE_1K 3
|
||||
|
||||
/*
|
||||
* MMU cache modes
|
||||
*/
|
||||
#define MMU_CACHE_WRITETHROUGH 0
|
||||
#define MMU_CACHE_COPYBACK 1
|
||||
#define MMU_CACHE_NOCACHE_PRECISE 2
|
||||
#define MMU_CACHE_NOCACHE_IMPRECISE 3
|
||||
|
||||
/*
|
||||
* global variables from linker script
|
||||
*/
|
||||
|
||||
@@ -337,6 +337,49 @@ void mmu_init(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* TODO: this would be nicer in an include file
|
||||
*/
|
||||
extern uint8_t _MBAR[];
|
||||
extern uint8_t _RAMBAR0[];
|
||||
extern uint8_t _RAMBAR1[];
|
||||
extern uint8_t _SYS_SRAM[];
|
||||
extern uint8_t _SYS_SRAM_SIZE[];
|
||||
|
||||
static struct mmu_mapping
|
||||
{
|
||||
uint32_t phys;
|
||||
uint32_t virt;
|
||||
uint32_t length;
|
||||
uint32_t pagesize;
|
||||
uint32_t flags;
|
||||
} memory_map[] =
|
||||
{
|
||||
{
|
||||
_RAMBAR0,
|
||||
_RAMBAR0,
|
||||
_RAMBAR0_SIZE,
|
||||
MMU_PAGE_SIZE_1K,
|
||||
MMU_CACHE_WRITETHROUGH,
|
||||
},
|
||||
{
|
||||
_RAMBAR1,
|
||||
_RAMBAR1,
|
||||
_RAMBAR1_SIZE,
|
||||
MMU_PAGE_SIZE_1K,
|
||||
MMU_CACHE_WRITETHROUGH,
|
||||
},
|
||||
{
|
||||
_SYS_SRAM,
|
||||
_SYS_SRAM,
|
||||
_SYS_SRAM_SIZE,
|
||||
MMU_PAGE_SIZE_1K,
|
||||
MMU_CACHE_WRITETHROUGH,
|
||||
}
|
||||
};
|
||||
|
||||
static int num_mmu_maps = sizeof(memory_map) / sizeof(struct mmu_mapping);
|
||||
|
||||
/*
|
||||
* handle an access error
|
||||
* upper level routine called from access_exception inside exceptions.S
|
||||
@@ -383,11 +426,6 @@ bool access_exception(uint32_t pc, uint32_t format_status)
|
||||
}
|
||||
else
|
||||
{
|
||||
extern uint8_t _RAMBAR0[];
|
||||
extern uint8_t _RAMBAR1[];
|
||||
extern uint8_t _SYS_SRAM[];
|
||||
extern uint8_t _SYS_SRAM_SIZE[];
|
||||
|
||||
uint32_t flags;
|
||||
|
||||
/* TODO: MBAR, MMUBAR, PCI MEMORY, PCI IO, DMA BUFFERS */
|
||||
|
||||
Reference in New Issue
Block a user