aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-10 19:47:07 -0300
committerGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-10 19:47:07 -0300
commitc96f22490a4a459d477f446fd4e5f894f580b69c (patch)
tree3047a04a88ecd381f2e2984b41b2fb21119940d9 /src/core/hle/service
parent088f6ae2c65824152aae5a76559ce35d75f0e000 (diff)
Kernel: Capture SharedMemory attributes at creation, not when mapping
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/apt/apt.cpp4
-rw-r--r--src/core/hle/service/gsp_gpu.cpp16
-rw-r--r--src/core/hle/service/hid/hid.cpp6
-rw-r--r--src/core/hle/service/ir/ir.cpp4
4 files changed, 19 insertions, 11 deletions
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp
index 560c9dcf..09d463dd 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -304,7 +304,9 @@ void Init() {
file.ReadBytes(shared_font.data(), (size_t)file.GetSize());
// Create shared font memory object
- shared_font_mem = Kernel::SharedMemory::Create("APT_U:shared_font_mem");
+ using Kernel::MemoryPermission;
+ shared_font_mem = Kernel::SharedMemory::Create(3 * 1024 * 1024, // 3MB
+ MemoryPermission::ReadWrite, MemoryPermission::Read, "APT_U:shared_font_mem");
} else {
LOG_WARNING(Service_APT, "Unable to load shared font: %s", filepath.c_str());
shared_font_mem = nullptr;
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 8da063bd..e2b6b0b0 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -35,8 +35,7 @@ u32 g_thread_id = 1;
/// Gets a pointer to a thread command buffer in GSP shared memory
static inline u8* GetCommandBuffer(u32 thread_id) {
- ResultVal<u8*> ptr = g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer)));
- return ptr.ValueOr(nullptr);
+ return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer)));
}
static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) {
@@ -44,14 +43,14 @@ static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_in
// For each thread there are two FrameBufferUpdate fields
u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate);
- ResultVal<u8*> ptr = g_shared_memory->GetPointer(offset);
- return reinterpret_cast<FrameBufferUpdate*>(ptr.ValueOr(nullptr));
+ u8* ptr = g_shared_memory->GetPointer(offset);
+ return reinterpret_cast<FrameBufferUpdate*>(ptr);
}
/// Gets a pointer to the interrupt relay queue for a given thread index
static inline InterruptRelayQueue* GetInterruptRelayQueue(u32 thread_id) {
- ResultVal<u8*> ptr = g_shared_memory->GetPointer(sizeof(InterruptRelayQueue) * thread_id);
- return reinterpret_cast<InterruptRelayQueue*>(ptr.ValueOr(nullptr));
+ u8* ptr = g_shared_memory->GetPointer(sizeof(InterruptRelayQueue) * thread_id);
+ return reinterpret_cast<InterruptRelayQueue*>(ptr);
}
/**
@@ -288,7 +287,10 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) {
g_interrupt_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[3]);
ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!");
- g_shared_memory = Kernel::SharedMemory::Create("GSPSharedMem");
+
+ using Kernel::MemoryPermission;
+ g_shared_memory = Kernel::SharedMemory::Create(0x1000, MemoryPermission::ReadWrite,
+ MemoryPermission::ReadWrite, "GSPSharedMem");
Handle shmem_handle = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom();
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index dd85848d..9695f7e5 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -48,7 +48,7 @@ static u32 next_touch_index;
// * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_y <= -41
void Update() {
- SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer().ValueOr(nullptr));
+ SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
const PadState state = VideoCore::g_emu_window->GetPadState();
if (mem == nullptr) {
@@ -163,7 +163,9 @@ void Init() {
AddService(new HID_U_Interface);
AddService(new HID_SPVR_Interface);
- shared_mem = SharedMemory::Create("HID:SharedMem");
+ using Kernel::MemoryPermission;
+ shared_mem = SharedMemory::Create(0x1000, MemoryPermission::ReadWrite,
+ MemoryPermission::Read, "HID:SharedMem");
next_pad_index = 0;
next_touch_index = 0;
diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp
index 15ac477e..adfbb258 100644
--- a/src/core/hle/service/ir/ir.cpp
+++ b/src/core/hle/service/ir/ir.cpp
@@ -34,7 +34,9 @@ void Init() {
AddService(new IR_U_Interface);
AddService(new IR_User_Interface);
- shared_memory = SharedMemory::Create("IR:SharedMemory");
+ using Kernel::MemoryPermission;
+ shared_memory = SharedMemory::Create(0x1000, Kernel::MemoryPermission::ReadWrite,
+ Kernel::MemoryPermission::ReadWrite, "IR:SharedMemory");
// Create event handle(s)
handle_event = Event::Create(RESETTYPE_ONESHOT, "IR:HandleEvent");