mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-23 20:05:01 +00:00
Clang
This commit is contained in:
parent
5bf4d09344
commit
de729835d6
5 changed files with 29 additions and 19 deletions
|
@ -1,12 +1,12 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/devices/gc_device.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/gnmdriver/gnmdriver.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/memory.h"
|
||||
#include "common/assert.h"
|
||||
|
||||
namespace Core::Devices {
|
||||
|
||||
|
@ -15,13 +15,11 @@ std::shared_ptr<BaseDevice> GcDevice::Create(u32 handle, const char*, int, u16)
|
|||
reinterpret_cast<Devices::BaseDevice*>(new GcDevice(handle)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
s32* submits_addr = 0;
|
||||
|
||||
s32 GcDevice::ioctl(u64 cmd, Common::VaCtx* args) {
|
||||
auto command = GcCommands(cmd);
|
||||
switch(command) {
|
||||
switch (command) {
|
||||
case GcCommands::FlushGarlic: {
|
||||
LOG_ERROR(Lib_GnmDriver, "ioctl FlushGarlic");
|
||||
break;
|
||||
|
@ -61,9 +59,11 @@ s32 GcDevice::ioctl(u64 cmd, Common::VaCtx* args) {
|
|||
s32* out_addr;
|
||||
VAddr in_addr{0xfe0100000};
|
||||
auto prot = Core::MemoryProt::CpuRead;
|
||||
auto flags = Core::MemoryMapFlags::Shared | Core::MemoryMapFlags::Anon | Core::MemoryMapFlags::System;
|
||||
auto flags = Core::MemoryMapFlags::Shared | Core::MemoryMapFlags::Anon |
|
||||
Core::MemoryMapFlags::System;
|
||||
auto type = Core::VMAType::Direct;
|
||||
s32 result = memory->MapMemory(reinterpret_cast<void**>(&out_addr), in_addr, 0x4000, prot, flags, type);
|
||||
s32 result = memory->MapMemory(reinterpret_cast<void**>(&out_addr), in_addr, 0x4000,
|
||||
prot, flags, type);
|
||||
if (result != 0) {
|
||||
return POSIX_ENOMEM;
|
||||
}
|
||||
|
@ -81,7 +81,9 @@ s32 GcDevice::ioctl(u64 cmd, Common::VaCtx* args) {
|
|||
}
|
||||
case GcCommands::SetGsRingSizes: {
|
||||
auto data = vaArgPtr<SetGsRingSizesArgs>(&args->va_list);
|
||||
LOG_ERROR(Lib_GnmDriver, "unhandled ioctl SetGsRingSizes, esgs size = {:#x}, gsvs size = {:#x}", data->esgs_ring_size, data->gsvs_ring_size);
|
||||
LOG_ERROR(Lib_GnmDriver,
|
||||
"unhandled ioctl SetGsRingSizes, esgs size = {:#x}, gsvs size = {:#x}",
|
||||
data->esgs_ring_size, data->gsvs_ring_size);
|
||||
break;
|
||||
}
|
||||
case GcCommands::Submit: {
|
||||
|
@ -121,7 +123,8 @@ s32 GcDevice::ioctl(u64 cmd, Common::VaCtx* args) {
|
|||
auto ring_size = pow(2, data->ring_size_dw);
|
||||
data->pipe_priority = 0;
|
||||
LOG_ERROR(Lib_GnmDriver, "ioctl MapComputeQueue, pipe_id = {}", pipe_id);
|
||||
Libraries::GnmDriver::sceGnmMapComputeQueue(pipe_id, data->queue_id, data->ring_base_addr, ring_size, data->read_ptr_addr);
|
||||
Libraries::GnmDriver::sceGnmMapComputeQueue(pipe_id, data->queue_id, data->ring_base_addr,
|
||||
ring_size, data->read_ptr_addr);
|
||||
break;
|
||||
}
|
||||
case GcCommands::MapComputeQueueWithPriority: {
|
||||
|
@ -130,7 +133,9 @@ s32 GcDevice::ioctl(u64 cmd, Common::VaCtx* args) {
|
|||
auto pipe_id = data->pipe_lo - 1;
|
||||
auto ring_size = pow(2, data->ring_size_dw);
|
||||
LOG_ERROR(Lib_GnmDriver, "ioctl MapComputeQueueWithPriority, pipe_id = {}", pipe_id);
|
||||
Libraries::GnmDriver::sceGnmMapComputeQueueWithPriority(pipe_id, data->queue_id, data->ring_base_addr, ring_size, data->read_ptr_addr, data->pipe_priority);
|
||||
Libraries::GnmDriver::sceGnmMapComputeQueueWithPriority(
|
||||
pipe_id, data->queue_id, data->ring_base_addr, ring_size, data->read_ptr_addr,
|
||||
data->pipe_priority);
|
||||
break;
|
||||
}
|
||||
case GcCommands::SetWaveLimitMultipliers: {
|
||||
|
@ -140,7 +145,7 @@ s32 GcDevice::ioctl(u64 cmd, Common::VaCtx* args) {
|
|||
}
|
||||
case GcCommands::MipStatsReport: {
|
||||
auto data = vaArgPtr<SetMipStatsReportArgs>(&args->va_list);
|
||||
switch(data->type) {
|
||||
switch (data->type) {
|
||||
case 0x10001:
|
||||
case 0x18001: {
|
||||
break;
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
int ftruncate(s64 length) override;
|
||||
int getdents(void* buf, u32 nbytes, s64* basep) override;
|
||||
s64 pwrite(const void* buf, size_t nbytes, u64 offset) override;
|
||||
|
||||
private:
|
||||
enum class GcCommands : u64 {
|
||||
FlushGarlic = 0xc0048114,
|
||||
|
@ -62,7 +63,7 @@ private:
|
|||
u32 count;
|
||||
u64* cmds;
|
||||
};
|
||||
|
||||
|
||||
struct SubmitEopArgs {
|
||||
u32 pid;
|
||||
u32 count;
|
||||
|
|
|
@ -234,8 +234,8 @@ s32 PS4_SYSV_ABI sceKernelMapNamedFlexibleMemory(void** addr_in_out, std::size_t
|
|||
Core::VMAType::Flexible, name);
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceKernelMapNamedSystemFlexibleMemory(void** addr_in_out, std::size_t len, int prot,
|
||||
int flags, const char* name) {
|
||||
s32 PS4_SYSV_ABI sceKernelMapNamedSystemFlexibleMemory(void** addr_in_out, std::size_t len,
|
||||
int prot, int flags, const char* name) {
|
||||
if (len == 0 || !Common::Is16KBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "len is 0 or not 16kb multiple");
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
|
@ -609,7 +609,8 @@ void RegisterMemory(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("PGhQHd-dzv8", "libkernel", 1, "libkernel", 1, 1, sceKernelMmap);
|
||||
LIB_FUNCTION("cQke9UuBQOk", "libkernel", 1, "libkernel", 1, 1, sceKernelMunmap);
|
||||
LIB_FUNCTION("mL8NDH86iQI", "libkernel", 1, "libkernel", 1, 1, sceKernelMapNamedFlexibleMemory);
|
||||
LIB_FUNCTION("kc+LEEIYakc", "libkernel", 1, "libkernel", 1, 1, sceKernelMapNamedSystemFlexibleMemory);
|
||||
LIB_FUNCTION("kc+LEEIYakc", "libkernel", 1, "libkernel", 1, 1,
|
||||
sceKernelMapNamedSystemFlexibleMemory);
|
||||
LIB_FUNCTION("aNz11fnnzi4", "libkernel", 1, "libkernel", 1, 1,
|
||||
sceKernelAvailableFlexibleMemorySize);
|
||||
LIB_FUNCTION("aNz11fnnzi4", "libkernel_avlfmem", 1, "libkernel", 1, 1,
|
||||
|
|
|
@ -129,7 +129,8 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolReserve(void* addrIn, size_t len, size_t ali
|
|||
s32 PS4_SYSV_ABI sceKernelMemoryPoolCommit(void* addr, size_t len, int type, int prot, int flags);
|
||||
s32 PS4_SYSV_ABI sceKernelMemoryPoolDecommit(void* addr, size_t len, int flags);
|
||||
|
||||
int PS4_SYSV_ABI sceKernelMmap(void* addr, u64 len, int prot, int flags, int fd, size_t offset, void** res);
|
||||
int PS4_SYSV_ABI sceKernelMmap(void* addr, u64 len, int prot, int flags, int fd, size_t offset,
|
||||
void** res);
|
||||
|
||||
int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len);
|
||||
|
||||
|
|
|
@ -360,9 +360,11 @@ int MemoryManager::MapMemory(void** out_addr, VAddr virtual_addr, size_t size, M
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int MemoryManager::MapSystemMemory(void** out_addr, VAddr virtual_addr, size_t size, MemoryProt prot,
|
||||
MemoryMapFlags flags, VMAType type, std::string_view name) {
|
||||
// If address is 0, this maps to System Reserved memory instead, which starts at address 0x880000000
|
||||
int MemoryManager::MapSystemMemory(void** out_addr, VAddr virtual_addr, size_t size,
|
||||
MemoryProt prot, MemoryMapFlags flags, VMAType type,
|
||||
std::string_view name) {
|
||||
// If address is 0, this maps to System Reserved memory.
|
||||
// System Reserved memory starts at address 0x880000000.
|
||||
VAddr in_addr = virtual_addr;
|
||||
if (in_addr == 0) {
|
||||
static constexpr VAddr KernelAllocBase = 0x880000000ULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue