Explorar el Código

Kernel/Threading: Warn when a thread can be scheduled in the Syscore (Core 1).

We do not currently implement any cores other than the AppCore (Core 0).
Subv hace 10 años
padre
commit
5b7f86708c
Se han modificado 3 ficheros con 10 adiciones y 0 borrados
  1. 2 0
      src/core/hle/kernel/process.h
  2. 5 0
      src/core/hle/svc.cpp
  3. 3 0
      src/core/loader/ncch.cpp

+ 2 - 0
src/core/hle/kernel/process.h

@@ -107,6 +107,8 @@ public:
     ProcessFlags flags;
     ProcessFlags flags;
     /// Kernel compatibility version for this process
     /// Kernel compatibility version for this process
     u16 kernel_version = 0;
     u16 kernel_version = 0;
+    /// The default CPU for this process, threads are scheduled on this cpu by default.
+    u8 ideal_processor = 0;
 
 
     /// The id of this process
     /// The id of this process
     u32 process_id = next_process_id++;
     u32 process_id = next_process_id++;

+ 5 - 0
src/core/hle/svc.cpp

@@ -497,6 +497,11 @@ static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point
         break;
         break;
     }
     }
 
 
+    if (processor_id == THREADPROCESSORID_1 || processor_id == THREADPROCESSORID_ALL ||
+        (processor_id == THREADPROCESSORID_DEFAULT && Kernel::g_current_process->ideal_processor == THREADPROCESSORID_1)) {
+        LOG_WARNING(Kernel_SVC, "Newly created thread is allowed to be run in the SysCore, unimplemented.");
+    }
+
     CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create(
     CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create(
             name, entry_point, priority, arg, processor_id, stack_top));
             name, entry_point, priority, arg, processor_id, stack_top));
     CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(thread)));
     CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(thread)));

+ 3 - 0
src/core/loader/ncch.cpp

@@ -156,6 +156,9 @@ ResultStatus AppLoader_NCCH::LoadExec() {
         Kernel::g_current_process->resource_limit = Kernel::ResourceLimit::GetForCategory(
         Kernel::g_current_process->resource_limit = Kernel::ResourceLimit::GetForCategory(
             static_cast<Kernel::ResourceLimitCategory>(exheader_header.arm11_system_local_caps.resource_limit_category));
             static_cast<Kernel::ResourceLimitCategory>(exheader_header.arm11_system_local_caps.resource_limit_category));
 
 
+        // Set the default CPU core for this process
+        Kernel::g_current_process->ideal_processor = exheader_header.arm11_system_local_caps.ideal_processor;
+
         // Copy data while converting endianess
         // Copy data while converting endianess
         std::array<u32, ARRAY_SIZE(exheader_header.arm11_kernel_caps.descriptors)> kernel_caps;
         std::array<u32, ARRAY_SIZE(exheader_header.arm11_kernel_caps.descriptors)> kernel_caps;
         std::copy_n(exheader_header.arm11_kernel_caps.descriptors, kernel_caps.size(), begin(kernel_caps));
         std::copy_n(exheader_header.arm11_kernel_caps.descriptors, kernel_caps.size(), begin(kernel_caps));