aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/hle_ipc.h12
-rw-r--r--src/core/hle/kernel/kernel.h1
-rw-r--r--src/core/hle/kernel/memory.cpp6
-rw-r--r--src/core/hle/kernel/mutex.h6
-rw-r--r--src/core/hle/kernel/process.h2
-rw-r--r--src/core/hle/kernel/svc.cpp36
-rw-r--r--src/core/hle/kernel/svc.h14
-rw-r--r--src/core/hle/kernel/vm_manager.cpp9
8 files changed, 69 insertions, 17 deletions
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 09caa43df..6dceb766d 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -151,13 +151,13 @@ public:
return domain != nullptr;
}
- template<typename T>
+ template <typename T>
SharedPtr<T> GetCopyObject(size_t index) {
ASSERT(index < copy_objects.size());
return DynamicObjectCast<T>(copy_objects[index]);
}
- template<typename T>
+ template <typename T>
SharedPtr<T> GetMoveObject(size_t index) {
ASSERT(index < move_objects.size());
return DynamicObjectCast<T>(move_objects[index]);
@@ -175,6 +175,14 @@ public:
domain_objects.emplace_back(std::move(object));
}
+ /// Clears the list of objects so that no lingering objects are written accidentally to the
+ /// response buffer.
+ void ClearIncomingObjects() {
+ move_objects.clear();
+ copy_objects.clear();
+ domain_objects.clear();
+ }
+
private:
std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
SharedPtr<Kernel::Domain> domain;
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index df3b4083e..4d9549e45 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -105,7 +105,6 @@ public:
UNREACHABLE();
}
-
public:
static unsigned int next_object_id;
diff --git a/src/core/hle/kernel/memory.cpp b/src/core/hle/kernel/memory.cpp
index d990d0569..d2600cdd7 100644
--- a/src/core/hle/kernel/memory.cpp
+++ b/src/core/hle/kernel/memory.cpp
@@ -95,10 +95,8 @@ MemoryRegionInfo* GetMemoryRegion(MemoryRegion region) {
}
}
-void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) {
-}
+void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) {}
-void MapSharedPages(VMManager& address_space) {
-}
+void MapSharedPages(VMManager& address_space) {}
} // namespace Kernel
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h
index 49b6b454e..38db21005 100644
--- a/src/core/hle/kernel/mutex.h
+++ b/src/core/hle/kernel/mutex.h
@@ -41,9 +41,9 @@ public:
return HANDLE_TYPE;
}
- u32 priority; ///< The priority of the mutex, used for priority inheritance.
- std::string name; ///< Name of mutex (optional)
- VAddr guest_addr; ///< Address of the guest mutex value
+ u32 priority; ///< The priority of the mutex, used for priority inheritance.
+ std::string name; ///< Name of mutex (optional)
+ VAddr guest_addr; ///< Address of the guest mutex value
/**
* Elevate the mutex priority to the best priority
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 20b4e401c..add98472f 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -131,6 +131,8 @@ public:
/// Bitmask of allowed CPUs that this process' threads can run on. TODO(Subv): Actually parse
/// this value from the process header.
u32 allowed_processor_mask = THREADPROCESSORID_DEFAULT_MASK;
+ u32 allowed_thread_priority_mask = 0xFFFFFFFF;
+ u32 is_virtual_address_memory_enabled = 0;
/// Current status of the process
ProcessStatus status;
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 9c60576c1..088058ebc 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -305,14 +305,27 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
LOG_TRACE(Kernel_SVC, "called info_id=0x%X, info_sub_id=0x%X, handle=0x%08X", info_id,
info_sub_id, handle);
- ASSERT(handle == 0 || handle == CurrentProcess);
-
auto& vm_manager = g_current_process->vm_manager;
switch (static_cast<GetInfoType>(info_id)) {
case GetInfoType::AllowedCpuIdBitmask:
*result = g_current_process->allowed_processor_mask;
break;
+ case GetInfoType::AllowedThreadPrioBitmask:
+ *result = g_current_process->allowed_thread_priority_mask;
+ break;
+ case GetInfoType::MapRegionBaseAddr:
+ *result = vm_manager.GetAddressSpaceBaseAddr();
+ break;
+ case GetInfoType::MapRegionSize:
+ *result = vm_manager.GetAddressSpaceSize();
+ break;
+ case GetInfoType::HeapRegionBaseAddr:
+ *result = vm_manager.GetNewMapRegionBaseAddr() + vm_manager.GetNewMapRegionSize();
+ break;
+ case GetInfoType::HeapRegionSize:
+ *result = Memory::HEAP_SIZE;
+ break;
case GetInfoType::TotalMemoryUsage:
*result = vm_manager.GetTotalMemoryUsage();
break;
@@ -334,6 +347,18 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
case GetInfoType::NewMapRegionSize:
*result = vm_manager.GetNewMapRegionSize();
break;
+ case GetInfoType::IsVirtualAddressMemoryEnabled:
+ *result = g_current_process->is_virtual_address_memory_enabled;
+ break;
+ case GetInfoType::TitleId:
+ LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0");
+ *result = 0;
+ break;
+ case GetInfoType::PrivilegedProcessId:
+ LOG_WARNING(Kernel_SVC,
+ "(STUBBED) Attempted to query priviledged process id bounds, returned 0");
+ *result = 0;
+ break;
default:
UNIMPLEMENTED();
}
@@ -709,6 +734,11 @@ static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32
return RESULT_SUCCESS;
}
+static ResultCode SetThreadCoreMask(u64, u64, u64) {
+ LOG_WARNING(Kernel_SVC, "(STUBBED) called");
+ return RESULT_SUCCESS;
+}
+
namespace {
struct FunctionDef {
using Func = void();
@@ -735,7 +765,7 @@ static const FunctionDef SVC_Table[] = {
{0x0C, SvcWrap<GetThreadPriority>, "GetThreadPriority"},
{0x0D, SvcWrap<SetThreadPriority>, "SetThreadPriority"},
{0x0E, nullptr, "GetThreadCoreMask"},
- {0x0F, nullptr, "SetThreadCoreMask"},
+ {0x0F, SvcWrap<SetThreadCoreMask>, "SetThreadCoreMask"},
{0x10, SvcWrap<GetCurrentProcessorNumber>, "GetCurrentProcessorNumber"},
{0x11, nullptr, "SignalEvent"},
{0x12, nullptr, "ClearEvent"},
diff --git a/src/core/hle/kernel/svc.h b/src/core/hle/kernel/svc.h
index 610cd1d7d..42cc41da3 100644
--- a/src/core/hle/kernel/svc.h
+++ b/src/core/hle/kernel/svc.h
@@ -24,14 +24,28 @@ struct PageInfo {
enum class GetInfoType : u64 {
// 1.0.0+
AllowedCpuIdBitmask = 0,
+ AllowedThreadPrioBitmask = 1,
+ MapRegionBaseAddr = 2,
+ MapRegionSize = 3,
+ HeapRegionBaseAddr = 4,
+ HeapRegionSize = 5,
TotalMemoryUsage = 6,
TotalHeapUsage = 7,
+ IsCurrentProcessBeingDebugged = 8,
+ ResourceHandleLimit = 9,
+ IdleTickCount = 10,
RandomEntropy = 11,
+ PerformanceCounter = 0xF0000002,
// 2.0.0+
AddressSpaceBaseAddr = 12,
AddressSpaceSize = 13,
NewMapRegionBaseAddr = 14,
NewMapRegionSize = 15,
+ // 3.0.0+
+ IsVirtualAddressMemoryEnabled = 16,
+ TitleId = 18,
+ // 4.0.0+
+ PrivilegedProcessId = 19,
};
void CallSVC(u32 immediate);
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp
index dca637dde..bf261699e 100644
--- a/src/core/hle/kernel/vm_manager.cpp
+++ b/src/core/hle/kernel/vm_manager.cpp
@@ -6,9 +6,9 @@
#include "common/assert.h"
#include "common/logging/log.h"
#include "core/arm/arm_interface.h"
+#include "core/core.h"
#include "core/hle/kernel/errors.h"
#include "core/hle/kernel/vm_manager.h"
-#include "core/core.h"
#include "core/memory.h"
#include "core/memory_setup.h"
#include "core/mmio.h"
@@ -86,7 +86,8 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
VirtualMemoryArea& final_vma = vma_handle->second;
ASSERT(final_vma.size == size);
- Core::CPU().MapBackingMemory(target, size, block->data() + offset, VMAPermission::ReadWriteExecute);
+ Core::CPU().MapBackingMemory(target, size, block->data() + offset,
+ VMAPermission::ReadWriteExecute);
final_vma.type = VMAType::AllocatedMemoryBlock;
final_vma.permissions = VMAPermission::ReadWrite;
@@ -356,12 +357,12 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) {
u64 VMManager::GetTotalMemoryUsage() {
LOG_WARNING(Kernel, "(STUBBED) called");
- return 0x400000;
+ return 0xBE000000;
}
u64 VMManager::GetTotalHeapUsage() {
LOG_WARNING(Kernel, "(STUBBED) called");
- return 0x10000;
+ return 0x0;
}
VAddr VMManager::GetAddressSpaceBaseAddr() {