|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: ! 26: #include <machdep/ppc/asm.h> ! 27: #include <machdep/ppc/proc_reg.h> ! 28: #include <mach/ppc/vm_param.h> ! 29: #include <assym.h> ! 30: ! 31: /* ! 32: * Interrupt and bootup stack for initial processor ! 33: */ ! 34: ! 35: .file "start.s" ! 36: ! 37: .data ! 38: .align PPC_PGSHIFT /* Align on page boundry */ ! 39: .set ., .+PPC_PGBYTES /* Red zone for interrupt stack*/ ! 40: .globl EXT(intstack) /* intstack itself */ ! 41: EXT(intstack): ! 42: .set ., .+INTSTACK_SIZE ! 43: ! 44: /* ! 45: * intstack_top_ss points to the topmost saved ! 46: * state structure in the intstack ! 47: */ ! 48: .align ALIGNMENT ! 49: .globl EXT(intstack_top_ss) ! 50: EXT(intstack_top_ss): ! 51: .long EXT(intstack)+INTSTACK_SIZE-SS_SIZE ! 52: ! 53: ! 54: /* GDB stack - used by the debugger if present */ ! 55: .globl EXT(gdbstack) ! 56: EXT(gdbstack): ! 57: .set ., .+KERNSTACK_SIZE ! 58: ! 59: /* ! 60: * gdbstack_top_ss points to the topmost saved ! 61: * state structure in the gdbstack ! 62: */ ! 63: .align ALIGNMENT ! 64: .globl EXT(gdbstack_top_ss) ! 65: EXT(gdbstack_top_ss): ! 66: .long EXT(gdbstack)+KERNSTACK_SIZE-SS_SIZE ! 67: ! 68: .globl EXT(gdbstackptr) ! 69: EXT(gdbstackptr): ! 70: .long EXT(gdbstack)+KERNSTACK_SIZE-SS_SIZE ! 71: ! 72: ! 73: /* ! 74: * All CPUs start here. ! 75: * ! 76: * How we got to here (as of today 1997.02.27) in execution: ! 77: * ! 78: * OpenFirmware loaded the 'SecondaryLoader' from a bootp/tftp server ! 79: * on the same subnet as this machine. The SecondaryLoader brought ! 80: * this mach-o (MH_PRELOAD) image into memory and jumped to the ! 81: * start address. ! 82: * ! 83: * We expect that: ! 84: * we are in supervisor mode (of course!) ! 85: * Translations are off ! 86: * ARG0 == pointer to startup parameters ! 87: * ! 88: * We do the following: ! 89: * Force the MSR to a known state ! 90: * Switch to our stack ! 91: * Call into the C code. ! 92: * ! 93: */ ! 94: ! 95: .data ! 96: .align 3 ! 97: EXT(FloatInit): ! 98: .long 0xC24BC195 /* Initial value */ ! 99: .long 0x87859393 /* of floating point registers */ ! 100: .globl EXT(FloatInit) ! 101: ! 102: .text ! 103: .align 2 ! 104: ! 105: ASENTRY(start) ! 106: ! 107: ! 108: #ifndef UseOpenFirmware ! 109: /* Make sure our MSR is valid */ ! 110: li r0, MSR_VM_OFF ! 111: sync ! 112: mtmsr r0 ! 113: isync ! 114: #ifdef UNCACHED_DATA_604 ! 115: lis r28, 0x4 /* flush 128K */ ! 116: lis r0, 0x2 ! 117: .L_loop_flush: ! 118: lwzx r29, 0, r28 ! 119: subic r28, r28, 32 ! 120: cmpw r0, r28 ! 121: bge+ .L_loop_flush ! 122: #endif /* UNCACHED_DATA_604 */ ! 123: ! 124: /* li r28, 0x84 */ /* turn on branch prediction, turn of serial */ ! 125: /* li r28, 0 */ ! 126: ! 127: mfspr r28, hid0 ! 128: ! 129: #ifdef UNCACHED_DATA_604 ! 130: rlwinm r28, r28, 0, 21+1, 21-1 /* invalidate data cache */ ! 131: rlwinm r28, r28, 0, 17+1, 17-1 /* turn off data cache */ ! 132: #endif /* UNCACHED_DATA_604 */ ! 133: #ifdef UNCACHED_INST_604 ! 134: rlwinm r28, r28, 0, 20+1, 20-1 /* invalidate inst cache */ ! 135: rlwinm r28, r28, 0, 16+1, 16-1 /* turn off inst cache */ ! 136: #endif /* UNCACHED_INST_604 */ ! 137: ! 138: //rlwinm r28, r28, 0, 24+1, 24-1 /* turn on serial execution */ ! 139: ! 140: mtspr hid0,r28 ! 141: ! 142: #endif /* UseOpenFirmware */ ! 143: ! 144: li r0, MSR_VM_OFF|MASK(MSR_FP) ! 145: mtmsr r0 ! 146: isync ! 147: ! 148: lis r29,hi16(EXT(FloatInit)) /* Get top of floating point init value */ ! 149: ori r29,r29,lo16(EXT(FloatInit)) /* Slam bottom */ ! 150: lfd f0,0(r29) /* Initialize FP0 */ ! 151: fmr f1,f0 /* Ours is not */ ! 152: fmr f2,f0 /* to wonder why, */ ! 153: fmr f3,f0 /* ours is but to */ ! 154: fmr f4,f0 /* do or die! */ ! 155: fmr f5,f0 ! 156: fmr f6,f0 ! 157: fmr f7,f0 ! 158: fmr f8,f0 ! 159: fmr f9,f0 ! 160: fmr f10,f0 ! 161: fmr f11,f0 ! 162: fmr f12,f0 ! 163: fmr f13,f0 ! 164: fmr f14,f0 ! 165: fmr f15,f0 ! 166: fmr f16,f0 ! 167: fmr f17,f0 ! 168: fmr f18,f0 ! 169: fmr f19,f0 ! 170: fmr f20,f0 ! 171: fmr f21,f0 ! 172: fmr f22,f0 ! 173: fmr f23,f0 ! 174: fmr f24,f0 ! 175: fmr f25,f0 ! 176: fmr f26,f0 ! 177: fmr f27,f0 ! 178: fmr f28,f0 ! 179: fmr f29,f0 ! 180: fmr f30,f0 ! 181: fmr f31,f0 ! 182: ! 183: li r0, MSR_VM_OFF ! 184: mtmsr r0 ! 185: isync ! 186: ! 187: addis r29, 0, hi16(EXT(intstack_top_ss)) ! 188: ori r29, r29, lo16(EXT(intstack_top_ss)) ! 189: lwz r29, 0(r29) ! 190: ! 191: #ifdef GPROF ! 192: subi r29, r29, FM_REDZONE ; we save more state in ppc_init() ! 193: #endif ! 194: ! 195: li r28, 0 ! 196: stw r28, FM_BACKPTR(r29) /* store a null frame backpointer */ ! 197: ! 198: /* move onto new stack */ ! 199: ! 200: mr r1, r29 ! 201: ! 202: bl EXT(ppc_init) ! 203: ! 204: /* Should never return */ ! 205: ! 206: BREAKPOINT_TRAP
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.