__inline ULONG DoMethodA( Object *obj, Msg msg ) { struct Caos c; c.caos_Un.Function = (APTR)_m68kDoMethodA; c.M68kCacheMode = IF_CACHEFLUSHALL; c.PPCCacheMode = IF_CACHEFLUSHALL; c.a0 = (ULONG)obj; c.a1 = (ULONG)msg; return PPCCallM68k( &c ); }
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; }
char *platform_get_amigaos3_runtime_os(void) { #ifdef IS_POWERUP struct Caos *MyCaos = NULL; #endif #ifdef IS_WARPOS struct PPCArgs *pa = NULL; #endif #if defined(IS_POWERUP) || defined(IS_WARPOS) ULONG wb_version = 0; ULONG ks_version = 0; ULONG ks_softver = 0; #endif #ifdef IS_POWERUP if (!wbretval) { if (MyCaos = (struct Caos*)PPCAllocVec(sizeof(struct Caos), MEMF_PUBLIC|MEMF_CLEAR)) { MyCaos->caos_Un.Function = (APTR)&M68kGetWB; MyCaos->M68kCacheMode = IF_CACHEFLUSHNO; MyCaos->PPCCacheMode = IF_CACHEFLUSHNO; PPCCallM68k(MyCaos); wb_version = (ULONG)MyCaos->d0; PPCFreeVec(MyCaos); MyCaos = NULL; } wbretval = number2workbench(wb_version >> 16, wb_version & 0xffff); } if (!ksretval) { if (MyCaos = (struct Caos*)PPCAllocVec(sizeof(struct Caos), MEMF_PUBLIC|MEMF_CLEAR)) { MyCaos->caos_Un.Function = (APTR)&M68kGetKS; MyCaos->M68kCacheMode = IF_CACHEFLUSHNO; MyCaos->PPCCacheMode = IF_CACHEFLUSHNO; PPCCallM68k(MyCaos); ks_version = (ULONG)MyCaos->d0; ks_softver = (ULONG)MyCaos->d1; PPCFreeVec(MyCaos); } ksretval = number2kickstart(ks_version >> 16, ks_version & 0xffff, ks_softver); } #else #ifdef IS_WARPOS if (!wbretval) { if (pa = (struct PPCArgs*)AllocVecPPC(sizeof(struct PPCArgs), MEMF_PUBLIC|MEMF_CLEAR, 0)) { pa->PP_Code = (APTR)&M68kGetWB; Run68K(pa); WaitFor68K(pa); wb_version = (ULONG)pa->PP_Regs[PPREG_D0]; FreeVecPPC(pa); pa = NULL; } wbretval = number2workbench(wb_version >> 16, wb_version & 0xffff); } if (!ksretval) { if (pa = (struct PPCArgs*)AllocVecPPC(sizeof(struct PPCArgs), MEMF_PUBLIC|MEMF_CLEAR, 0)) { pa->PP_Code = (APTR)&M68kGetKS; Run68K(pa); WaitFor68K(pa); ks_version = (ULONG)pa->PP_Regs[PPREG_D0]; ks_softver = (ULONG)pa->PP_Regs[PPREG_D1]; FreeVecPPC(pa); } ksretval = number2kickstart(ks_version >> 16, ks_version & 0xffff, ks_softver); } #else if (!wbretval) { /* arosc.library only opens if the aros kernel is used */ if (WorkbenchBase = OpenLibrary("arosc.library", 0)) { wbretval = "AROS"; } else { if (VersionBase = OpenLibrary("version.library", 0)) { wbretval = number2workbench(VersionBase->lib_Version, VersionBase->lib_Revision); if (!wbretval) { printf("WB major: %d, minor: %d\n", VersionBase->lib_Version, VersionBase->lib_Revision); } } else { wbretval = "1.0"; } } if (VersionBase) { CloseLibrary(VersionBase); } } if (!ksretval) { ksretval = number2kickstart(SysBase->LibNode.lib_Version, SysBase->LibNode.lib_Revision, SysBase->SoftVer); } #endif #endif if (wbretval && wbretval[0] == 'A') { sprintf(osretval, "AROS"); } else if (ksretval && ksretval[0] == 'A') { sprintf(osretval, "WorkBench %s (AROS KickStart ROM)", wbretval ? wbretval : "Unknown"); } else if (ksretval && ksretval[0] == 'O') { sprintf(osretval, "WorkBench %s (BlackBox/Petunia)", wbretval ? wbretval : "Unknown"); } else { sprintf(osretval, "WorkBench %s (KickStart %s)", wbretval ? wbretval : "Unknown", ksretval ? ksretval : "Unknown"); } return osretval; }