1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:47:35 +00:00

Revert "Kernel: Switch singletons to use new Singleton class"

This reverts commit f48feae0b2.
This commit is contained in:
Andreas Kling 2020-08-22 17:53:34 +02:00
parent 0addcb45b8
commit 2fd9e72264
44 changed files with 146 additions and 184 deletions

View file

@ -25,14 +25,12 @@
*/
#include <AK/Assertions.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <Kernel/Arch/i386/CPU.h>
#include <Kernel/CommandLine.h>
#include <Kernel/Devices/VMWareBackdoor.h>
#include <Kernel/API/MousePacket.h>
#include <Kernel/IO.h>
#include <Kernel/Singleton.h>
namespace Kernel {
@ -82,40 +80,33 @@ inline void vmware_high_bandwidth_get(VMWareCommand& command)
: "+a"(command.ax), "+b"(command.bx), "+c"(command.cx), "+d"(command.dx), "+S"(command.si), "+D"(command.di));
}
class VMWareBackdoorDetector
static VMWareBackdoor* s_vmware_backdoor;
static bool detect_presence()
{
public:
VMWareBackdoorDetector()
{
if (detect_presence())
m_backdoor = make<VMWareBackdoor>();
}
VMWareCommand command;
command.bx = ~VMWARE_MAGIC;
command.command = VMWARE_CMD_GETVERSION;
vmware_out(command);
if (command.bx != VMWARE_MAGIC || command.ax == 0xFFFFFFFF)
return false;
return true;
}
VMWareBackdoor* get_instance()
{
return m_backdoor.ptr();
}
VMWareBackdoor* VMWareBackdoor::initialize()
{
ASSERT(s_vmware_backdoor == nullptr);
if (!detect_presence())
return nullptr;
private:
static bool detect_presence()
{
VMWareCommand command;
command.bx = ~VMWARE_MAGIC;
command.command = VMWARE_CMD_GETVERSION;
vmware_out(command);
if (command.bx != VMWARE_MAGIC || command.ax == 0xFFFFFFFF)
return false;
return true;
}
OwnPtr<VMWareBackdoor> m_backdoor;
};
static auto s_vmware_backdoor = make_singleton<VMWareBackdoorDetector>();
s_vmware_backdoor = new VMWareBackdoor;
klog() << "VMWare backdoor opened.";
return s_vmware_backdoor;
}
VMWareBackdoor* VMWareBackdoor::the()
{
return s_vmware_backdoor->get_instance();
return s_vmware_backdoor;
}
VMWareBackdoor::VMWareBackdoor()