17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #include <sys/types.h> 307c478bd9Sstevel@tonic-gate #include <sys/disp.h> 317c478bd9Sstevel@tonic-gate #include <sys/promif.h> 327c478bd9Sstevel@tonic-gate #include <sys/clock.h> 337c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h> 347c478bd9Sstevel@tonic-gate #include <sys/stack.h> 357c478bd9Sstevel@tonic-gate #include <vm/as.h> 367c478bd9Sstevel@tonic-gate #include <vm/hat.h> 377c478bd9Sstevel@tonic-gate #include <sys/reboot.h> 387c478bd9Sstevel@tonic-gate #include <sys/avintr.h> 397c478bd9Sstevel@tonic-gate #include <sys/vtrace.h> 407c478bd9Sstevel@tonic-gate #include <sys/proc.h> 417c478bd9Sstevel@tonic-gate #include <sys/thread.h> 427c478bd9Sstevel@tonic-gate #include <sys/cpupart.h> 437c478bd9Sstevel@tonic-gate #include <sys/pset.h> 447c478bd9Sstevel@tonic-gate #include <sys/copyops.h> 457c478bd9Sstevel@tonic-gate #include <sys/chip.h> 467c478bd9Sstevel@tonic-gate #include <sys/disp.h> 477c478bd9Sstevel@tonic-gate #include <sys/debug.h> 487c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 497c478bd9Sstevel@tonic-gate #include <sys/x86_archext.h> 507c478bd9Sstevel@tonic-gate #include <sys/privregs.h> 517c478bd9Sstevel@tonic-gate #include <sys/machsystm.h> 527c478bd9Sstevel@tonic-gate #include <sys/ontrap.h> 537c478bd9Sstevel@tonic-gate #include <sys/bootconf.h> 547c478bd9Sstevel@tonic-gate #include <sys/kdi.h> 557c478bd9Sstevel@tonic-gate #include <sys/archsystm.h> 567c478bd9Sstevel@tonic-gate #include <sys/promif.h> 577c478bd9Sstevel@tonic-gate #include <sys/bootconf.h> 587c478bd9Sstevel@tonic-gate #include <sys/kobj.h> 597c478bd9Sstevel@tonic-gate #include <sys/kobj_lex.h> 607c478bd9Sstevel@tonic-gate #if defined(__amd64) 617c478bd9Sstevel@tonic-gate #include <sys/bootsvcs.h> 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * XX64 This stuff deals with switching stacks in case a trapping 657c478bd9Sstevel@tonic-gate * thread wants to call back into boot -after- boot has lost track 667c478bd9Sstevel@tonic-gate * of the mappings but before the kernel owns the console. 677c478bd9Sstevel@tonic-gate * 687c478bd9Sstevel@tonic-gate * (A better way to hide this would be to add a 'this' pointer to 697c478bd9Sstevel@tonic-gate * every boot syscall so that vmx could get at the resulting save 707c478bd9Sstevel@tonic-gate * area.) 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate struct boot_syscalls *_vmx_sysp; 747c478bd9Sstevel@tonic-gate static struct boot_syscalls __kbootsvcs; 757c478bd9Sstevel@tonic-gate extern struct boot_syscalls *sysp; 767c478bd9Sstevel@tonic-gate extern void _stack_safe_putchar(int c); 777c478bd9Sstevel@tonic-gate #endif 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate /* 807c478bd9Sstevel@tonic-gate * some globals for patching the result of cpuid 817c478bd9Sstevel@tonic-gate * to solve problems w/ creative cpu vendors 827c478bd9Sstevel@tonic-gate */ 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate extern uint32_t cpuid_feature_ecx_include; 857c478bd9Sstevel@tonic-gate extern uint32_t cpuid_feature_ecx_exclude; 867c478bd9Sstevel@tonic-gate extern uint32_t cpuid_feature_edx_include; 877c478bd9Sstevel@tonic-gate extern uint32_t cpuid_feature_edx_exclude; 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate /* 907c478bd9Sstevel@tonic-gate * External Routines: 917c478bd9Sstevel@tonic-gate */ 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate extern void init_tables(void); 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate static uint32_t 977c478bd9Sstevel@tonic-gate cpuid_getval(char *name) 987c478bd9Sstevel@tonic-gate { 997c478bd9Sstevel@tonic-gate char prop[32]; 1007c478bd9Sstevel@tonic-gate u_longlong_t ll; 1017c478bd9Sstevel@tonic-gate extern struct bootops *bootops; 1027c478bd9Sstevel@tonic-gate if ((BOP_GETPROPLEN(bootops, name) > sizeof (prop)) || 1037c478bd9Sstevel@tonic-gate (BOP_GETPROP(bootops, name, prop) < 0) || 1047c478bd9Sstevel@tonic-gate (kobj_getvalue(prop, &ll) == -1)) 1057c478bd9Sstevel@tonic-gate return (0); 1067c478bd9Sstevel@tonic-gate return ((uint32_t)ll); 1077c478bd9Sstevel@tonic-gate } 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* 1107c478bd9Sstevel@tonic-gate * Setup routine called right before main(). Interposing this function 1117c478bd9Sstevel@tonic-gate * before main() allows us to call it in a machine-independent fashion. 1127c478bd9Sstevel@tonic-gate */ 1137c478bd9Sstevel@tonic-gate void 1147c478bd9Sstevel@tonic-gate mlsetup(struct regs *rp) 1157c478bd9Sstevel@tonic-gate { 1167c478bd9Sstevel@tonic-gate extern struct classfuncs sys_classfuncs; 1177c478bd9Sstevel@tonic-gate extern struct chip cpu0_chip; 1187c478bd9Sstevel@tonic-gate extern disp_t cpu0_disp; 1197c478bd9Sstevel@tonic-gate extern char t0stack[]; 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate ASSERT_STACK_ALIGNED(); 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate #if defined(__amd64) 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate #if (BS_VERSION > 4) 1267c478bd9Sstevel@tonic-gate /* 1277c478bd9Sstevel@tonic-gate * When new boot_syscalls are added to the vector, this routine 1287c478bd9Sstevel@tonic-gate * must be modified to copy them into the kernel's copy of the 1297c478bd9Sstevel@tonic-gate * vector. 1307c478bd9Sstevel@tonic-gate */ 1317c478bd9Sstevel@tonic-gate #error mlsetup() must be updated for amd64 to support new boot_syscalls 1327c478bd9Sstevel@tonic-gate #endif /* (BS_VERSION > 4) */ 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate /* 1357c478bd9Sstevel@tonic-gate * XX64 This remaps vmx's putchar to use the kernel's version 1367c478bd9Sstevel@tonic-gate * that switches stacks before diving into vmx 1377c478bd9Sstevel@tonic-gate * See explanation/complaints in commentary above. 1387c478bd9Sstevel@tonic-gate */ 1397c478bd9Sstevel@tonic-gate _vmx_sysp = sysp; 1407c478bd9Sstevel@tonic-gate sysp = &__kbootsvcs; 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate sysp->bsvc_getchar = _vmx_sysp->bsvc_getchar; 1437c478bd9Sstevel@tonic-gate sysp->bsvc_putchar = _stack_safe_putchar; 1447c478bd9Sstevel@tonic-gate sysp->bsvc_ischar = _vmx_sysp->bsvc_ischar; 1457c478bd9Sstevel@tonic-gate #endif 1467c478bd9Sstevel@tonic-gate /* 1477c478bd9Sstevel@tonic-gate * initialize cpu_self 1487c478bd9Sstevel@tonic-gate */ 1497c478bd9Sstevel@tonic-gate cpu[0]->cpu_self = cpu[0]; 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate /* 1527c478bd9Sstevel@tonic-gate * check if we've got special bits to clear or set 1537c478bd9Sstevel@tonic-gate * when checking cpu features 1547c478bd9Sstevel@tonic-gate */ 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate cpuid_feature_ecx_include = 1577c478bd9Sstevel@tonic-gate cpuid_getval("cpuid_feature_ecx_include"); 1587c478bd9Sstevel@tonic-gate cpuid_feature_ecx_exclude = 1597c478bd9Sstevel@tonic-gate cpuid_getval("cpuid_feature_ecx_exclude"); 1607c478bd9Sstevel@tonic-gate cpuid_feature_edx_include = 1617c478bd9Sstevel@tonic-gate cpuid_getval("cpuid_feature_edx_include"); 1627c478bd9Sstevel@tonic-gate cpuid_feature_edx_exclude = 1637c478bd9Sstevel@tonic-gate cpuid_getval("cpuid_feature_edx_exclude"); 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate /* 1667c478bd9Sstevel@tonic-gate * The first lightweight pass (pass0) through the cpuid data 1677c478bd9Sstevel@tonic-gate * was done in locore before mlsetup was called. Do the next 1687c478bd9Sstevel@tonic-gate * pass in C code. 1697c478bd9Sstevel@tonic-gate * 1707c478bd9Sstevel@tonic-gate * The x86_feature bits are set here on the basis of the capabilities 1717c478bd9Sstevel@tonic-gate * of the boot CPU. Note that if we choose to support CPUs that have 1727c478bd9Sstevel@tonic-gate * different feature sets (at which point we would almost certainly 1737c478bd9Sstevel@tonic-gate * want to set the feature bits to correspond to the feature 1747c478bd9Sstevel@tonic-gate * minimum) this value may be altered. 1757c478bd9Sstevel@tonic-gate */ 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate x86_feature = cpuid_pass1(cpu[0]); 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate /* 1807c478bd9Sstevel@tonic-gate * Initialize idt0, gdt0, ldt0_default, ktss0 and dftss. 1817c478bd9Sstevel@tonic-gate */ 1827c478bd9Sstevel@tonic-gate init_tables(); 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate #if defined(__amd64) 1857c478bd9Sstevel@tonic-gate /*CSTYLED*/ 1867c478bd9Sstevel@tonic-gate { 1877c478bd9Sstevel@tonic-gate /* 1887c478bd9Sstevel@tonic-gate * setup %gs for the kernel 1897c478bd9Sstevel@tonic-gate */ 1907c478bd9Sstevel@tonic-gate uint64_t addr64 = (uint64_t)&cpus[0]; 1917c478bd9Sstevel@tonic-gate wrmsr(MSR_AMD_GSBASE, &addr64); 1927c478bd9Sstevel@tonic-gate /* 1937c478bd9Sstevel@tonic-gate * XX64 We should never dereference off "other gsbase" or 1947c478bd9Sstevel@tonic-gate * "fsbase". So, we should arrange to point FSBASE and 1957c478bd9Sstevel@tonic-gate * KGSBASE somewhere truly awful e.g. point it at the last 1967c478bd9Sstevel@tonic-gate * valid address below the hole so that any attempts to index 1977c478bd9Sstevel@tonic-gate * off them cause an exception. 1987c478bd9Sstevel@tonic-gate * 1997c478bd9Sstevel@tonic-gate * For now, point it at 8G -- at least it should be unmapped 2007c478bd9Sstevel@tonic-gate * until some 64-bit processes run. 2017c478bd9Sstevel@tonic-gate */ 2027c478bd9Sstevel@tonic-gate addr64 = 0x200000000ul; 2037c478bd9Sstevel@tonic-gate wrmsr(MSR_AMD_FSBASE, &addr64); 2047c478bd9Sstevel@tonic-gate wrmsr(MSR_AMD_KGSBASE, &addr64); 2057c478bd9Sstevel@tonic-gate } 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate #elif defined(__i386) 2087c478bd9Sstevel@tonic-gate /* 2097c478bd9Sstevel@tonic-gate * enable large page support right here. 2107c478bd9Sstevel@tonic-gate */ 2117c478bd9Sstevel@tonic-gate if (x86_feature & X86_LARGEPAGE) { 2127c478bd9Sstevel@tonic-gate cr4_value |= CR4_PSE; 2137c478bd9Sstevel@tonic-gate if (x86_feature & X86_PGE) 2147c478bd9Sstevel@tonic-gate cr4_value |= CR4_PGE; 2157c478bd9Sstevel@tonic-gate setup_121_andcall(enable_big_page_support, cr4_value); 2167c478bd9Sstevel@tonic-gate } 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate /* 2197c478bd9Sstevel@tonic-gate * Some i386 processors do not implement the rdtsc instruction, 2207c478bd9Sstevel@tonic-gate * or at least they do not implement it correctly. 2217c478bd9Sstevel@tonic-gate * 2227c478bd9Sstevel@tonic-gate * For those that do, patch in the rdtsc instructions in 2237c478bd9Sstevel@tonic-gate * various parts of the kernel right now while the text is 2247c478bd9Sstevel@tonic-gate * still writable. 2257c478bd9Sstevel@tonic-gate */ 2267c478bd9Sstevel@tonic-gate if (x86_feature & X86_TSC) 2277c478bd9Sstevel@tonic-gate patch_tsc(); 2287c478bd9Sstevel@tonic-gate #endif 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate /* 2317c478bd9Sstevel@tonic-gate * initialize t0 2327c478bd9Sstevel@tonic-gate */ 2337c478bd9Sstevel@tonic-gate t0.t_stk = (caddr_t)rp - MINFRAME; 2347c478bd9Sstevel@tonic-gate t0.t_stkbase = t0stack; 2357c478bd9Sstevel@tonic-gate t0.t_pri = maxclsyspri - 3; 2367c478bd9Sstevel@tonic-gate t0.t_schedflag = TS_LOAD | TS_DONT_SWAP; 2377c478bd9Sstevel@tonic-gate t0.t_procp = &p0; 2387c478bd9Sstevel@tonic-gate t0.t_plockp = &p0lock.pl_lock; 2397c478bd9Sstevel@tonic-gate t0.t_lwp = &lwp0; 2407c478bd9Sstevel@tonic-gate t0.t_forw = &t0; 2417c478bd9Sstevel@tonic-gate t0.t_back = &t0; 2427c478bd9Sstevel@tonic-gate t0.t_next = &t0; 2437c478bd9Sstevel@tonic-gate t0.t_prev = &t0; 2447c478bd9Sstevel@tonic-gate t0.t_cpu = cpu[0]; 2457c478bd9Sstevel@tonic-gate t0.t_disp_queue = &cpu0_disp; 2467c478bd9Sstevel@tonic-gate t0.t_bind_cpu = PBIND_NONE; 2477c478bd9Sstevel@tonic-gate t0.t_bind_pset = PS_NONE; 2487c478bd9Sstevel@tonic-gate t0.t_cpupart = &cp_default; 2497c478bd9Sstevel@tonic-gate t0.t_clfuncs = &sys_classfuncs.thread; 2507c478bd9Sstevel@tonic-gate t0.t_copyops = NULL; 2517c478bd9Sstevel@tonic-gate THREAD_ONPROC(&t0, CPU); 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate lwp0.lwp_thread = &t0; 2547c478bd9Sstevel@tonic-gate lwp0.lwp_regs = (void *) rp; 2557c478bd9Sstevel@tonic-gate lwp0.lwp_procp = &p0; 2567c478bd9Sstevel@tonic-gate t0.t_tid = p0.p_lwpcnt = p0.p_lwprcnt = p0.p_lwpid = 1; 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate p0.p_exec = NULL; 2597c478bd9Sstevel@tonic-gate p0.p_stat = SRUN; 2607c478bd9Sstevel@tonic-gate p0.p_flag = SSYS; 2617c478bd9Sstevel@tonic-gate p0.p_tlist = &t0; 2627c478bd9Sstevel@tonic-gate p0.p_stksize = 2*PAGESIZE; 2637c478bd9Sstevel@tonic-gate p0.p_stkpageszc = 0; 2647c478bd9Sstevel@tonic-gate p0.p_as = &kas; 2657c478bd9Sstevel@tonic-gate p0.p_lockp = &p0lock; 2667c478bd9Sstevel@tonic-gate p0.p_brkpageszc = 0; 2677c478bd9Sstevel@tonic-gate sigorset(&p0.p_ignore, &ignoredefault); 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate CPU->cpu_thread = &t0; 2707c478bd9Sstevel@tonic-gate bzero(&cpu0_disp, sizeof (disp_t)); 2717c478bd9Sstevel@tonic-gate CPU->cpu_disp = &cpu0_disp; 2727c478bd9Sstevel@tonic-gate CPU->cpu_disp->disp_cpu = CPU; 2737c478bd9Sstevel@tonic-gate CPU->cpu_dispthread = &t0; 2747c478bd9Sstevel@tonic-gate CPU->cpu_idle_thread = &t0; 2757c478bd9Sstevel@tonic-gate CPU->cpu_flags = CPU_READY | CPU_RUNNING | CPU_EXISTS | CPU_ENABLE; 2767c478bd9Sstevel@tonic-gate CPU->cpu_dispatch_pri = t0.t_pri; 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate CPU->cpu_mask = 1; 2797c478bd9Sstevel@tonic-gate CPU->cpu_id = 0; 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate CPU->cpu_tss = &ktss0; 2827c478bd9Sstevel@tonic-gate 2837c478bd9Sstevel@tonic-gate CPU->cpu_pri = 12; /* initial PIL for the boot CPU */ 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate CPU->cpu_ldt = ldt0_default; /* default LDT */ 2867c478bd9Sstevel@tonic-gate CPU->cpu_gdt = gdt0; 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate /* 2897c478bd9Sstevel@tonic-gate * This must be done _after_ init_tables(), called above, has set up 2907c478bd9Sstevel@tonic-gate * ldt0_default_desc. 2917c478bd9Sstevel@tonic-gate */ 2927c478bd9Sstevel@tonic-gate #if defined(__amd64) 2937c478bd9Sstevel@tonic-gate /* 2947c478bd9Sstevel@tonic-gate * ldt0_default64 contains all invalid entries. We use that as p0's LDT 2957c478bd9Sstevel@tonic-gate * because p0 should never have any reason to use the LDT. This will 2967c478bd9Sstevel@tonic-gate * catch things early if such a scenario should ever occur. 2977c478bd9Sstevel@tonic-gate */ 2987c478bd9Sstevel@tonic-gate p0.p_ldt_desc = ldt0_default64_desc; 2997c478bd9Sstevel@tonic-gate #else 3007c478bd9Sstevel@tonic-gate p0.p_ldt_desc = ldt0_default_desc; 3017c478bd9Sstevel@tonic-gate #endif /* __amd64 */ 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate /* 3047c478bd9Sstevel@tonic-gate * Kernel IDT. 3057c478bd9Sstevel@tonic-gate */ 3067c478bd9Sstevel@tonic-gate CPU->cpu_idt = idt0; 3077c478bd9Sstevel@tonic-gate 3087c478bd9Sstevel@tonic-gate /* 3097c478bd9Sstevel@tonic-gate * Initialize thread/cpu microstate accounting here 3107c478bd9Sstevel@tonic-gate */ 3117c478bd9Sstevel@tonic-gate init_mstate(&t0, LMS_SYSTEM); 3127c478bd9Sstevel@tonic-gate init_cpu_mstate(CPU, CMS_SYSTEM); 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate /* 3157c478bd9Sstevel@tonic-gate * Initialize lists of available and active CPUs. 3167c478bd9Sstevel@tonic-gate */ 3177c478bd9Sstevel@tonic-gate cpu_list_init(CPU); 3187c478bd9Sstevel@tonic-gate 319*affbd3ccSkchow cpu_vm_data_init(CPU); 320*affbd3ccSkchow 3217c478bd9Sstevel@tonic-gate /* 3227c478bd9Sstevel@tonic-gate * Initialize the lgrp framework 3237c478bd9Sstevel@tonic-gate */ 3247c478bd9Sstevel@tonic-gate lgrp_init(); 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate /* 3277c478bd9Sstevel@tonic-gate * The lgroup code needs to at least know about a CPU's 3287c478bd9Sstevel@tonic-gate * chip association, but it's too early to fully initialize 3297c478bd9Sstevel@tonic-gate * cpu0_chip, since the device node for the boot CPU doesn't 3307c478bd9Sstevel@tonic-gate * exist yet. Initialize enough of it to get by until formal 3317c478bd9Sstevel@tonic-gate * initialization. 3327c478bd9Sstevel@tonic-gate */ 3337c478bd9Sstevel@tonic-gate CPU->cpu_rechoose = rechoose_interval; 3347c478bd9Sstevel@tonic-gate CPU->cpu_chip = &cpu0_chip; 3357c478bd9Sstevel@tonic-gate 3367c478bd9Sstevel@tonic-gate rp->r_fp = 0; /* terminate kernel stack traces! */ 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate prom_init("kernel", (void *)NULL); 3397c478bd9Sstevel@tonic-gate 3407c478bd9Sstevel@tonic-gate if (boothowto & RB_HALT) { 3417c478bd9Sstevel@tonic-gate prom_printf("unix: kernel halted by -h flag\n"); 3427c478bd9Sstevel@tonic-gate prom_enter_mon(); 3437c478bd9Sstevel@tonic-gate } 3447c478bd9Sstevel@tonic-gate 3457c478bd9Sstevel@tonic-gate ASSERT_STACK_ALIGNED(); 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate if (workaround_errata(CPU) != 0) 3487c478bd9Sstevel@tonic-gate panic("critical workaround(s) missing for boot cpu"); 3497c478bd9Sstevel@tonic-gate } 350