summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/process.h4
-rw-r--r--src/core/hle/kernel/svc.cpp17
-rw-r--r--src/core/hle/kernel/svc.h1
-rw-r--r--src/core/hle/kernel/thread.h13
4 files changed, 25 insertions, 10 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 305275387..20b4e401c 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -13,6 +13,7 @@
#include "common/bit_field.h"
#include "common/common_types.h"
#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/thread.h"
#include "core/hle/kernel/vm_manager.h"
namespace Kernel {
@@ -127,6 +128,9 @@ public:
u16 kernel_version = 0;
/// The default CPU for this process, threads are scheduled on this cpu by default.
u8 ideal_processor = 0;
+ /// 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;
/// Current status of the process
ProcessStatus status;
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index bfe1907e3..a1eaab649 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -296,8 +296,14 @@ 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::TotalMemoryUsage:
*result = vm_manager.GetTotalMemoryUsage();
break;
@@ -455,16 +461,15 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
switch (processor_id) {
case THREADPROCESSORID_0:
break;
- case THREADPROCESSORID_ALL:
- LOG_INFO(Kernel_SVC,
- "Newly created thread is allowed to be run in any Core, unimplemented.");
- break;
case THREADPROCESSORID_1:
+ case THREADPROCESSORID_2:
+ case THREADPROCESSORID_3:
+ // TODO(bunnei): Implement support for other processor IDs
LOG_ERROR(Kernel_SVC,
- "Newly created thread must run in the SysCore (Core1), unimplemented.");
+ "Newly created thread must run in another thread (%u), unimplemented.",
+ processor_id);
break;
default:
- // TODO(bunnei): Implement support for other processor IDs
ASSERT_MSG(false, "Unsupported thread processor ID: %d", processor_id);
break;
}
diff --git a/src/core/hle/kernel/svc.h b/src/core/hle/kernel/svc.h
index a95598994..ff45482a3 100644
--- a/src/core/hle/kernel/svc.h
+++ b/src/core/hle/kernel/svc.h
@@ -23,6 +23,7 @@ struct PageInfo {
/// Values accepted by svcGetInfo
enum class GetInfoType : u64 {
// 1.0.0+
+ AllowedCpuIdBitmask = 0,
TotalMemoryUsage = 6,
TotalHeapUsage = 7,
RandomEntropy = 11,
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 19ba6e0af..0a1ada27d 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -24,10 +24,15 @@ enum ThreadPriority : u32 {
enum ThreadProcessorId : s32 {
THREADPROCESSORID_DEFAULT = -2, ///< Run thread on default core specified by exheader
- THREADPROCESSORID_ALL = -1, ///< Run thread on either core
- THREADPROCESSORID_0 = 0, ///< Run thread on core 0 (AppCore)
- THREADPROCESSORID_1 = 1, ///< Run thread on core 1 (SysCore)
- THREADPROCESSORID_MAX = 2, ///< Processor ID must be less than this
+ THREADPROCESSORID_0 = 0, ///< Run thread on core 0
+ THREADPROCESSORID_1 = 1, ///< Run thread on core 1
+ THREADPROCESSORID_2 = 2, ///< Run thread on core 2
+ THREADPROCESSORID_3 = 3, ///< Run thread on core 3
+ THREADPROCESSORID_MAX = 4, ///< Processor ID must be less than this
+
+ /// Allowed CPU mask
+ THREADPROCESSORID_DEFAULT_MASK = (1 << THREADPROCESSORID_0) | (1 << THREADPROCESSORID_1) |
+ (1 << THREADPROCESSORID_2) | (1 << THREADPROCESSORID_3)
};
enum ThreadStatus {