summaryrefslogtreecommitdiff
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-05-10 19:47:07 -0300
committerGravatar Yuri Kunde Schlesner2015-05-10 19:47:07 -0300
commitc96f22490a4a459d477f446fd4e5f894f580b69c (patch)
tree3047a04a88ecd381f2e2984b41b2fb21119940d9 /src/core/hle/service
parentMerge pull request #736 from yuriks/remove-BIT (diff)
downloadyuzu-c96f22490a4a459d477f446fd4e5f894f580b69c.tar.gz
yuzu-c96f22490a4a459d477f446fd4e5f894f580b69c.tar.xz
yuzu-c96f22490a4a459d477f446fd4e5f894f580b69c.zip
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 560c9dcf6..09d463dd5 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -304,7 +304,9 @@ void Init() {
304 file.ReadBytes(shared_font.data(), (size_t)file.GetSize()); 304 file.ReadBytes(shared_font.data(), (size_t)file.GetSize());
305 305
306 // Create shared font memory object 306 // Create shared font memory object
307 shared_font_mem = Kernel::SharedMemory::Create("APT_U:shared_font_mem"); 307 using Kernel::MemoryPermission;
308 shared_font_mem = Kernel::SharedMemory::Create(3 * 1024 * 1024, // 3MB
309 MemoryPermission::ReadWrite, MemoryPermission::Read, "APT_U:shared_font_mem");
308 } else { 310 } else {
309 LOG_WARNING(Service_APT, "Unable to load shared font: %s", filepath.c_str()); 311 LOG_WARNING(Service_APT, "Unable to load shared font: %s", filepath.c_str());
310 shared_font_mem = nullptr; 312 shared_font_mem = nullptr;
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 8da063bd2..e2b6b0b02 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;
35 35
36/// Gets a pointer to a thread command buffer in GSP shared memory 36/// Gets a pointer to a thread command buffer in GSP shared memory
37static inline u8* GetCommandBuffer(u32 thread_id) { 37static inline u8* GetCommandBuffer(u32 thread_id) {
38 ResultVal<u8*> ptr = g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer))); 38 return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer)));
39 return ptr.ValueOr(nullptr);
40} 39}
41 40
42static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) { 41static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) {
@@ -44,14 +43,14 @@ static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_in
44 43
45 // For each thread there are two FrameBufferUpdate fields 44 // For each thread there are two FrameBufferUpdate fields
46 u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate); 45 u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate);
47 ResultVal<u8*> ptr = g_shared_memory->GetPointer(offset); 46 u8* ptr = g_shared_memory->GetPointer(offset);
48 return reinterpret_cast<FrameBufferUpdate*>(ptr.ValueOr(nullptr)); 47 return reinterpret_cast<FrameBufferUpdate*>(ptr);
49} 48}
50 49
51/// Gets a pointer to the interrupt relay queue for a given thread index 50/// Gets a pointer to the interrupt relay queue for a given thread index
52static inline InterruptRelayQueue* GetInterruptRelayQueue(u32 thread_id) { 51static inline InterruptRelayQueue* GetInterruptRelayQueue(u32 thread_id) {
53 ResultVal<u8*> ptr = g_shared_memory->GetPointer(sizeof(InterruptRelayQueue) * thread_id); 52 u8* ptr = g_shared_memory->GetPointer(sizeof(InterruptRelayQueue) * thread_id);
54 return reinterpret_cast<InterruptRelayQueue*>(ptr.ValueOr(nullptr)); 53 return reinterpret_cast<InterruptRelayQueue*>(ptr);
55} 54}
56 55
57/** 56/**
@@ -288,7 +287,10 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) {
288 287
289 g_interrupt_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[3]); 288 g_interrupt_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[3]);
290 ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!"); 289 ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!");
291 g_shared_memory = Kernel::SharedMemory::Create("GSPSharedMem"); 290
291 using Kernel::MemoryPermission;
292 g_shared_memory = Kernel::SharedMemory::Create(0x1000, MemoryPermission::ReadWrite,
293 MemoryPermission::ReadWrite, "GSPSharedMem");
292 294
293 Handle shmem_handle = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom(); 295 Handle shmem_handle = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom();
294 296
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index dd85848d0..9695f7e56 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;
48// * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_y <= -41 48// * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_y <= -41
49 49
50void Update() { 50void Update() {
51 SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer().ValueOr(nullptr)); 51 SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
52 const PadState state = VideoCore::g_emu_window->GetPadState(); 52 const PadState state = VideoCore::g_emu_window->GetPadState();
53 53
54 if (mem == nullptr) { 54 if (mem == nullptr) {
@@ -163,7 +163,9 @@ void Init() {
163 AddService(new HID_U_Interface); 163 AddService(new HID_U_Interface);
164 AddService(new HID_SPVR_Interface); 164 AddService(new HID_SPVR_Interface);
165 165
166 shared_mem = SharedMemory::Create("HID:SharedMem"); 166 using Kernel::MemoryPermission;
167 shared_mem = SharedMemory::Create(0x1000, MemoryPermission::ReadWrite,
168 MemoryPermission::Read, "HID:SharedMem");
167 169
168 next_pad_index = 0; 170 next_pad_index = 0;
169 next_touch_index = 0; 171 next_touch_index = 0;
diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp
index 15ac477ef..adfbb258d 100644
--- a/src/core/hle/service/ir/ir.cpp
+++ b/src/core/hle/service/ir/ir.cpp
@@ -34,7 +34,9 @@ void Init() {
34 AddService(new IR_U_Interface); 34 AddService(new IR_U_Interface);
35 AddService(new IR_User_Interface); 35 AddService(new IR_User_Interface);
36 36
37 shared_memory = SharedMemory::Create("IR:SharedMemory"); 37 using Kernel::MemoryPermission;
38 shared_memory = SharedMemory::Create(0x1000, Kernel::MemoryPermission::ReadWrite,
39 Kernel::MemoryPermission::ReadWrite, "IR:SharedMemory");
38 40
39 // Create event handle(s) 41 // Create event handle(s)
40 handle_event = Event::Create(RESETTYPE_ONESHOT, "IR:HandleEvent"); 42 handle_event = Event::Create(RESETTYPE_ONESHOT, "IR:HandleEvent");