-extern const char version[];
-extern const char version_variant[];
-
-extern unsigned int intstack_top_ss; /* declared in start.s */
-extern unsigned int debstackptr; /* declared in start.s */
-extern unsigned int debstack_top_ss; /* declared in start.s */
-
-extern void thandler(void); /* trap handler */
-extern void ihandler(void); /* interrupt handler */
-extern void shandler(void); /* syscall handler */
-extern void chandler(void); /* system choke */
-extern void fpu_switch(void); /* fp handler */
-extern void vec_switch(void); /* vector handler */
-extern void atomic_switch_trap(void); /* fast path atomic thread switch */
-
-void (*exception_handlers[])(void) = {
- thandler, /* 0x000 INVALID EXCEPTION (T_IN_VAIN) */
- thandler, /* 0x100 System reset (T_RESET) */
- thandler, /* 0x200 Machine check (T_MACHINE_CHECK) */
- thandler, /* 0x300 Data access (T_DATA_ACCESS) */
- thandler, /* 0x400 Instruction access (T_INSTRUCTION_ACCESS) */
- ihandler, /* 0x500 External interrupt (T_INTERRUPT) */
- thandler, /* 0x600 Alignment (T_ALIGNMENT) */
- thandler, /* 0x700 fp exc, ill/priv instr, trap (T_PROGRAM) */
- fpu_switch, /* 0x800 Floating point disabled (T_FP_UNAVAILABLE) */
- ihandler, /* 0x900 Decrementer (T_DECREMENTER) */
- thandler, /* 0xA00 I/O controller interface (T_IO_ERROR) */
- thandler, /* 0xB00 INVALID EXCEPTION (T_RESERVED) */
- shandler, /* 0xC00 System call exception (T_SYSTEM_CALL) */
- thandler, /* 0xD00 Trace (T_TRACE) */
- thandler, /* 0xE00 FP assist (T_FP_ASSIST) */
- thandler, /* 0xF00 Performance monitor (T_PERF_MON) */
- vec_switch, /* 0xF20 VMX (T_VMX) */
- thandler, /* 0x1000 INVALID EXCEPTION (T_INVALID_EXCP0) */
- thandler, /* 0x1100 INVALID EXCEPTION (T_INVALID_EXCP1) */
- thandler, /* 0x1200 INVALID EXCEPTION (T_INVALID_EXCP2) */
- thandler, /* 0x1300 instruction breakpoint (T_INSTRUCTION_BKPT) */
- ihandler, /* 0x1400 system management (T_SYSTEM_MANAGEMENT) */
- thandler, /* 0x1600 Altivec Assist (T_ALTIVEC_ASSIST) */
- ihandler, /* 0x1700 Thermal interruption (T_THERMAL) */
- thandler, /* 0x1800 INVALID EXCEPTION (T_INVALID_EXCP5) */
- thandler, /* 0x1900 INVALID EXCEPTION (T_INVALID_EXCP6) */
- thandler, /* 0x1A00 INVALID EXCEPTION (T_INVALID_EXCP7) */
- thandler, /* 0x1B00 INVALID EXCEPTION (T_INVALID_EXCP8) */
- thandler, /* 0x1C00 INVALID EXCEPTION (T_INVALID_EXCP9) */
- thandler, /* 0x1D00 INVALID EXCEPTION (T_INVALID_EXCP10) */
- thandler, /* 0x1E00 INVALID EXCEPTION (T_INVALID_EXCP11) */
- thandler, /* 0x1F00 INVALID EXCEPTION (T_INVALID_EXCP12) */
- thandler, /* 0x1F00 INVALID EXCEPTION (T_INVALID_EXCP13) */
- thandler, /* 0x2000 Run Mode/Trace (T_RUNMODE_TRACE) */
-
- ihandler, /* Software Signal processor (T_SIGP) */
- thandler, /* Software Preemption (T_PREEMPT) */
- ihandler, /* Software INVALID EXCEPTION (T_CSWITCH) */
- ihandler, /* Software Shutdown Context (T_SHUTDOWN) */
- chandler /* Software System choke (crash) (T_CHOKE) */
-};
-
-int pc_trace_buf[1024] = {0};
-int pc_trace_cnt = 1024;
-
-void ppc_init(boot_args *args)
-{
- int i;
- unsigned long *src,*dst;
- char *str;
- unsigned long addr, videoAddr;
- unsigned int maxmem;
- bat_t bat;
- extern vm_offset_t static_memory_end;
+extern unsigned int mckFlags;
+extern vm_offset_t intstack;
+extern vm_offset_t debstack;
+
+extern unsigned int extPatchMCK;
+extern unsigned int extPatch32;
+extern unsigned int hwulckPatch_isync;
+extern unsigned int hwulckPatch_eieio;
+extern unsigned int hwulckbPatch_isync;
+extern unsigned int hwulckbPatch_eieio;
+extern unsigned int mulckPatch_isync;
+extern unsigned int mulckPatch_eieio;
+extern unsigned int mulckePatch_isync;
+extern unsigned int mulckePatch_eieio;
+extern unsigned int sulckPatch_isync;
+extern unsigned int sulckPatch_eieio;
+extern unsigned int rwlesPatch_isync;
+extern unsigned int rwlesPatch_eieio;
+extern unsigned int rwldPatch_isync;
+extern unsigned int rwldPatch_eieio;
+extern unsigned int bcopy_nop_if_32bit;
+extern unsigned int bcopy_nc_nop_if_32bit;
+extern unsigned int memcpy_nop_if_32bit;
+extern unsigned int xsum_nop_if_32bit;
+extern unsigned int uft_nop_if_32bit;
+extern unsigned int uft_uaw_nop_if_32bit;
+extern unsigned int uft_cuttrace;
+
+int forcenap = 0;
+int wcte = 0; /* Non-cache gather timer disabled */
+
+int debug_task;
+
+patch_entry_t patch_table[] = {
+ {&extPatch32, 0x60000000, PATCH_FEATURE, PatchExt32},
+ {&extPatchMCK, 0x60000000, PATCH_PROCESSOR, CPU_SUBTYPE_POWERPC_970},
+ {&hwulckPatch_isync, 0x60000000, PATCH_FEATURE, PatchLwsync},
+ {&hwulckPatch_eieio, 0x7c2004ac, PATCH_FEATURE, PatchLwsync},
+ {&hwulckbPatch_isync, 0x60000000, PATCH_FEATURE, PatchLwsync},
+ {&hwulckbPatch_eieio, 0x7c2004ac, PATCH_FEATURE, PatchLwsync},
+ {&mulckPatch_isync, 0x60000000, PATCH_FEATURE, PatchLwsync},
+ {&mulckPatch_eieio, 0x7c2004ac, PATCH_FEATURE, PatchLwsync},
+ {&mulckePatch_isync, 0x60000000, PATCH_FEATURE, PatchLwsync},
+ {&mulckePatch_eieio, 0x7c2004ac, PATCH_FEATURE, PatchLwsync},
+ {&sulckPatch_isync, 0x60000000, PATCH_FEATURE, PatchLwsync},
+ {&sulckPatch_eieio, 0x7c2004ac, PATCH_FEATURE, PatchLwsync},
+ {&rwlesPatch_isync, 0x60000000, PATCH_FEATURE, PatchLwsync},
+ {&rwlesPatch_eieio, 0x7c2004ac, PATCH_FEATURE, PatchLwsync},
+ {&rwldPatch_isync, 0x60000000, PATCH_FEATURE, PatchLwsync},
+ {&rwldPatch_eieio, 0x7c2004ac, PATCH_FEATURE, PatchLwsync},
+ {&bcopy_nop_if_32bit, 0x60000000, PATCH_FEATURE, PatchExt32},
+ {&bcopy_nc_nop_if_32bit,0x60000000, PATCH_FEATURE, PatchExt32},
+ {&memcpy_nop_if_32bit, 0x60000000, PATCH_FEATURE, PatchExt32},
+ {&xsum_nop_if_32bit, 0x60000000, PATCH_FEATURE, PatchExt32},
+ {&uft_nop_if_32bit, 0x60000000, PATCH_FEATURE, PatchExt32},
+ {&uft_uaw_nop_if_32bit, 0x60000000, PATCH_FEATURE, PatchExt32},
+ {&uft_cuttrace, 0x60000000, PATCH_FEATURE, PatchExt32},
+ {NULL, 0x00000000, PATCH_END_OF_TABLE, 0}
+ };
+
+
+/*
+ * Forward definition
+ */
+void ppc_init(
+ boot_args *args);
+
+void ppc_init_cpu(
+ struct per_proc_info *proc_info);
+