mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
Revert "Kernel: Move Singleton class to AK"
This reverts commit f0906250a1
.
This commit is contained in:
parent
b0a24a83be
commit
8925ad3fa0
31 changed files with 71 additions and 87 deletions
|
@ -27,7 +27,6 @@
|
||||||
#include <AK/FlyString.h>
|
#include <AK/FlyString.h>
|
||||||
#include <AK/HashTable.h>
|
#include <AK/HashTable.h>
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/StringUtils.h>
|
#include <AK/StringUtils.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
|
@ -48,11 +47,12 @@ struct FlyStringImplTraits : public AK::Traits<StringImpl*> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static auto s_table = make_singleton<HashTable<StringImpl*, FlyStringImplTraits>>();
|
|
||||||
|
|
||||||
static HashTable<StringImpl*, FlyStringImplTraits>& fly_impls()
|
static HashTable<StringImpl*, FlyStringImplTraits>& fly_impls()
|
||||||
{
|
{
|
||||||
return *s_table;
|
static HashTable<StringImpl*, FlyStringImplTraits>* table;
|
||||||
|
if (!table)
|
||||||
|
table = new HashTable<StringImpl*, FlyStringImplTraits>;
|
||||||
|
return *table;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlyString::did_destroy_impl(Badge<StringImpl>, StringImpl& impl)
|
void FlyString::did_destroy_impl(Badge<StringImpl>, StringImpl& impl)
|
||||||
|
|
|
@ -24,16 +24,16 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Console.h>
|
#include <Kernel/Console.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
#include <Kernel/kstdio.h>
|
#include <Kernel/kstdio.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/SpinLock.h>
|
#include <Kernel/SpinLock.h>
|
||||||
|
|
||||||
// Bytes output to 0xE9 end up on the Bochs console. It's very handy.
|
// Bytes output to 0xE9 end up on the Bochs console. It's very handy.
|
||||||
#define CONSOLE_OUT_TO_E9
|
#define CONSOLE_OUT_TO_E9
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<Console>();
|
static auto s_the = Kernel::make_singleton<Console>();
|
||||||
static Kernel::SpinLock g_console_lock;
|
static Kernel::SpinLock g_console_lock;
|
||||||
|
|
||||||
void Console::initialize()
|
void Console::initialize()
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Checked.h>
|
#include <AK/Checked.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Devices/BXVGADevice.h>
|
#include <Kernel/Devices/BXVGADevice.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
#include <Kernel/PCI/Access.h>
|
#include <Kernel/PCI/Access.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/VM/AnonymousVMObject.h>
|
#include <Kernel/VM/AnonymousVMObject.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
|
@ -57,7 +57,7 @@ namespace Kernel {
|
||||||
#define VBE_DISPI_ENABLED 0x01
|
#define VBE_DISPI_ENABLED 0x01
|
||||||
#define VBE_DISPI_LFB_ENABLED 0x40
|
#define VBE_DISPI_LFB_ENABLED 0x40
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<BXVGADevice>();
|
static auto s_the = make_singleton<BXVGADevice>();
|
||||||
|
|
||||||
void BXVGADevice::initialize()
|
void BXVGADevice::initialize()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,14 +24,14 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Devices/Device.h>
|
#include <Kernel/Devices/Device.h>
|
||||||
#include <Kernel/FileSystem/InodeMetadata.h>
|
#include <Kernel/FileSystem/InodeMetadata.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_all_devices = AK::make_singleton<HashMap<u32, Device*>>();
|
static auto s_all_devices = make_singleton<HashMap<u32, Device*>>();
|
||||||
|
|
||||||
HashMap<u32, Device*>& Device::all_devices()
|
HashMap<u32, Device*>& Device::all_devices()
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,12 +26,12 @@
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <Kernel/Arch/i386/CPU.h>
|
#include <Kernel/Arch/i386/CPU.h>
|
||||||
#include <Kernel/Devices/KeyboardDevice.h>
|
#include <Kernel/Devices/KeyboardDevice.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/TTY/VirtualConsole.h>
|
#include <Kernel/TTY/VirtualConsole.h>
|
||||||
|
|
||||||
//#define KEYBOARD_DEBUG
|
//#define KEYBOARD_DEBUG
|
||||||
|
@ -336,7 +336,7 @@ void KeyboardDevice::handle_irq(const RegisterState&)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<KeyboardDevice>();
|
static auto s_the = make_singleton<KeyboardDevice>();
|
||||||
|
|
||||||
void KeyboardDevice::initialize()
|
void KeyboardDevice::initialize()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "NullDevice.h"
|
#include "NullDevice.h"
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<NullDevice>();
|
static auto s_the = make_singleton<NullDevice>();
|
||||||
|
|
||||||
void NullDevice::initialize()
|
void NullDevice::initialize()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,13 +25,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/Devices/PATAChannel.h>
|
#include <Kernel/Devices/PATAChannel.h>
|
||||||
#include <Kernel/Devices/PATADiskDevice.h>
|
#include <Kernel/Devices/PATADiskDevice.h>
|
||||||
#include <Kernel/FileSystem/ProcFS.h>
|
#include <Kernel/FileSystem/ProcFS.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
@ -108,7 +108,7 @@ namespace Kernel {
|
||||||
#define PCI_Mass_Storage_Class 0x1
|
#define PCI_Mass_Storage_Class 0x1
|
||||||
#define PCI_IDE_Controller_Subclass 0x1
|
#define PCI_IDE_Controller_Subclass 0x1
|
||||||
|
|
||||||
static auto s_pata_lock = AK::make_singleton<Lock>();
|
static auto s_pata_lock = make_singleton<Lock>();
|
||||||
|
|
||||||
static Lock& s_lock()
|
static Lock& s_lock()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Memory.h>
|
#include <AK/Memory.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Devices/PS2MouseDevice.h>
|
#include <Kernel/Devices/PS2MouseDevice.h>
|
||||||
#include <Kernel/Devices/VMWareBackdoor.h>
|
#include <Kernel/Devices/VMWareBackdoor.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ namespace Kernel {
|
||||||
|
|
||||||
//#define PS2MOUSE_DEBUG
|
//#define PS2MOUSE_DEBUG
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<PS2MouseDevice>();
|
static auto s_the = make_singleton<PS2MouseDevice>();
|
||||||
|
|
||||||
PS2MouseDevice::PS2MouseDevice()
|
PS2MouseDevice::PS2MouseDevice()
|
||||||
: IRQHandler(IRQ_MOUSE)
|
: IRQHandler(IRQ_MOUSE)
|
||||||
|
|
|
@ -25,13 +25,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Memory.h>
|
#include <AK/Memory.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/Devices/SB16.h>
|
#include <Kernel/Devices/SB16.h>
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
#include <Kernel/VM/AnonymousVMObject.h>
|
#include <Kernel/VM/AnonymousVMObject.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
|
|
||||||
//#define SB16_DEBUG
|
//#define SB16_DEBUG
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ void SB16::set_sample_rate(uint16_t hz)
|
||||||
dsp_write((u8)hz);
|
dsp_write((u8)hz);
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<SB16>();
|
static auto s_the = make_singleton<SB16>();
|
||||||
|
|
||||||
SB16::SB16()
|
SB16::SB16()
|
||||||
: IRQHandler(SB16_DEFAULT_IRQ)
|
: IRQHandler(SB16_DEFAULT_IRQ)
|
||||||
|
|
|
@ -26,13 +26,13 @@
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <Kernel/Arch/i386/CPU.h>
|
#include <Kernel/Arch/i386/CPU.h>
|
||||||
#include <Kernel/CommandLine.h>
|
#include <Kernel/CommandLine.h>
|
||||||
#include <Kernel/Devices/VMWareBackdoor.h>
|
#include <Kernel/Devices/VMWareBackdoor.h>
|
||||||
#include <Kernel/API/MousePacket.h>
|
#include <Kernel/API/MousePacket.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ private:
|
||||||
OwnPtr<VMWareBackdoor> m_backdoor;
|
OwnPtr<VMWareBackdoor> m_backdoor;
|
||||||
};
|
};
|
||||||
|
|
||||||
static auto s_vmware_backdoor = AK::make_singleton<VMWareBackdoorDetector>();
|
static auto s_vmware_backdoor = make_singleton<VMWareBackdoorDetector>();
|
||||||
|
|
||||||
VMWareBackdoor* VMWareBackdoor::the()
|
VMWareBackdoor* VMWareBackdoor::the()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/FileSystem/DevPtsFS.h>
|
#include <Kernel/FileSystem/DevPtsFS.h>
|
||||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/TTY/SlavePTY.h>
|
#include <Kernel/TTY/SlavePTY.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
@ -46,7 +46,7 @@ DevPtsFS::~DevPtsFS()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto s_ptys = AK::make_singleton<HashTable<unsigned>>();
|
static auto s_ptys = make_singleton<HashTable<unsigned>>();
|
||||||
|
|
||||||
bool DevPtsFS::initialize()
|
bool DevPtsFS::initialize()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,20 +25,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/HashTable.h>
|
#include <AK/HashTable.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/FileSystem/FIFO.h>
|
#include <Kernel/FileSystem/FIFO.h>
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
#include <Kernel/Lock.h>
|
#include <Kernel/Lock.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
|
|
||||||
//#define FIFO_DEBUG
|
//#define FIFO_DEBUG
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_table = AK::make_singleton<Lockable<HashTable<FIFO*>>>();
|
static auto s_table = make_singleton<Lockable<HashTable<FIFO*>>>();
|
||||||
|
|
||||||
static Lockable<HashTable<FIFO*>>& all_fifos()
|
static Lockable<HashTable<FIFO*>>& all_fifos()
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,19 +26,19 @@
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/FileSystem/FileSystem.h>
|
#include <Kernel/FileSystem/FileSystem.h>
|
||||||
#include <Kernel/FileSystem/Inode.h>
|
#include <Kernel/FileSystem/Inode.h>
|
||||||
#include <Kernel/Net/LocalSocket.h>
|
#include <Kernel/Net/LocalSocket.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static u32 s_lastFileSystemID;
|
static u32 s_lastFileSystemID;
|
||||||
static auto s_fs_map = AK::make_singleton<HashMap<u32, FS*>>();
|
static auto s_fs_map = make_singleton<HashMap<u32, FS*>>();
|
||||||
|
|
||||||
static HashMap<u32, FS*>& all_fses()
|
static HashMap<u32, FS*>& all_fses()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/NonnullRefPtrVector.h>
|
#include <AK/NonnullRefPtrVector.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/FileSystem/Custody.h>
|
#include <Kernel/FileSystem/Custody.h>
|
||||||
|
@ -34,12 +33,13 @@
|
||||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||||
#include <Kernel/KBufferBuilder.h>
|
#include <Kernel/KBufferBuilder.h>
|
||||||
#include <Kernel/Net/LocalSocket.h>
|
#include <Kernel/Net/LocalSocket.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static SpinLock s_all_inodes_lock;
|
static SpinLock s_all_inodes_lock;
|
||||||
static auto s_list = AK::make_singleton<InlineLinkedList<Inode>>();
|
static auto s_list = make_singleton<InlineLinkedList<Inode>>();
|
||||||
|
|
||||||
InlineLinkedList<Inode>& Inode::all_with_lock()
|
InlineLinkedList<Inode>& Inode::all_with_lock()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <Kernel/Devices/BlockDevice.h>
|
#include <Kernel/Devices/BlockDevice.h>
|
||||||
#include <Kernel/FileSystem/Custody.h>
|
#include <Kernel/FileSystem/Custody.h>
|
||||||
|
@ -35,13 +34,14 @@
|
||||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||||
#include <Kernel/KSyms.h>
|
#include <Kernel/KSyms.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
|
|
||||||
//#define VFS_DEBUG
|
//#define VFS_DEBUG
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<VFS>();
|
static auto s_the = make_singleton<VFS>();
|
||||||
static constexpr int symlink_recursion_limit { 5 }; // FIXME: increase?
|
static constexpr int symlink_recursion_limit { 5 }; // FIXME: increase?
|
||||||
static constexpr int root_mount_flags = MS_NODEV | MS_NOSUID | MS_RDONLY;
|
static constexpr int root_mount_flags = MS_NODEV | MS_NOSUID | MS_RDONLY;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/Memory.h>
|
#include <AK/Memory.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <Kernel/ACPI/Parser.h>
|
#include <Kernel/ACPI/Parser.h>
|
||||||
|
@ -35,6 +34,7 @@
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
#include <Kernel/Interrupts/APIC.h>
|
#include <Kernel/Interrupts/APIC.h>
|
||||||
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
|
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <Kernel/VM/PageDirectory.h>
|
#include <Kernel/VM/PageDirectory.h>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_apic = AK::make_singleton<APIC>();
|
static auto s_apic = make_singleton<APIC>();
|
||||||
|
|
||||||
class APICIPIInterruptHandler final : public GenericInterruptHandler {
|
class APICIPIInterruptHandler final : public GenericInterruptHandler {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
#include <Kernel/Net/ARP.h>
|
#include <Kernel/Net/ARP.h>
|
||||||
#include <Kernel/Net/ICMP.h>
|
#include <Kernel/Net/ICMP.h>
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_table = AK::make_singleton<Lockable<HashTable<IPv4Socket*>>>();
|
static auto s_table = make_singleton<Lockable<HashTable<IPv4Socket*>>>();
|
||||||
|
|
||||||
Lockable<HashTable<IPv4Socket*>>& IPv4Socket::all_sockets()
|
Lockable<HashTable<IPv4Socket*>>& IPv4Socket::all_sockets()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||||
#include <Kernel/Net/LocalSocket.h>
|
#include <Kernel/Net/LocalSocket.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/StdLib.h>
|
#include <Kernel/StdLib.h>
|
||||||
#include <Kernel/UnixTypes.h>
|
#include <Kernel/UnixTypes.h>
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_list = AK::make_singleton<Lockable<InlineLinkedList<LocalSocket>>>();
|
static auto s_list = make_singleton<Lockable<InlineLinkedList<LocalSocket>>>();
|
||||||
|
|
||||||
Lockable<InlineLinkedList<LocalSocket>>& LocalSocket::all_sockets()
|
Lockable<InlineLinkedList<LocalSocket>>& LocalSocket::all_sockets()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Net/LoopbackAdapter.h>
|
#include <Kernel/Net/LoopbackAdapter.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_loopback = AK::make_singleton<LoopbackAdapter>();
|
static auto s_loopback = make_singleton<LoopbackAdapter>();
|
||||||
|
|
||||||
LoopbackAdapter& LoopbackAdapter::the()
|
LoopbackAdapter& LoopbackAdapter::the()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/HashTable.h>
|
#include <AK/HashTable.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <Kernel/Heap/kmalloc.h>
|
#include <Kernel/Heap/kmalloc.h>
|
||||||
#include <Kernel/Lock.h>
|
#include <Kernel/Lock.h>
|
||||||
|
@ -34,11 +33,12 @@
|
||||||
#include <Kernel/Net/LoopbackAdapter.h>
|
#include <Kernel/Net/LoopbackAdapter.h>
|
||||||
#include <Kernel/Net/NetworkAdapter.h>
|
#include <Kernel/Net/NetworkAdapter.h>
|
||||||
#include <Kernel/Random.h>
|
#include <Kernel/Random.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/StdLib.h>
|
#include <Kernel/StdLib.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_table = AK::make_singleton<Lockable<HashTable<NetworkAdapter*>>>();
|
static auto s_table = make_singleton<Lockable<HashTable<NetworkAdapter*>>>();
|
||||||
|
|
||||||
static Lockable<HashTable<NetworkAdapter*>>& all_adapters()
|
static Lockable<HashTable<NetworkAdapter*>>& all_adapters()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,16 +25,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Net/LoopbackAdapter.h>
|
#include <Kernel/Net/LoopbackAdapter.h>
|
||||||
#include <Kernel/Net/Routing.h>
|
#include <Kernel/Net/Routing.h>
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
|
|
||||||
//#define ROUTING_DEBUG
|
//#define ROUTING_DEBUG
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_arp_table = AK::make_singleton<Lockable<HashMap<IPv4Address, MACAddress>>>();
|
static auto s_arp_table = make_singleton<Lockable<HashMap<IPv4Address, MACAddress>>>();
|
||||||
|
|
||||||
Lockable<HashMap<IPv4Address, MACAddress>>& arp_table()
|
Lockable<HashMap<IPv4Address, MACAddress>>& arp_table()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/Time.h>
|
#include <AK/Time.h>
|
||||||
#include <Kernel/Devices/RandomDevice.h>
|
#include <Kernel/Devices/RandomDevice.h>
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
|
@ -34,6 +33,7 @@
|
||||||
#include <Kernel/Net/TCPSocket.h>
|
#include <Kernel/Net/TCPSocket.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/Random.h>
|
#include <Kernel/Random.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
|
|
||||||
//#define TCP_SOCKET_DEBUG
|
//#define TCP_SOCKET_DEBUG
|
||||||
|
|
||||||
|
@ -63,18 +63,19 @@ void TCPSocket::set_state(State new_state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto s_socket_closing = AK::make_singleton<Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>>();
|
|
||||||
|
|
||||||
Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& TCPSocket::closing_sockets()
|
Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& TCPSocket::closing_sockets()
|
||||||
{
|
{
|
||||||
return *s_socket_closing;
|
static Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>* s_map;
|
||||||
|
if (!s_map)
|
||||||
|
s_map = new Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>;
|
||||||
|
return *s_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto s_socket_tuples = AK::make_singleton<Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>>();
|
static auto s_map = make_singleton<Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>>();
|
||||||
|
|
||||||
Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
|
Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
|
||||||
{
|
{
|
||||||
return *s_socket_tuples;
|
return *s_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple)
|
RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple)
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Devices/RandomDevice.h>
|
#include <Kernel/Devices/RandomDevice.h>
|
||||||
#include <Kernel/Net/NetworkAdapter.h>
|
#include <Kernel/Net/NetworkAdapter.h>
|
||||||
#include <Kernel/Net/Routing.h>
|
#include <Kernel/Net/Routing.h>
|
||||||
|
@ -32,6 +31,7 @@
|
||||||
#include <Kernel/Net/UDPSocket.h>
|
#include <Kernel/Net/UDPSocket.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/Random.h>
|
#include <Kernel/Random.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void UDPSocket::for_each(Function<void(const UDPSocket&)> callback)
|
||||||
callback(*it.value);
|
callback(*it.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto s_map = AK::make_singleton<Lockable<HashMap<u16, UDPSocket*>>>();
|
static auto s_map = make_singleton<Lockable<HashMap<u16, UDPSocket*>>>();
|
||||||
|
|
||||||
Lockable<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
|
Lockable<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,15 +25,15 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Arch/i386/CPU.h>
|
#include <Kernel/Arch/i386/CPU.h>
|
||||||
#include <Kernel/Devices/RandomDevice.h>
|
#include <Kernel/Devices/RandomDevice.h>
|
||||||
#include <Kernel/Random.h>
|
#include <Kernel/Random.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/Time/TimeManagement.h>
|
#include <Kernel/Time/TimeManagement.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<KernelRng>();
|
static auto s_the = make_singleton<KernelRng>();
|
||||||
|
|
||||||
KernelRng& KernelRng::the()
|
KernelRng& KernelRng::the()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,13 +24,13 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/SharedBuffer.h>
|
#include <Kernel/SharedBuffer.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_map = AK::make_singleton<Lockable<HashMap<int, NonnullOwnPtr<SharedBuffer>>>>();
|
static auto s_map = make_singleton<Lockable<HashMap<int, NonnullOwnPtr<SharedBuffer>>>>();
|
||||||
|
|
||||||
Lockable<HashMap<int, NonnullOwnPtr<SharedBuffer>>>& shared_buffers()
|
Lockable<HashMap<int, NonnullOwnPtr<SharedBuffer>>>& shared_buffers()
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,33 +26,20 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
|
||||||
#include <AK/Atomic.h>
|
#include <AK/Atomic.h>
|
||||||
#include <AK/kmalloc.h>
|
|
||||||
#ifdef KERNEL
|
|
||||||
#include <Kernel/Arch/i386/CPU.h>
|
#include <Kernel/Arch/i386/CPU.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __serenity__
|
namespace Kernel {
|
||||||
# include <new>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace AK {
|
|
||||||
|
|
||||||
template<typename T, T* (*InitFunction)()>
|
template<typename T, T* (*InitFunction)()>
|
||||||
class Singleton {
|
class Singleton {
|
||||||
AK_MAKE_NONCOPYABLE(Singleton);
|
|
||||||
public:
|
public:
|
||||||
Singleton() = default;
|
|
||||||
|
|
||||||
T* ptr() const
|
T* ptr() const
|
||||||
{
|
{
|
||||||
T* obj = AK::atomic_load(&m_obj, AK::memory_order_consume);
|
T* obj = AK::atomic_load(&m_obj, AK::memory_order_consume);
|
||||||
if (FlatPtr(obj) <= 0x1) {
|
if (FlatPtr(obj) <= 0x1) {
|
||||||
// If this is the first time, see if we get to initialize it
|
// If this is the first time, see if we get to initialize it
|
||||||
#ifdef KERNEL
|
ScopedCritical critical;
|
||||||
Kernel::ScopedCritical critical;
|
|
||||||
#endif
|
|
||||||
if (obj == nullptr && AK::atomic_compare_exchange_strong(&m_obj, obj, (T*)0x1, AK::memory_order_acq_rel)) {
|
if (obj == nullptr && AK::atomic_compare_exchange_strong(&m_obj, obj, (T*)0x1, AK::memory_order_acq_rel)) {
|
||||||
// We're the first one
|
// We're the first one
|
||||||
obj = InitFunction();
|
obj = InitFunction();
|
||||||
|
@ -60,11 +47,7 @@ public:
|
||||||
} else {
|
} else {
|
||||||
// Someone else was faster, wait until they're done
|
// Someone else was faster, wait until they're done
|
||||||
while (obj == (T*)0x1) {
|
while (obj == (T*)0x1) {
|
||||||
#ifdef KERNEL
|
Processor::wait_check();
|
||||||
Kernel::Processor::wait_check();
|
|
||||||
#else
|
|
||||||
// TODO: yield
|
|
||||||
#endif
|
|
||||||
obj = AK::atomic_load(&m_obj, AK::memory_order_consume);
|
obj = AK::atomic_load(&m_obj, AK::memory_order_consume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +102,7 @@ struct SingletonInstanceCreator {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline Singleton<T, SingletonInstanceCreator<T>::create> make_singleton()
|
static Singleton<T, SingletonInstanceCreator<T>::create> make_singleton()
|
||||||
{
|
{
|
||||||
return Singleton<T, SingletonInstanceCreator<T>::create>();
|
return Singleton<T, SingletonInstanceCreator<T>::create>();
|
||||||
}
|
}
|
|
@ -26,9 +26,9 @@
|
||||||
|
|
||||||
#include "PTYMultiplexer.h"
|
#include "PTYMultiplexer.h"
|
||||||
#include "MasterPTY.h"
|
#include "MasterPTY.h"
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
|
|
||||||
//#define PTMX_DEBUG
|
//#define PTMX_DEBUG
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static const unsigned s_max_pty_pairs = 8;
|
static const unsigned s_max_pty_pairs = 8;
|
||||||
static auto s_the = AK::make_singleton<PTYMultiplexer>();
|
static auto s_the = make_singleton<PTYMultiplexer>();
|
||||||
|
|
||||||
PTYMultiplexer& PTYMultiplexer::the()
|
PTYMultiplexer& PTYMultiplexer::the()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/ACPI/Parser.h>
|
#include <Kernel/ACPI/Parser.h>
|
||||||
#include <Kernel/CommandLine.h>
|
#include <Kernel/CommandLine.h>
|
||||||
#include <Kernel/Scheduler.h>
|
#include <Kernel/Scheduler.h>
|
||||||
|
@ -33,6 +32,7 @@
|
||||||
#include <Kernel/Time/HardwareTimer.h>
|
#include <Kernel/Time/HardwareTimer.h>
|
||||||
#include <Kernel/Time/PIT.h>
|
#include <Kernel/Time/PIT.h>
|
||||||
#include <Kernel/Time/RTC.h>
|
#include <Kernel/Time/RTC.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/Time/TimeManagement.h>
|
#include <Kernel/Time/TimeManagement.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<TimeManagement>();
|
static auto s_the = make_singleton<TimeManagement>();
|
||||||
|
|
||||||
TimeManagement& TimeManagement::the()
|
TimeManagement& TimeManagement::the()
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/NonnullOwnPtr.h>
|
#include <AK/NonnullOwnPtr.h>
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Scheduler.h>
|
#include <Kernel/Scheduler.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/Time/TimeManagement.h>
|
#include <Kernel/Time/TimeManagement.h>
|
||||||
#include <Kernel/TimerQueue.h>
|
#include <Kernel/TimerQueue.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<TimerQueue>();
|
static auto s_the = make_singleton<TimerQueue>();
|
||||||
|
|
||||||
TimerQueue& TimerQueue::the()
|
TimerQueue& TimerQueue::the()
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/Memory.h>
|
#include <AK/Memory.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/Arch/i386/CPU.h>
|
#include <Kernel/Arch/i386/CPU.h>
|
||||||
#include <Kernel/CMOS.h>
|
#include <Kernel/CMOS.h>
|
||||||
|
@ -40,6 +39,7 @@
|
||||||
#include <Kernel/VM/PhysicalRegion.h>
|
#include <Kernel/VM/PhysicalRegion.h>
|
||||||
#include <Kernel/VM/PurgeableVMObject.h>
|
#include <Kernel/VM/PurgeableVMObject.h>
|
||||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/StdLib.h>
|
#include <Kernel/StdLib.h>
|
||||||
|
|
||||||
//#define MM_DEBUG
|
//#define MM_DEBUG
|
||||||
|
@ -51,7 +51,7 @@ extern FlatPtr end_of_kernel_bss;
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
static auto s_the = AK::make_singleton<MemoryManager>();
|
static auto s_the = make_singleton<MemoryManager>();
|
||||||
RecursiveSpinLock s_mm_lock;
|
RecursiveSpinLock s_mm_lock;
|
||||||
|
|
||||||
MemoryManager& MM
|
MemoryManager& MM
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Memory.h>
|
#include <AK/Memory.h>
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/Random.h>
|
#include <Kernel/Random.h>
|
||||||
|
#include <Kernel/Singleton.h>
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <Kernel/VM/PageDirectory.h>
|
#include <Kernel/VM/PageDirectory.h>
|
||||||
|
@ -38,7 +38,7 @@ static const FlatPtr userspace_range_base = 0x00800000;
|
||||||
static const FlatPtr userspace_range_ceiling = 0xbe000000;
|
static const FlatPtr userspace_range_ceiling = 0xbe000000;
|
||||||
static const FlatPtr kernelspace_range_base = 0xc0800000;
|
static const FlatPtr kernelspace_range_base = 0xc0800000;
|
||||||
|
|
||||||
static auto s_cr3_map = AK::make_singleton<HashMap<u32, PageDirectory*>>();
|
static auto s_cr3_map = make_singleton<HashMap<u32, PageDirectory*>>();
|
||||||
|
|
||||||
static HashMap<u32, PageDirectory*>& cr3_map()
|
static HashMap<u32, PageDirectory*>& cr3_map()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue