1
0
mirror of https://github.com/vivier/EMILE.git synced 2025-01-10 14:30:09 +00:00

Add support of CPU without MMU

This commit is contained in:
Laurent Vivier 2005-05-16 21:38:33 +00:00
parent 7b843d879b
commit d6f85543c3

@ -31,6 +31,9 @@
typedef void (*entry_t) (unsigned long , unsigned long , unsigned long ); typedef void (*entry_t) (unsigned long , unsigned long , unsigned long );
typedef void (*disable_cache_t) (void); typedef void (*disable_cache_t) (void);
extern void enter_kernelnoMMU(unsigned long addr, unsigned long size, unsigned long dest);
extern char end_enter_kernelnoMMU;
extern void noMMU_disable_cache(void);
extern void enter_kernel030(unsigned long addr, unsigned long size, unsigned long dest); extern void enter_kernel030(unsigned long addr, unsigned long size, unsigned long dest);
extern char end_enter_kernel030; extern char end_enter_kernel030;
extern void MMU030_disable_cache(void); extern void MMU030_disable_cache(void);
@ -70,9 +73,12 @@ int start(emile_l2_header_t* info)
unsigned long kernel_image_start; unsigned long kernel_image_start;
unsigned long ramdisk_start; unsigned long ramdisk_start;
int uncompressed_size; int uncompressed_size;
int bootstrap_size;
printf("Early Macintosh Image LoadEr"); printf("Early Macintosh Image LoadEr");
#if defined(ARCH_M68K) #if defined(ARCH_M68K) && defined(ARCH_PPC)
printf(" (mixed mode)\n");
#elif defined(ARCH_M68K)
printf(" for Motorola 680x0\n"); printf(" for Motorola 680x0\n");
#elif defined(ARCH_PPC) #elif defined(ARCH_PPC)
printf(" for PowerPC\n"); printf(" for PowerPC\n");
@ -107,12 +113,14 @@ int start(emile_l2_header_t* info)
{ {
if (mmu_type == gestalt68040MMU) if (mmu_type == gestalt68040MMU)
{ {
printf("Using 68040 MMU\n");
enter_kernel = (unsigned long)enter_kernel040; enter_kernel = (unsigned long)enter_kernel040;
end_enter_kernel = (unsigned long)&end_enter_kernel040; end_enter_kernel = (unsigned long)&end_enter_kernel040;
disable_cache = MMU040_disable_cache; disable_cache = MMU040_disable_cache;
} }
else if (mmu_type == gestalt68030MMU) else if (mmu_type == gestalt68030MMU)
{ {
printf("Using 68030 MMU\n");
enter_kernel = (unsigned long)enter_kernel030; enter_kernel = (unsigned long)enter_kernel030;
end_enter_kernel = (unsigned long)&end_enter_kernel030; end_enter_kernel = (unsigned long)&end_enter_kernel030;
disable_cache = MMU030_disable_cache; disable_cache = MMU030_disable_cache;
@ -123,10 +131,18 @@ int start(emile_l2_header_t* info)
} }
else if (mmu_type == gestaltNoMMU) else if (mmu_type == gestaltNoMMU)
{ {
error("CPU without MMU is not supported"); printf("No MMU detected\n");
enter_kernel = (unsigned long)enter_kernelnoMMU;
end_enter_kernel = (unsigned long)&end_enter_kernelnoMMU;
disable_cache = noMMU_disable_cache;
} }
else else
error("Unknown MMU"); error("Unknown MMU");
/* and BI_ALLOC_SIZE for bootinfo */
bootstrap_size = BI_ALLOC_SIZE +
end_enter_kernel - enter_kernel;
} }
else else
#ifndef ARCH_PPC #ifndef ARCH_PPC
@ -134,7 +150,14 @@ int start(emile_l2_header_t* info)
#endif #endif
#endif #endif
#ifdef ARCH_PPC #ifdef ARCH_PPC
if (arch_type != gestaltPowerPC) if (arch_type == gestaltPowerPC)
{
enter_kernel = NULL;
end_enter_kernel = NULL;
disable_cache = NULL;
bootstrap_size = 0;
}
else
error("EMILE doesn't support your architecture"); error("EMILE doesn't support your architecture");
#endif #endif
@ -150,11 +173,8 @@ int start(emile_l2_header_t* info)
if (info->kernel_size == 0) /* means uncompressed */ if (info->kernel_size == 0) /* means uncompressed */
kernel_image_start = (unsigned long)malloc_contiguous( kernel_image_start = (unsigned long)malloc_contiguous(
info->kernel_image_size + 4 info->kernel_image_size + 4 +
#ifdef ARCH_M68K bootstrap_size
+ BI_ALLOC_SIZE +
end_enter_kernel - enter_kernel
#endif
); );
else else
kernel_image_start = (unsigned long)malloc( kernel_image_start = (unsigned long)malloc(
@ -186,16 +206,9 @@ int start(emile_l2_header_t* info)
} }
else else
{ {
/* add KERNEL_ALIGN if we have to align
* and BI_ALLOC_SIZE for bootinfo
*/
printf("Allocating %d bytes for kernel\n", info->kernel_size); printf("Allocating %d bytes for kernel\n", info->kernel_size);
kernel = (char*)malloc_contiguous(info->kernel_size + 4 kernel = (char*)malloc_contiguous(info->kernel_size + 4 +
#ifdef ARCH_M68K bootstrap_size
+ BI_ALLOC_SIZE +
end_enter_kernel - enter_kernel
#endif
); );
if (kernel == 0) if (kernel == 0)
{ {
@ -218,6 +231,8 @@ int start(emile_l2_header_t* info)
error("Kernel between two banks, contact maintainer\n"); error("Kernel between two banks, contact maintainer\n");
#ifdef ARCH_M68K #ifdef ARCH_M68K
if (arch_type == gestalt68k)
{
/* copy enter_kernel at end of kernel */ /* copy enter_kernel at end of kernel */
memcpy((char*)kernel + uncompressed_size + BI_ALLOC_SIZE, memcpy((char*)kernel + uncompressed_size + BI_ALLOC_SIZE,
@ -227,6 +242,7 @@ int start(emile_l2_header_t* info)
+ BI_ALLOC_SIZE + (end_enter_kernel - enter_kernel); + BI_ALLOC_SIZE + (end_enter_kernel - enter_kernel);
enter_kernel = (unsigned long)kernel + BI_ALLOC_SIZE enter_kernel = (unsigned long)kernel + BI_ALLOC_SIZE
+ uncompressed_size; + uncompressed_size;
}
#endif #endif
/* load ramdisk if needed */ /* load ramdisk if needed */
@ -270,6 +286,8 @@ int start(emile_l2_header_t* info)
/* compute final address of kernel */ /* compute final address of kernel */
/* add KERNEL_ALIGN if we have to align */
aligned_size = boot_info.memory[0].addr & (KERNEL_ALIGN - 1); aligned_size = boot_info.memory[0].addr & (KERNEL_ALIGN - 1);
if ( aligned_size > 0 ) if ( aligned_size > 0 )
{ {