1// Copyright 2016 The Fuchsia Authors 2// Copyright (c) 2016 Travis Geiselbrecht 3// 4// Use of this source code is governed by a MIT-style 5// license that can be found in the LICENSE file or at 6// https://opensource.org/licenses/MIT 7 8#include <arch/x86/mp.h> 9#include <arch/x86/apic.h> 10 11// This is in its own file rather than mp.cpp so that it can 12// be a C file and use C99 designated initializer syntax. 13 14#if __has_feature(safe_stack) 15static uint8_t unsafe_kstack[PAGE_SIZE] __ALIGNED(16); 16#define unsafe_kstack_end (&unsafe_kstack[sizeof(unsafe_kstack)]) 17#else 18#define unsafe_kstack_end NULL 19#endif 20 21// Fake monitor to use until smp is initialized. The size of 22// the memory range doesn't matter, since it won't actually get 23// used in a non-smp environment. 24volatile uint8_t fake_monitor; 25 26struct x86_percpu bp_percpu = { 27 .cpu_num = 0, 28 .direct = &bp_percpu, 29 .kernel_unsafe_sp = (uintptr_t)unsafe_kstack_end, 30 31 // Start with an invalid ID until we know the local APIC is set up. 32 .apic_id = INVALID_APIC_ID, 33 34 .monitor = &fake_monitor, 35}; 36