char *platform_get_amigaos3_runtime_cpu(void) { #ifdef IS_POWERUP struct Caos *MyCaos = NULL; #endif #ifdef IS_WARPOS struct PPCArgs *pa = NULL; struct TagItem ti_cputype[] = {{GETINFO_CPU, 0}, {TAG_END, 0}}; int cpu_type = 0; #endif UWORD attn = 0; char *ppc = NULL; char *m68k = NULL; if (!got_cpu) { #ifdef IS_POWERUP if (MyCaos = (struct Caos*)PPCAllocVec(sizeof(struct Caos), MEMF_PUBLIC|MEMF_CLEAR)) { MyCaos->caos_Un.Function = (APTR)&M68kGetAttn; MyCaos->M68kCacheMode = IF_CACHEFLUSHNO; MyCaos->PPCCacheMode = IF_CACHEFLUSHNO; PPCCallM68k(MyCaos); attn = (UWORD)MyCaos->d0; PPCFreeVec(MyCaos); } switch (PPCGetAttr(PPCINFOTAG_CPU)) { case CPU_603: ppc = "PPC603"; break; case CPU_604: ppc = "PPC604"; break; case CPU_602: ppc = "PPC602"; break; case CPU_603e: ppc = "PPC603e"; break; case CPU_603p: ppc = "PPC603p"; break; case CPU_604e: ppc = "PPC604e"; break; default: ppc = "PPC"; } #else #ifdef IS_WARPOS if (pa = (struct PPCArgs*)AllocVecPPC(sizeof(struct PPCArgs), MEMF_PUBLIC|MEMF_CLEAR, 0)) { pa->PP_Code = (APTR)&M68kGetAttn; Run68K(pa); WaitFor68K(pa); attn = (UWORD)pa->PP_Regs[PPREG_D0]; FreeVecPPC(pa); } GetInfo(ti_cputype); cpu_type = ti_cputype[0].ti_Data; switch (cpu_type) { case CPUF_620: ppc = "PPC620"; break; case CPUF_604E: ppc = "PPC604e"; break; case CPUF_604: ppc = "PPC604"; break; case CPUF_603E: ppc = "PPC603e"; break; case CPUF_603: ppc = "PPC603"; break; default: ppc = "PPC"; } #else attn = SysBase->AttnFlags; if (attn & AFF_4XX) { ppc = "PPC4xx"; } else if (attn & AFF_7400) { ppc = "PPC7400"; } else if (attn & AFF_750) { ppc = "PPC750"; } else if (attn & AFF_604) { ppc = "PPC604"; } else if (attn & AFF_603) { ppc = "PPC603"; } #endif #endif if (attn & AFF_68060) { m68k = "68060"; } else if (attn & AFF_68040) { m68k = "68040"; } else if (attn & AFF_68030) { m68k = "68030"; } else if (attn & AFF_68020) { m68k = "68020"; } else if (attn & AFF_68010) { m68k = "68010"; } else { m68k = "68000"; } if (ppc) { #if defined(IS_POWERUP) || defined(IS_WARPOS) sprintf(cpu_retval, "%s (m68k code on %s)", ppc, m68k); #else sprintf(cpu_retval, "%s (emulated on %s)", m68k, ppc); #endif } else { sprintf(cpu_retval, "%s", m68k); } got_cpu = 1; } return cpu_retval; }
int amigaInit(int *argc, char **argv[]) { int done = TRUE; #if !defined(__POWERUP__) && !defined(__amigaos4__) && !defined(__MORPHOS__) if (!MemInit()) return FALSE; #endif #ifdef __OS3PPC__ /* ** PPC */ /* Set the priority of the PPC 68k mirror main task */ #ifdef CHANGE_MIRROR_TASK_PRI Old68kMirrorPri = SetTaskPri(FindTask(NULL), 2); #endif #ifdef __POWERUP__ /* ** PowerUp */ /* Requires ppc.library 46.30 (or PPCLibEmu), due to timer/signal bugs */ #define PPCINFOTAG_EMULATION (TAG_USER + 0x1f0ff) if (PPCGetAttr(PPCINFOTAG_EMULATION) == 'WARP') { if (!((PPCVersion() == 46 && PPCRevision() >= 29) || PPCVersion() > 46)) { printf("Requires PPCLibEmu 0.8a or higher!\n"); done = FALSE; } } else { if (!((PPCVersion() == 46 && PPCRevision() >= 30) || PPCVersion() > 46)) { printf("Requires ppc.library 46.30 or higher!\n"); done = FALSE; } } if (done) { if (PPCGetTaskAttr(PPCTASKTAG_STACKSIZE) < 200000) { printf("Please increase stack size to at least 200000 bytes!\n"); done = FALSE; } } if (done) { done = ((PPCLibBase = OpenLibrary("ppc.library",46)) != NULL); } if (done) { struct TagItem tags[2] = { {PPCPORTTAG_NAME, (ULONG)"dnetc"}, {TAG_END,0} }; void *port; if (!(port = PPCObtainPort(tags))) { done = FALSE; if ((TriggerPort = PPCCreatePort(tags))) { done = TRUE; } } else { PPCReleasePort(port); } } #else /* ** WarpOs */ if (!FindPortPPC("dnetc")) { if ((TriggerPort = CreateMsgPortPPC())) { TriggerPort->mp_Port.mp_Node.ln_Name = "dnetc"; TriggerPort->mp_Port.mp_Node.ln_Pri = 0; AddPortPPC(TriggerPort); } else { done = FALSE; } } #endif #else /* ** 68K / OS4 / MorphOS */ struct MsgPort *portexists; Forbid(); portexists = FindPort("dnetc"); if (!portexists) { if ((TriggerPort = CreateMsgPort())) { TriggerPort->mp_Node.ln_Name = "dnetc"; TriggerPort->mp_Node.ln_Pri = 0; AddPort(TriggerPort); } else { done = FALSE; } } Permit(); #endif if (!TimerBase && done) done = GlobalTimerInit(); if (!done) amigaExit(); #ifndef NO_GUI /* Workbench startup */ if (done && *argc == 0) { struct WBStartup *wbs = (struct WBStartup *)*argv; struct WBArg *arg = wbs->sm_ArgList; static char *newargv[1]; newargv[0] = (char *)arg->wa_Name; *argc = 1; *argv = newargv; if (wbs->sm_NumArgs > 1) { /* Started via a project icon */ arg = &wbs->sm_ArgList[1]; } if (!(amigaGUIInit((char *)wbs->sm_ArgList->wa_Name,arg))) { if (!(amigaOpenNewConsole("CON://630/300/distributed.net client/CLOSE/WAIT"))) { done = FALSE; } } } #endif #if USE_RESETHANDLER if (done) { add_resethandler(); } #endif return(done); }