mirror of
https://github.com/StrikerX3/StrikeBox.git
synced 2024-06-23 14:53:22 -04:00
Renamed SharedMemory to DynamicVariant
This commit is contained in:
parent
068dcfce27
commit
48ebcfd53b
|
@ -5,15 +5,15 @@
|
|||
namespace vixen {
|
||||
|
||||
/*!
|
||||
* A reusable block of memory that dynamically resizes to accomodate the
|
||||
* largest data structure written to it.
|
||||
* Stores any type of object.
|
||||
*
|
||||
* Constructors and destructors are automatically invoked.
|
||||
* Constructors and destructors are automatically invoked. A block of memory is
|
||||
* automatically managed by this object and resized if needed by the new type.
|
||||
*/
|
||||
class SharedMemory {
|
||||
class DynamicVariant {
|
||||
public:
|
||||
SharedMemory() {}
|
||||
~SharedMemory() {
|
||||
DynamicVariant() {}
|
||||
~DynamicVariant() {
|
||||
if (m_dtor != nullptr) {
|
||||
m_dtor(*this);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
}
|
||||
|
||||
// Update destructor to new data structure and call constructor
|
||||
m_dtor = [](SharedMemory& u) { ((T*)u.m_memory)->~T(); };
|
||||
m_dtor = [](DynamicVariant& u) { ((T*)u.m_memory)->~T(); };
|
||||
return new(m_memory) T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
private:
|
||||
void *m_memory = nullptr;
|
||||
size_t m_size = 0;
|
||||
void (*m_dtor)(SharedMemory&) = nullptr;
|
||||
void (*m_dtor)(DynamicVariant&) = nullptr;
|
||||
};
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
#include <mutex>
|
||||
|
||||
#include "vixen/cpu.h"
|
||||
#include "vixen/shared_memory.h"
|
||||
#include "vixen/dynamic_variant.h"
|
||||
#include "../basic/irq.h"
|
||||
#include "../basic/interrupt.h"
|
||||
#include "ata_device.h"
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
|
||||
bool m_interrupt = false; // [5.2.9] INTRQ (Device Interrupt)
|
||||
|
||||
SharedMemory m_currentCommandMem;
|
||||
DynamicVariant m_currentCommandMem;
|
||||
cmd::IATACommand *m_currentCommand;
|
||||
std::mutex m_commandMutex;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#include "vixen/shared_memory.h"
|
||||
#include "vixen/dynamic_variant.h"
|
||||
#include "../ata_device.h"
|
||||
|
||||
namespace vixen {
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
/*!
|
||||
* Defines the factory function type used to build a factory table.
|
||||
*/
|
||||
typedef IATACommand* (*Factory)(SharedMemory& sharedMemory, ATADevice& device);
|
||||
typedef IATACommand* (*Factory)(DynamicVariant& sharedMemory, ATADevice& device);
|
||||
|
||||
protected:
|
||||
ATADevice& m_device;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
IdentifyDevice(ATADevice& device);
|
||||
virtual ~IdentifyDevice() override;
|
||||
|
||||
static IATACommand *Factory(SharedMemory& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<IdentifyDevice>(device); }
|
||||
static IATACommand *Factory(DynamicVariant& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<IdentifyDevice>(device); }
|
||||
|
||||
protected:
|
||||
bool HasMoreData() override;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
IdentifyPacketDevice(ATADevice& device);
|
||||
virtual ~IdentifyPacketDevice() override;
|
||||
|
||||
static IATACommand *Factory(SharedMemory& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<IdentifyPacketDevice>(device); }
|
||||
static IATACommand *Factory(DynamicVariant& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<IdentifyPacketDevice>(device); }
|
||||
|
||||
protected:
|
||||
bool HasMoreData() override;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
InitializeDeviceParameters(ATADevice& device);
|
||||
virtual ~InitializeDeviceParameters() override;
|
||||
|
||||
static IATACommand *Factory(SharedMemory& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<InitializeDeviceParameters>(device); }
|
||||
static IATACommand *Factory(DynamicVariant& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<InitializeDeviceParameters>(device); }
|
||||
|
||||
protected:
|
||||
bool ExecuteImpl() override;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
Packet(ATADevice& device);
|
||||
virtual ~Packet() override;
|
||||
|
||||
static IATACommand *Factory(SharedMemory& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<Packet>(device); }
|
||||
static IATACommand *Factory(DynamicVariant& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<Packet>(device); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
ReadDMA(ATADevice& device);
|
||||
virtual ~ReadDMA() override;
|
||||
|
||||
static IATACommand *Factory(SharedMemory& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<ReadDMA>(device); }
|
||||
static IATACommand *Factory(DynamicVariant& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<ReadDMA>(device); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
SecurityUnlock(ATADevice& device);
|
||||
virtual ~SecurityUnlock() override;
|
||||
|
||||
static IATACommand *Factory(SharedMemory& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<SecurityUnlock>(device); }
|
||||
static IATACommand *Factory(DynamicVariant& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<SecurityUnlock>(device); }
|
||||
|
||||
protected:
|
||||
bool Initialize() override;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
SetFeatures(ATADevice& device);
|
||||
virtual ~SetFeatures() override;
|
||||
|
||||
static IATACommand *Factory(SharedMemory& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<SetFeatures>(device); }
|
||||
static IATACommand *Factory(DynamicVariant& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<SetFeatures>(device); }
|
||||
|
||||
protected:
|
||||
bool ExecuteImpl() override;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
WriteDMA(ATADevice& device);
|
||||
virtual ~WriteDMA() override;
|
||||
|
||||
static IATACommand *Factory(SharedMemory& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<WriteDMA>(device); }
|
||||
static IATACommand *Factory(DynamicVariant& sharedMemory, ATADevice& device) { return sharedMemory.Allocate<WriteDMA>(device); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue