ams: remove TYPED_STORAGE() macro in favor of template
This commit is contained in:
@@ -49,7 +49,7 @@ namespace ams::ddsf {
|
||||
NON_MOVEABLE(DeviceCodeEntryHolder);
|
||||
private:
|
||||
util::IntrusiveListNode list_node;
|
||||
TYPED_STORAGE(DeviceCodeEntry) entry_storage;
|
||||
util::TypedStorage<DeviceCodeEntry> entry_storage;
|
||||
bool is_constructed;
|
||||
public:
|
||||
using ListTraits = util::IntrusiveListMemberTraitsDeferredAssert<&DeviceCodeEntryHolder::list_node>;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ams::ncm {
|
||||
struct InstallProgress {
|
||||
InstallProgressState state;
|
||||
u8 pad[3];
|
||||
TYPED_STORAGE(Result) last_result;
|
||||
util::TypedStorage<Result> last_result;
|
||||
s64 installed_size;
|
||||
s64 total_size;
|
||||
|
||||
|
||||
@@ -53,6 +53,6 @@ namespace ams::os::impl {
|
||||
}
|
||||
};
|
||||
|
||||
using InternalConditionVariableStorage = TYPED_STORAGE(InternalConditionVariable);
|
||||
using InternalConditionVariableStorage = util::TypedStorage<InternalConditionVariable>;
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ namespace ams::os::impl {
|
||||
}
|
||||
};
|
||||
|
||||
using InternalCriticalSectionStorage = TYPED_STORAGE(InternalCriticalSection);
|
||||
using InternalCriticalSectionStorage = util::TypedStorage<InternalCriticalSection>;
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace ams::os {
|
||||
State_Terminated = 4,
|
||||
};
|
||||
|
||||
TYPED_STORAGE(util::IntrusiveListNode) all_threads_node;
|
||||
util::TypedStorage<util::IntrusiveListNode> all_threads_node;
|
||||
util::TypedStorage<impl::WaitableObjectList, sizeof(util::IntrusiveListNode), alignof(util::IntrusiveListNode)> waitlist;
|
||||
uintptr_t reserved[4];
|
||||
u8 state;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ams::os {
|
||||
}
|
||||
|
||||
struct TimerEventType {
|
||||
using TimeSpanStorage = TYPED_STORAGE(TimeSpan);
|
||||
using TimeSpanStorage = util::TypedStorage<TimeSpan>;
|
||||
|
||||
enum State {
|
||||
State_NotInitialized = 0,
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ams::powctl {
|
||||
|
||||
struct Session {
|
||||
bool has_session;
|
||||
TYPED_STORAGE(impl::SessionImpl) impl_storage;
|
||||
util::TypedStorage<impl::SessionImpl> impl_storage;
|
||||
|
||||
Session() : has_session(false) { /* ... */ }
|
||||
};
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace ams::sf::cmif {
|
||||
virtual ServiceObjectHolder GetObject(DomainObjectId id) override final;
|
||||
};
|
||||
public:
|
||||
using DomainEntryStorage = TYPED_STORAGE(Entry);
|
||||
using DomainStorage = TYPED_STORAGE(Domain);
|
||||
using DomainEntryStorage = util::TypedStorage<Entry>;
|
||||
using DomainStorage = util::TypedStorage<Domain>;
|
||||
private:
|
||||
class EntryManager {
|
||||
private:
|
||||
|
||||
@@ -260,9 +260,9 @@ namespace ams::sf::hipc {
|
||||
private:
|
||||
/* Resource storage. */
|
||||
os::Mutex resource_mutex;
|
||||
TYPED_STORAGE(Server) server_storages[MaxServers];
|
||||
util::TypedStorage<Server> server_storages[MaxServers];
|
||||
bool server_allocated[MaxServers];
|
||||
TYPED_STORAGE(ServerSession) session_storages[MaxSessions];
|
||||
util::TypedStorage<ServerSession> session_storages[MaxSessions];
|
||||
bool session_allocated[MaxSessions];
|
||||
u8 pointer_buffer_storage[0x10 + (MaxSessions * ManagerOptions::PointerBufferSize)];
|
||||
u8 saved_message_storage[0x10 + (MaxSessions * hipc::TlsMessageBufferSize)];
|
||||
|
||||
@@ -684,7 +684,7 @@ namespace ams::sf::impl {
|
||||
private:
|
||||
std::array<cmif::ServiceObjectHolder, NumInObjects> in_object_holders;
|
||||
std::array<cmif::ServiceObjectHolder, NumOutObjects> out_object_holders;
|
||||
std::array<TYPED_STORAGE(SharedPointer<sf::IServiceObject>), NumOutObjects> out_shared_pointers;
|
||||
std::array<util::TypedStorage<SharedPointer<sf::IServiceObject>>, NumOutObjects> out_shared_pointers;
|
||||
std::array<cmif::DomainObjectId, NumOutObjects> out_object_ids;
|
||||
public:
|
||||
constexpr InOutObjectHolder() : in_object_holders(), out_object_holders() {
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace ams::fs {
|
||||
constinit os::SdkMutex g_mount_stratosphere_romfs_lock;
|
||||
constinit bool g_mounted_stratosphere_romfs = false;
|
||||
|
||||
constinit TYPED_STORAGE(FileHandleStorage) g_stratosphere_romfs_storage = {};
|
||||
constinit TYPED_STORAGE(RomFsFileSystem) g_stratosphere_romfs_fs = {};
|
||||
constinit util::TypedStorage<FileHandleStorage> g_stratosphere_romfs_storage = {};
|
||||
constinit util::TypedStorage<RomFsFileSystem> g_stratosphere_romfs_fs = {};
|
||||
|
||||
Result EnsureStratosphereRomfsMounted() {
|
||||
std::scoped_lock lk(g_mount_stratosphere_romfs_lock);
|
||||
|
||||
@@ -68,19 +68,19 @@ namespace ams::fssystem {
|
||||
alignas(os::MemoryPageSize) u8 g_device_buffer[DeviceBufferSize];
|
||||
|
||||
alignas(os::MemoryPageSize) u8 g_buffer_pool[BufferPoolSize];
|
||||
TYPED_STORAGE(mem::StandardAllocator) g_buffer_allocator;
|
||||
TYPED_STORAGE(fssrv::MemoryResourceFromStandardAllocator) g_allocator;
|
||||
util::TypedStorage<mem::StandardAllocator> g_buffer_allocator;
|
||||
util::TypedStorage<fssrv::MemoryResourceFromStandardAllocator> g_allocator;
|
||||
|
||||
/* TODO: Nintendo uses os::SetMemoryHeapSize (svc::SetHeapSize) and os::AllocateMemoryBlock for the BufferManager heap. */
|
||||
/* It's unclear how we should handle this in ams.mitm (especially hoping to reuse some logic for fs reimpl). */
|
||||
/* Should we be doing the same(?) */
|
||||
TYPED_STORAGE(fssystem::FileSystemBufferManager) g_buffer_manager;
|
||||
util::TypedStorage<fssystem::FileSystemBufferManager> g_buffer_manager;
|
||||
alignas(os::MemoryPageSize) u8 g_buffer_manager_heap[BufferManagerHeapSize];
|
||||
|
||||
/* FileSystem creators. */
|
||||
TYPED_STORAGE(fssrv::fscreator::RomFileSystemCreator) g_rom_fs_creator;
|
||||
TYPED_STORAGE(fssrv::fscreator::PartitionFileSystemCreator) g_partition_fs_creator;
|
||||
TYPED_STORAGE(fssrv::fscreator::StorageOnNcaCreator) g_storage_on_nca_creator;
|
||||
util::TypedStorage<fssrv::fscreator::RomFileSystemCreator> g_rom_fs_creator;
|
||||
util::TypedStorage<fssrv::fscreator::PartitionFileSystemCreator> g_partition_fs_creator;
|
||||
util::TypedStorage<fssrv::fscreator::StorageOnNcaCreator> g_storage_on_nca_creator;
|
||||
|
||||
fssrv::fscreator::FileSystemCreatorInterfaces g_fs_creator_interfaces = {};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ams::htc::server {
|
||||
using ServerOptions = sf::hipc::DefaultServerManagerOptions;
|
||||
using ServerManager = sf::hipc::ServerManager<NumServers, ServerOptions, MaxSessions>;
|
||||
|
||||
constinit TYPED_STORAGE(ServerManager) g_server_manager_storage;
|
||||
constinit util::TypedStorage<ServerManager> g_server_manager_storage;
|
||||
constinit ServerManager *g_server_manager = nullptr;
|
||||
|
||||
constinit HtcmiscImpl *g_misc_impl = nullptr;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace ams::htcfs {
|
||||
|
||||
namespace {
|
||||
|
||||
constinit TYPED_STORAGE(Client) g_client_storage;
|
||||
constinit util::TypedStorage<Client> g_client_storage;
|
||||
constinit bool g_initialized;
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ams::htclow::mux {
|
||||
os::Event *m_event;
|
||||
u8 m_map_buffer[MapRequiredMemorySize];
|
||||
MapType m_map;
|
||||
TYPED_STORAGE(ChannelImpl) m_channel_storage[MaxChannelCount];
|
||||
util::TypedStorage<ChannelImpl> m_channel_storage[MaxChannelCount];
|
||||
bool m_storage_valid[MaxChannelCount];
|
||||
public:
|
||||
ChannelImplMap(PacketFactory *pf, ctrl::HtcctrlStateMachine *sm, TaskManager *tm, os::Event *ev);
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
|
||||
namespace ams::os::impl {
|
||||
|
||||
constinit TYPED_STORAGE(OsResourceManager) ResourceManagerHolder::s_resource_manager_storage = {};
|
||||
constinit util::TypedStorage<OsResourceManager> ResourceManagerHolder::s_resource_manager_storage = {};
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace ams::os::impl {
|
||||
|
||||
class ResourceManagerHolder {
|
||||
private:
|
||||
static TYPED_STORAGE(OsResourceManager) s_resource_manager_storage;
|
||||
static util::TypedStorage<OsResourceManager> s_resource_manager_storage;
|
||||
private:
|
||||
constexpr ResourceManagerHolder() { /* ... */ }
|
||||
public:
|
||||
|
||||
@@ -27,15 +27,15 @@ namespace ams::os::impl {
|
||||
|
||||
struct WaitableHolderImpl {
|
||||
union {
|
||||
TYPED_STORAGE(WaitableHolderOfHandle) holder_of_handle_storage;
|
||||
TYPED_STORAGE(WaitableHolderOfEvent) holder_of_event_storage;
|
||||
TYPED_STORAGE(WaitableHolderOfInterProcessEvent) holder_of_inter_process_event_storage;
|
||||
TYPED_STORAGE(WaitableHolderOfInterruptEvent) holder_of_interrupt_event_storage;
|
||||
TYPED_STORAGE(WaitableHolderOfTimerEvent) holder_of_timer_event_storage;
|
||||
TYPED_STORAGE(WaitableHolderOfThread) holder_of_thread_storage;
|
||||
TYPED_STORAGE(WaitableHolderOfSemaphore) holder_of_semaphore_storage;
|
||||
TYPED_STORAGE(WaitableHolderOfMessageQueueForNotFull) holder_of_mq_for_not_full_storage;
|
||||
TYPED_STORAGE(WaitableHolderOfMessageQueueForNotEmpty) holder_of_mq_for_not_empty_storage;
|
||||
util::TypedStorage<WaitableHolderOfHandle> holder_of_handle_storage;
|
||||
util::TypedStorage<WaitableHolderOfEvent> holder_of_event_storage;
|
||||
util::TypedStorage<WaitableHolderOfInterProcessEvent> holder_of_inter_process_event_storage;
|
||||
util::TypedStorage<WaitableHolderOfInterruptEvent> holder_of_interrupt_event_storage;
|
||||
util::TypedStorage<WaitableHolderOfTimerEvent> holder_of_timer_event_storage;
|
||||
util::TypedStorage<WaitableHolderOfThread> holder_of_thread_storage;
|
||||
util::TypedStorage<WaitableHolderOfSemaphore> holder_of_semaphore_storage;
|
||||
util::TypedStorage<WaitableHolderOfMessageQueueForNotFull> holder_of_mq_for_not_full_storage;
|
||||
util::TypedStorage<WaitableHolderOfMessageQueueForNotEmpty> holder_of_mq_for_not_empty_storage;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace ams::pgl::srv {
|
||||
os::MessageQueue message_queue;
|
||||
uintptr_t queue_buffer[QueueCapacity];
|
||||
os::SystemEvent event;
|
||||
TYPED_STORAGE(lmem::HeapCommonHead) heap_head;
|
||||
util::TypedStorage<lmem::HeapCommonHead> heap_head;
|
||||
lmem::HeapHandle heap_handle;
|
||||
pm::ProcessEventInfo event_info_data[QueueCapacity];
|
||||
TYPED_STORAGE(ShellEventObserverHolder) holder;
|
||||
util::TypedStorage<ShellEventObserverHolder> holder;
|
||||
public:
|
||||
ShellEventObserver();
|
||||
~ShellEventObserver();
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace ams::sf::hipc::impl {
|
||||
constinit os::ThreadType g_query_server_process_thread;
|
||||
|
||||
constexpr size_t MaxServers = 0;
|
||||
TYPED_STORAGE(sf::hipc::ServerManager<MaxServers>) g_query_server_storage;
|
||||
util::TypedStorage<sf::hipc::ServerManager<MaxServers>> g_query_server_storage;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user