Add multi-architecture support

This commit is contained in:
Laurent Vivier 2005-05-10 21:49:28 +00:00
parent 1d1e1e5bd7
commit 3721ba9227
2 changed files with 46 additions and 4 deletions

View File

@ -9,19 +9,24 @@
#include <stdio.h>
#include <malloc.h>
#include "misc.h"
#include "arch.h"
#include "lowmem.h"
#ifdef ARCH_M68K
#include "MMU030.h"
#include "MMU040.h"
#endif
#include "bank.h"
/* MacOS nanokernel data structures (nubus powerPC only)
* found in Boot/X, thank you Ben ;-)
*/
#ifdef ARCH_PPC
#define MACOS_MEMMAP_PTR_ADDR 0x5FFFEFF0
#define MACOS_MEMMAP_SIZE_ADDR 0x5FFFEFF6
#define MACOS_MEMMAP_BANK_0FFSET 48
#endif
memory_map_t memory_map;
@ -87,6 +92,7 @@ static void bank_add_mem(unsigned long logiAddr,
memory_map.bank_number++;
}
#ifdef ARCH_M68K
void m68k_init_memory_map()
{
unsigned long logical;
@ -124,7 +130,9 @@ void m68k_init_memory_map()
}
}
}
#endif /* ARCH_M68K */
#ifdef ARCH_PPC
void ppc_init_memory_map()
{
/* Nubus powerPC */
@ -150,13 +158,24 @@ void ppc_init_memory_map()
len -= 8;
}
}
#endif /* ARCH_PPC */
void init_memory_map()
{
if (arch_type == gestaltPowerPC)
if (arch_type == gestaltPowerPC) {
#ifdef ARCH_PPC
ppc_init_memory_map();
else
#else
error("This version of EMILE doesn't support PowePC\n");
#endif
}
else {
#ifdef ARCH_M68K
m68k_init_memory_map();
#else
error("This version of EMILE doesn't support Motorola 680x0\n");
#endif
}
}
static int bank_find_by_physical(unsigned long physical)
@ -195,12 +214,14 @@ int logical2physical(unsigned long logical, unsigned long *physical)
return 0;
}
#ifdef ARCH_M68K
else if (mmu_type == gestalt68040MMU)
{
return MMU040_logical2physical(logical, physical);
}
return MMU030_logical2physical(logical, physical);
#endif
}
int physical2logical(unsigned long physical, unsigned long *logical)

View File

@ -24,12 +24,19 @@
typedef void (*entry_t) (unsigned long , unsigned long , unsigned long );
typedef void (*disable_cache_t) (void);
#ifdef ARCH_M68K
extern void enter_kernel030(unsigned long addr, unsigned long size, unsigned long dest);
extern char end_enter_kernel030;
extern void MMU030_disable_cache(void);
extern void enter_kernel040(unsigned long addr, unsigned long size, unsigned long dest);
extern char end_enter_kernel040;
extern void MMU040_disable_cache(void);
#endif
#ifdef ARCH_PPC
extern void enter_kernelPPC(unsigned long addr, unsigned long size, unsigned long dest);
extern char end_enter_kernelPPC;
extern void PPC_disable_cache(void);
#endif
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
@ -54,8 +61,15 @@ int start(emile_l2_header_t* info)
unsigned long ramdisk_start;
int uncompressed_size;
printf("Early Macintosh Image LoadEr\n");
printf("EMILE v"VERSION" (c) 2004 Laurent Vivier\n");
printf("Early Macintosh Image LoadEr");
#if defined(ARCH_M68K)
printf(" for Motorola 680x0\n");
#elif defined(ARCH_PPC)
printf(" for PowerPC\n");
#else
printf(" (unknown processor)\n");
#endif
printf("EMILE v"VERSION" (c) 2004,2005 Laurent Vivier\n");
printf("This is free software, redistribute it under GPL\n");
if (!EMILE_COMPAT(EMILE_03_SIGNATURE, info->signature))
@ -78,6 +92,7 @@ int start(emile_l2_header_t* info)
/* where is mapped my boot function ? */
#ifdef ARCH_M68K
if (mmu_type == gestalt68040MMU)
{
enter_kernel = (unsigned long)enter_kernel040;
@ -90,6 +105,12 @@ int start(emile_l2_header_t* info)
end_enter_kernel = (unsigned long)&end_enter_kernel030;
disable_cache = MMU030_disable_cache;
}
#endif
#ifdef ARCH_PPC
enter_kernel = (unsigned long)enter_kernelPPC;
end_enter_kernel = (unsigned long)&end_enter_kernelPPC;
disable_cache = PPC_disable_cache;
#endif
/* load kernel */