The Pedigree Project  0.1
hosted/Machine.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 #include "Machine.h"
21 
22 #include "pedigree/kernel/Log.h"
23 #include "pedigree/kernel/panic.h"
24 
25 #include "pedigree/kernel/machine/Bus.h"
26 #include "pedigree/kernel/machine/Controller.h"
27 #include "pedigree/kernel/machine/Device.h"
28 #include "pedigree/kernel/machine/Disk.h"
29 
30 HostedMachine HostedMachine::m_Instance;
31 
32 Machine &Machine::instance()
33 {
34  return HostedMachine::instance();
35 }
36 
38 {
40  m_Serial[0].setBase(0);
41  m_Serial[1].setBase(1);
42  m_Vga.initialise();
43  HostedTimer::instance().initialise();
45  m_Keyboard = new HostedKeyboard();
46  m_Keyboard->initialise();
47  m_bInitialised = true;
48 }
49 
51 {
52 }
53 
55 {
56  return &m_Serial[n];
57 }
58 
60 {
61  return 2;
62 }
63 
65 {
66  return &m_Vga;
67 }
68 
70 {
71  return 1;
72 }
73 
74 IrqManager *HostedMachine::getIrqManager()
75 {
77 }
78 
80 {
82 }
83 
85 {
86  return &HostedTimer::instance();
87 }
88 
90 {
91  return m_Keyboard;
92 }
93 
95 {
96  m_Keyboard = kb;
97 }
98 
99 void HostedMachine::stopAllOtherProcessors()
100 {
101  // no-op
102 }
103 
105 {
106 }
107 
109 {
110 }
virtual Keyboard * getKeyboard()
HostedMachine() INITIALISATION_ONLY
virtual Vga * getVga(size_t n)
virtual SchedulerTimer * getSchedulerTimer()
bool initialise() INITIALISATION_ONLY
bool initialise() INITIALISATION_ONLY
static HostedIrqManager & instance()
virtual void initialiseDeviceTree()
virtual size_t getNumVga()
virtual Serial * getSerial(size_t n)
static HostedSchedulerTimer & instance()
virtual ~HostedMachine()
bool initialise() INITIALISATION_ONLY
virtual Timer * getTimer()
virtual size_t getNumSerial()
virtual void setKeyboard(Keyboard *kb)
virtual void initialise() INITIALISATION_ONLY