Add some simplified structure definitions the way NetBSD does.

Implement cpu detection using Exec's AttnFlags.
Now panics a little later.

Note you need to tell UAE to emulate a 040 now (020 not supported) with -C4 to boot.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38956 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol
2010-10-12 10:11:04 +00:00
parent 9d570aa4dd
commit 14016c7ce9
3 changed files with 92 additions and 6 deletions
+38 -3
View File
@@ -36,8 +36,43 @@
static status_t
check_cpu_features()
{
//TODO
return B_ERROR;
uint16 AttnFlags = SysBase->AttnFlags;
int cpu = 0;
int fpu = 0;
// check fpu flags first, since they are also set for 040
if (AttnFlags & AFF_68881)
fpu = 68881;
if (AttnFlags & AFF_68882)
fpu = 68882;
//if (AttnFlags & AFF_68010)
// return B_ERROR;
//if (AttnFlags & AFF_68020)
// return B_ERROR;
if (AttnFlags & AFF_68030)
cpu = 68030;
if (AttnFlags & AFF_68040)
cpu = fpu = 68040;
//if (AttnFlags & AFF_FPU40)
// ;
//panic("cpu %d fpu %d flags 0x%04x", cpu, fpu, AttnFlags);
if (!cpu || !fpu)
return B_ERROR;
gKernelArgs.arch_args.cpu_type = cpu;
gKernelArgs.arch_args.mmu_type = cpu;
gKernelArgs.arch_args.fpu_type = fpu;
// if (AttnFlags & AFF_68060) true
gKernelArgs.arch_args.has_lpstop = false;
gKernelArgs.arch_args.platform = M68K_PLATFORM_AMIGA;
gKernelArgs.arch_args.machine = 0; //XXX
return B_OK;
}
#warning M68K: move and implement system_time()
@@ -65,7 +100,7 @@ extern "C" void
cpu_init()
{
if (check_cpu_features() != B_OK)
panic("You need a 68020 or higher in order to boot!\n");
panic("You need a 68030 or higher in order to boot!\n");
gKernelArgs.num_cpus = 1;
// this will eventually be corrected later on
@@ -969,10 +969,38 @@ typedef void *APTR;
// <exec/library.h>
struct Library;
// cf.
// http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-4-0/src/sys/arch/amiga/stand/bootblock/boot/amigatypes.h
struct Library {
uint8 dummy1[10];
uint16 Version, Revision;
uint8 dummy2[34-24];
};
// <exec/execbase.h>
struct MemHead {
struct MemHead *next;
uint8 dummy1[9-4];
uint8 Pri;
uint8 dummy2[14-10];
uint16 Attribs;
uint32 First, Lower, Upper, Free;
};
struct ExecBase {
struct Library LibNode;
uint8 dummy1[296-34];
uint16 AttnFlags;
uint8 dummy2[300-298];
void *ResModules;
uint8 dummy3[322-304];
struct MemHead *MemList;
uint8 dummy4[568-326];
uint32 EClockFreq;
uint8 dummy5[632-334];
} _PACKED;
#endif /* __ASSEMBLER__ */
@@ -994,6 +1022,29 @@ struct Library;
// <exec/io.h>
/*
struct IORequest {
struct Message io_Message;
struct Device *io_Device;
struct Unit *io_Unit;
uint16 io_Command;
uint8 io_Flags;
int8 io_Error;
};
struct IOStdReq {
struct Message io_Message;
struct Device *io_Device;
struct Unit *io_Unit;
uint16 io_Command;
uint8 io_Flags;
int8 io_Error;
uint32 io_Actual;
uint32 io_Length;
void *io_Data;
uint32 io_Offset;
};
*/
#endif /* __ASSEMBLER__ */
@@ -1045,7 +1096,7 @@ struct Library;
#ifndef __ASSEMBLER__
extern Library *EXEC_BASE_NAME;
extern ExecBase *EXEC_BASE_NAME;
#define AllocAbs(par1, last) \
LP2(0xcc, APTR, AllocAbs, unsigned long, par1, d0, APTR, last, a1, \
@@ -120,7 +120,6 @@ platform_exit(void)
extern "C" void
_start(void)
{
panic("plop %d", 1234);
stage2_args args;
//asm("cld"); // Ain't nothing but a GCC thang.
@@ -137,6 +136,7 @@ _start(void)
console_init();
dprintf("ramtop = %p\n", NULL);
cpu_init();
panic("plop %d", 1234);
mmu_init();
// wait a bit to give the user the opportunity to press a key