ipc_helpers: remove some deprecated functions
This commit is contained in:
parent
e19475481c
commit
61e5f320c9
|
@ -117,10 +117,7 @@ public:
|
||||||
|
|
||||||
// TODO : ensure that translate params are added after all regular params
|
// TODO : ensure that translate params are added after all regular params
|
||||||
template <typename... H>
|
template <typename... H>
|
||||||
void PushCopyHandles(H... handles);
|
[[deprecated]] void PushCopyHandles(H... handles);
|
||||||
|
|
||||||
template <typename... H>
|
|
||||||
void PushMoveHandles(H... handles);
|
|
||||||
|
|
||||||
template <typename... O>
|
template <typename... O>
|
||||||
void PushCopyObjects(Kernel::SharedPtr<O>... pointers);
|
void PushCopyObjects(Kernel::SharedPtr<O>... pointers);
|
||||||
|
@ -131,11 +128,15 @@ public:
|
||||||
[[deprecated]] void PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id);
|
[[deprecated]] void PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id);
|
||||||
void PushStaticBuffer(const std::vector<u8>& buffer, u8 buffer_id);
|
void PushStaticBuffer(const std::vector<u8>& buffer, u8 buffer_id);
|
||||||
|
|
||||||
[[deprecated]] void PushMappedBuffer(VAddr buffer_vaddr, size_t size,
|
|
||||||
MappedBufferPermissions perms);
|
|
||||||
|
|
||||||
/// Pushes an HLE MappedBuffer interface back to unmapped the buffer.
|
/// Pushes an HLE MappedBuffer interface back to unmapped the buffer.
|
||||||
void PushMappedBuffer(const Kernel::MappedBuffer& mapped_buffer);
|
void PushMappedBuffer(const Kernel::MappedBuffer& mapped_buffer);
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <typename... H>
|
||||||
|
void PushCopyHLEHandles(H... handles);
|
||||||
|
|
||||||
|
template <typename... H>
|
||||||
|
void PushMoveHLEHandles(H... handles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Push ///
|
/// Push ///
|
||||||
|
@ -186,24 +187,29 @@ void RequestBuilder::Push(const First& first_value, const Other&... other_values
|
||||||
|
|
||||||
template <typename... H>
|
template <typename... H>
|
||||||
inline void RequestBuilder::PushCopyHandles(H... handles) {
|
inline void RequestBuilder::PushCopyHandles(H... handles) {
|
||||||
Push(CopyHandleDesc(sizeof...(H)));
|
PushCopyHLEHandles(handles...);
|
||||||
Push(static_cast<Kernel::Handle>(handles)...);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... H>
|
template <typename... H>
|
||||||
inline void RequestBuilder::PushMoveHandles(H... handles) {
|
inline void RequestBuilder::PushCopyHLEHandles(H... handles) {
|
||||||
|
Push(CopyHandleDesc(sizeof...(H)));
|
||||||
|
Push(static_cast<u32>(handles)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename... H>
|
||||||
|
inline void RequestBuilder::PushMoveHLEHandles(H... handles) {
|
||||||
Push(MoveHandleDesc(sizeof...(H)));
|
Push(MoveHandleDesc(sizeof...(H)));
|
||||||
Push(static_cast<Kernel::Handle>(handles)...);
|
Push(static_cast<u32>(handles)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... O>
|
template <typename... O>
|
||||||
inline void RequestBuilder::PushCopyObjects(Kernel::SharedPtr<O>... pointers) {
|
inline void RequestBuilder::PushCopyObjects(Kernel::SharedPtr<O>... pointers) {
|
||||||
PushCopyHandles(context->AddOutgoingHandle(std::move(pointers))...);
|
PushCopyHLEHandles(context->AddOutgoingHandle(std::move(pointers))...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... O>
|
template <typename... O>
|
||||||
inline void RequestBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) {
|
inline void RequestBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) {
|
||||||
PushMoveHandles(context->AddOutgoingHandle(std::move(pointers))...);
|
PushMoveHLEHandles(context->AddOutgoingHandle(std::move(pointers))...);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RequestBuilder::PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id) {
|
inline void RequestBuilder::PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id) {
|
||||||
|
@ -221,12 +227,6 @@ inline void RequestBuilder::PushStaticBuffer(const std::vector<u8>& buffer, u8 b
|
||||||
context->AddStaticBuffer(buffer_id, buffer);
|
context->AddStaticBuffer(buffer_id, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RequestBuilder::PushMappedBuffer(VAddr buffer_vaddr, size_t size,
|
|
||||||
MappedBufferPermissions perms) {
|
|
||||||
Push(MappedBufferDesc(size, perms));
|
|
||||||
Push(buffer_vaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void RequestBuilder::PushMappedBuffer(const Kernel::MappedBuffer& mapped_buffer) {
|
inline void RequestBuilder::PushMappedBuffer(const Kernel::MappedBuffer& mapped_buffer) {
|
||||||
Push(mapped_buffer.GenerateDescriptor());
|
Push(mapped_buffer.GenerateDescriptor());
|
||||||
Push(mapped_buffer.GetId());
|
Push(mapped_buffer.GetId());
|
||||||
|
@ -284,24 +284,6 @@ public:
|
||||||
return static_cast<T>(Pop<std::underlying_type_t<T>>());
|
return static_cast<T>(Pop<std::underlying_type_t<T>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Equivalent to calling `PopHandles<1>()[0]`.
|
|
||||||
Kernel::Handle PopHandle();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pops a descriptor containing `N` handles. The handles are returned as an array. The
|
|
||||||
* descriptor must contain exactly `N` handles, it is not permitted to, for example, call
|
|
||||||
* PopHandles<1>() twice to read a multi-handle descriptor with 2 handles, or to make a single
|
|
||||||
* PopHandles<2>() call to read 2 single-handle descriptors.
|
|
||||||
*/
|
|
||||||
template <unsigned int N>
|
|
||||||
std::array<Kernel::Handle, N> PopHandles();
|
|
||||||
|
|
||||||
/// Convenience wrapper around PopHandles() which assigns the handles to the passed references.
|
|
||||||
template <typename... H>
|
|
||||||
void PopHandles(H&... handles) {
|
|
||||||
std::tie(handles...) = PopHandles<sizeof...(H)>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Equivalent to calling `PopGenericObjects<1>()[0]`.
|
/// Equivalent to calling `PopGenericObjects<1>()[0]`.
|
||||||
Kernel::SharedPtr<Kernel::Object> PopGenericObject();
|
Kernel::SharedPtr<Kernel::Object> PopGenericObject();
|
||||||
|
|
||||||
|
@ -311,8 +293,10 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pop a descriptor containing `N` handles and resolves them to Kernel::Object pointers. If a
|
* Pop a descriptor containing `N` handles and resolves them to Kernel::Object pointers. If a
|
||||||
* handle is invalid, null is returned for that object instead. The same caveats from
|
* handle is invalid, null is returned for that object instead. The descriptor must contain
|
||||||
* PopHandles() apply regarding `N` matching the number of handles in the descriptor.
|
* exactly `N` handles, it is not permitted to, for example, call PopGenericObjects<1>() twice
|
||||||
|
* to read a multi-handle descriptor with 2 handles, or to make a single PopGenericObjects<2>()
|
||||||
|
* call to read 2 single-handle descriptors.
|
||||||
*/
|
*/
|
||||||
template <unsigned int N>
|
template <unsigned int N>
|
||||||
std::array<Kernel::SharedPtr<Kernel::Object>, N> PopGenericObjects();
|
std::array<Kernel::SharedPtr<Kernel::Object>, N> PopGenericObjects();
|
||||||
|
@ -355,17 +339,6 @@ public:
|
||||||
*/
|
*/
|
||||||
const std::vector<u8>& PopStaticBuffer();
|
const std::vector<u8>& PopStaticBuffer();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Pops the mapped buffer vaddr
|
|
||||||
* @return The virtual address of the buffer
|
|
||||||
* @param[out] data_size If non-null, the pointed value will be set to the size of the data
|
|
||||||
* given by the source process
|
|
||||||
* @param[out] buffer_perms If non-null, the pointed value will be set to the permissions of the
|
|
||||||
* buffer
|
|
||||||
*/
|
|
||||||
[[deprecated]] VAddr PopMappedBuffer(size_t* data_size,
|
|
||||||
MappedBufferPermissions* buffer_perms = nullptr);
|
|
||||||
|
|
||||||
/// Pops a mapped buffer descriptor with its vaddr and resolves it to an HLE interface
|
/// Pops a mapped buffer descriptor with its vaddr and resolves it to an HLE interface
|
||||||
Kernel::MappedBuffer& PopMappedBuffer();
|
Kernel::MappedBuffer& PopMappedBuffer();
|
||||||
|
|
||||||
|
@ -382,6 +355,10 @@ public:
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T PopRaw();
|
T PopRaw();
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <unsigned int N>
|
||||||
|
std::array<u32, N> PopHLEHandles();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Pop ///
|
/// Pop ///
|
||||||
|
@ -443,32 +420,23 @@ void RequestParser::Pop(First& first_value, Other&... other_values) {
|
||||||
Pop(other_values...);
|
Pop(other_values...);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Kernel::Handle RequestParser::PopHandle() {
|
|
||||||
const u32 handle_descriptor = Pop<u32>();
|
|
||||||
DEBUG_ASSERT_MSG(IsHandleDescriptor(handle_descriptor),
|
|
||||||
"Tried to pop handle(s) but the descriptor is not a handle descriptor");
|
|
||||||
DEBUG_ASSERT_MSG(HandleNumberFromDesc(handle_descriptor) == 1,
|
|
||||||
"Descriptor indicates that there isn't exactly one handle");
|
|
||||||
return Pop<Kernel::Handle>();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unsigned int N>
|
template <unsigned int N>
|
||||||
std::array<Kernel::Handle, N> RequestParser::PopHandles() {
|
std::array<u32, N> RequestParser::PopHLEHandles() {
|
||||||
u32 handle_descriptor = Pop<u32>();
|
u32 handle_descriptor = Pop<u32>();
|
||||||
ASSERT_MSG(IsHandleDescriptor(handle_descriptor),
|
ASSERT_MSG(IsHandleDescriptor(handle_descriptor),
|
||||||
"Tried to pop handle(s) but the descriptor is not a handle descriptor");
|
"Tried to pop handle(s) but the descriptor is not a handle descriptor");
|
||||||
ASSERT_MSG(N == HandleNumberFromDesc(handle_descriptor),
|
ASSERT_MSG(N == HandleNumberFromDesc(handle_descriptor),
|
||||||
"Number of handles doesn't match the descriptor");
|
"Number of handles doesn't match the descriptor");
|
||||||
|
|
||||||
std::array<Kernel::Handle, N> handles{};
|
std::array<u32, N> handles{};
|
||||||
for (Kernel::Handle& handle : handles) {
|
for (u32& handle : handles) {
|
||||||
handle = Pop<Kernel::Handle>();
|
handle = Pop<u32>();
|
||||||
}
|
}
|
||||||
return handles;
|
return handles;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Kernel::SharedPtr<Kernel::Object> RequestParser::PopGenericObject() {
|
inline Kernel::SharedPtr<Kernel::Object> RequestParser::PopGenericObject() {
|
||||||
Kernel::Handle handle = PopHandle();
|
auto[handle] = PopHLEHandles<1>();
|
||||||
return context->GetIncomingHandle(handle);
|
return context->GetIncomingHandle(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +447,7 @@ Kernel::SharedPtr<T> RequestParser::PopObject() {
|
||||||
|
|
||||||
template <unsigned int N>
|
template <unsigned int N>
|
||||||
inline std::array<Kernel::SharedPtr<Kernel::Object>, N> RequestParser::PopGenericObjects() {
|
inline std::array<Kernel::SharedPtr<Kernel::Object>, N> RequestParser::PopGenericObjects() {
|
||||||
std::array<Kernel::Handle, N> handles = PopHandles<N>();
|
std::array<u32, N> handles = PopHLEHandles<N>();
|
||||||
std::array<Kernel::SharedPtr<Kernel::Object>, N> pointers;
|
std::array<Kernel::SharedPtr<Kernel::Object>, N> pointers;
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
pointers[i] = context->GetIncomingHandle(handles[i]);
|
pointers[i] = context->GetIncomingHandle(handles[i]);
|
||||||
|
@ -524,17 +492,6 @@ inline const std::vector<u8>& RequestParser::PopStaticBuffer() {
|
||||||
return context->GetStaticBuffer(buffer_info.buffer_id);
|
return context->GetStaticBuffer(buffer_info.buffer_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline VAddr RequestParser::PopMappedBuffer(size_t* data_size,
|
|
||||||
MappedBufferPermissions* buffer_perms) {
|
|
||||||
const u32 sbuffer_descriptor = Pop<u32>();
|
|
||||||
MappedBufferDescInfo bufferInfo{sbuffer_descriptor};
|
|
||||||
if (data_size != nullptr)
|
|
||||||
*data_size = bufferInfo.size;
|
|
||||||
if (buffer_perms != nullptr)
|
|
||||||
*buffer_perms = bufferInfo.perms;
|
|
||||||
return Pop<VAddr>();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Kernel::MappedBuffer& RequestParser::PopMappedBuffer() {
|
inline Kernel::MappedBuffer& RequestParser::PopMappedBuffer() {
|
||||||
u32 mapped_buffer_descriptor = Pop<u32>();
|
u32 mapped_buffer_descriptor = Pop<u32>();
|
||||||
ASSERT_MSG(GetDescriptorType(mapped_buffer_descriptor) == MappedBuffer,
|
ASSERT_MSG(GetDescriptorType(mapped_buffer_descriptor) == MappedBuffer,
|
||||||
|
|
|
@ -100,7 +100,7 @@ void FS_USER::OpenFileDirectly(Kernel::HLERequestContext& ctx) {
|
||||||
"Failed to get a handle for archive archive_id=0x%08X archive_path=%s",
|
"Failed to get a handle for archive archive_id=0x%08X archive_path=%s",
|
||||||
static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
|
static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
|
||||||
rb.Push(archive_handle.Code());
|
rb.Push(archive_handle.Code());
|
||||||
rb.PushMoveHandles(0);
|
rb.PushMoveObjects<Kernel::Object>(nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SCOPE_EXIT({ Service::FS::CloseArchive(*archive_handle); });
|
SCOPE_EXIT({ Service::FS::CloseArchive(*archive_handle); });
|
||||||
|
|
Reference in New Issue