diff --git a/MakeFile b/MakeFile index fc92f9b..19f3139 100644 --- a/MakeFile +++ b/MakeFile @@ -26,7 +26,7 @@ Apps = :Apps: {IM}Linker Ä {IM}Linker.c.o ILink -d -t 'MPST' -c 'MPS ' -o {Targ} {MpwToolLibs68k} {Deps} -{Apps}TestWedge Ä {IM}Wedge.c.x {IM}NKShim.s.x +{Apps}TestWedge Ä {IM}Wedge.c.x PPCLink -d -t 'APPL' -c 'siow' -o {Targ} {Deps} {SiowLibsPPC} Rez -a "{RIncludes}SIOW.r" -d DEFAULT_SAVE_PREF=1 -o {Targ} diff --git a/NKShim.h b/NKShim.h deleted file mode 100644 index 6704e8c..0000000 --- a/NKShim.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - - - -OSErr NKxprintf(char *); - - - -enum { - kNKSystemInfo = 2, - kNKDiagInfo = 3, - kNKNanoKernelInfo = 4, - kNKProcessorInfo = 5, - kNKHWInfo = 6, - kNKProcessorState = 7, -}; - -OSErr NKLocateInfoRecord(long whichRecord, char **record, long *version, long *length); - - - -OSErr NKKernelDebuggerCmd(char *cmd); diff --git a/NKShim.s b/NKShim.s deleted file mode 100644 index a09518c..0000000 --- a/NKShim.s +++ /dev/null @@ -1,84 +0,0 @@ -; MakeFunction sets up everything you need to make an assembly function -; callable from C and debuggable with a symbolic debugger. It does the following: -; - export the function's transition vector -; - export the function name -; - create a toc entry for the function's transition vector -; - create the transition vector, which must contain -; - the function entry point (the name of the function) -; - the TOC anchor (the predefined variable TOC[tc0]) -; - tell PPCAsm to create a function entry point symbol for symbolic debuggers -; - create a csect for the function (one csect per function lets the -; linker do dead code stripping, resulting in smaller executables) - - MACRO - MakeFunction &fnName - EXPORT &fnName[DS] - EXPORT .&fnName[PR] - - TC &fnName[TC], &fnName[DS] - - CSECT &fnName[DS] - DC.L .&fnName[PR] - DC.L TOC[tc0] - - CSECT .&fnName[PR] - FUNCTION .&fnName[PR] - - ENDM - -linkageArea: set 24 ; constant comes from the PowerPC Runtime Architecture Document -CalleesParams: set 32 ; always leave space for GPR's 3-10 -CalleesLocalVars: set 0 ; NKxprintf doesn't have any -numGPRs: set 0 ; num volitile GPR's (GPR's 13-31) used by NKxprintf -numFPRs: set 0 ; num volitile FPR's (FPR's 14-31) used by NKxprintf - -spaceToSave: set linkageArea + CalleesParams + CalleesLocalVars + 4*numGPRs + 8*numFPRs - - ; declare the C function DisplayAlert as external - import .DisplayAlert - - import gHelloString ; global variable from C program - import gGoodbyeString ; global variable from C program - - toc - tc gHelloString[TC], gHelloString - tc gGoodbyeString[TC], gGoodbyeString - - -; Call the MakeFunction macro, defined in MakeFunction.s to begin the function - MakeFunction NKxprintf - - li r0, 96 - sc - blr - - - MakeFunction NKLocateInfoRecord ; Lifted shamelessly from MPLibrary - - stw r4,0x001C(SP) - stw r5,0x0020(SP) - stw r6,0x0024(SP) - li r0,107 - sc - cmpwi r3,0 - bnelr - lwz r7,0x001C(SP) - lwz r8,0x0020(SP) - lwz r9,0x0024(SP) - cmplwi cr5,r7,0x0000 - cmplwi cr6,r8,0x0000 - cmplwi cr7,r9,0x0000 - beq cr5,$+0x0008 ; 0x00008440 - stw r4,0x0000(r7) - beq cr6,$+0x0008 ; 0x00008448 - stw r5,0x0000(r8) - beq cr7,$+0x0008 ; 0x00008450 - stw r6,0x0000(r9) - blr - - - MakeFunction NKKernelDebuggerCmd - - li r0, 200 - sc - blr diff --git a/Wedge.c b/Wedge.c index 57715e8..9a2b62a 100644 --- a/Wedge.c +++ b/Wedge.c @@ -1,5 +1,4 @@ #include "PPCInfoRecordsPriv.h" -#include "NKShim.h" #include @@ -734,7 +733,6 @@ void main(void) { char ci_tmp[kConfigInfoSize], hi_tmp[kHardwareInfoSize]; char *ci, *hi; - long nk_struct_ver, nk_struct_len; int ret; printf("Hello from the (dry-run) Wedge.\n"); @@ -742,7 +740,7 @@ void main(void) ci = (char *)0x68fef000UL; printf(" ConfigInfo @ %08x\n", ci); - NKLocateInfoRecord(6, &hi, &nk_struct_ver, &nk_struct_len); + hi = *(char **)nkHWInfoPtr; printf(" HardwareInfo @ %08x\n", hi); printf("\n");