The Pedigree Project  0.1
x86/Multiprocessor.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifdef MULTIPROCESSOR
21 
22 #include "../x86_common/Multiprocessor.h"
23 #include "InterruptManager.h"
24 #include "gdt.h"
25 #include "pedigree/kernel/process/initialiseMultitasking.h"
26 #include "pedigree/kernel/processor/Processor.h"
27 
28 #include "machine/x86_common/Pc.h"
29 
30 void Multiprocessor::applicationProcessorStartup()
31 {
32  // Initialise this processor's interrupt handling
34 
35  // Signal the Bootstrap processor that this processor is started and the BSP
36  // can continue to boot up other processors
37  m_ProcessorLock1.release();
38 
39  // Wait until the GDT is initialised and the first 4MB identity mapping
40  // removed
41  m_ProcessorLock2.acquire();
42  m_ProcessorLock2.release();
43 
44  // Load the GDT
46 
47  // Invalidate the first 4MB identity mapping
49 
50  // Initialise the machine-specific interface
51  Pc::instance().initialiseProcessor();
52 
53  // We need to synchronize the -init section invalidation
55 
56  // Start multitasking and ensure there is a spare idle thread for this CPU.
57  initialiseMultitaskingPerProcessor();
58 
59  // Call the per-processor code in main.cc
60  apMain();
61 }
62 
63 #endif
static void initialiseProcessor() INITIALISATION_ONLY
Definition: x86/gdt.cc:86
static void initialiseProcessor() INITIALISATION_ONLY
static void invalidate(void *pAddress)