mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-26 20:15:03 +00:00
kernel: Back to SCHED_OTHER
This commit is contained in:
parent
54721d7565
commit
7577bd4e77
@ -42,7 +42,6 @@ void init_pthreads() {
|
|||||||
scePthreadRwlockattrInit(&default_rwattr);
|
scePthreadRwlockattrInit(&default_rwattr);
|
||||||
g_pthread_cxt->setDefaultRwattr(default_rwattr);
|
g_pthread_cxt->setDefaultRwattr(default_rwattr);
|
||||||
|
|
||||||
g_pthread_cxt->setPthreadKeys(new PthreadKeys);
|
|
||||||
g_pthread_cxt->SetPthreadPool(new PThreadPool);
|
g_pthread_cxt->SetPthreadPool(new PThreadPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,8 +236,9 @@ int PS4_SYSV_ABI scePthreadAttrSetschedparam(ScePthreadAttr* attr,
|
|||||||
pparam.sched_priority = 0;
|
pparam.sched_priority = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = pthread_attr_setschedparam(&(*attr)->pth_attr, &pparam);
|
// We always use SCHED_OTHER for now, so don't call this for now.
|
||||||
|
//int result = pthread_attr_setschedparam(&(*attr)->pth_attr, &pparam);
|
||||||
|
int result = 0;
|
||||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,19 +271,9 @@ int PS4_SYSV_ABI scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy)
|
|||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ppolicy = SCHED_OTHER;
|
int ppolicy = SCHED_OTHER; // winpthreads only supports SCHED_OTHER
|
||||||
switch (policy) {
|
if (policy != SCHED_OTHER) {
|
||||||
case 0:
|
LOG_ERROR(Kernel_Pthread, "policy={} not supported by winpthreads", policy);
|
||||||
ppolicy = SCHED_OTHER;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
ppolicy = SCHED_FIFO;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
ppolicy = SCHED_OTHER;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(*attr)->policy = policy;
|
(*attr)->policy = policy;
|
||||||
|
@ -111,30 +111,6 @@ private:
|
|||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PthreadKeys {
|
|
||||||
public:
|
|
||||||
PthreadKeys() {}
|
|
||||||
virtual ~PthreadKeys() {}
|
|
||||||
|
|
||||||
bool CreateKey(int* key, PthreadKeyDestructor destructor);
|
|
||||||
bool GetKey(int key, int thread_id, void** data);
|
|
||||||
bool SetKey(int key, int thread_id, void* data);
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Map {
|
|
||||||
int thread_id = -1;
|
|
||||||
void* data = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Key {
|
|
||||||
bool used = false;
|
|
||||||
PthreadKeyDestructor destructor = nullptr;
|
|
||||||
std::vector<Map> specific_values;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::mutex m_mutex;
|
|
||||||
Key m_keys[256];
|
|
||||||
};
|
|
||||||
class PThreadCxt {
|
class PThreadCxt {
|
||||||
public:
|
public:
|
||||||
ScePthreadMutexattr* getDefaultMutexattr() {
|
ScePthreadMutexattr* getDefaultMutexattr() {
|
||||||
@ -167,12 +143,6 @@ public:
|
|||||||
void setDefaultRwattr(OrbisPthreadRwlockattr attr) {
|
void setDefaultRwattr(OrbisPthreadRwlockattr attr) {
|
||||||
m_default_Rwattr = attr;
|
m_default_Rwattr = attr;
|
||||||
}
|
}
|
||||||
PthreadKeys* getPthreadKeys() {
|
|
||||||
return m_pthread_keys;
|
|
||||||
}
|
|
||||||
void setPthreadKeys(PthreadKeys* keys) {
|
|
||||||
m_pthread_keys = keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ScePthreadMutexattr m_default_mutexattr = nullptr;
|
ScePthreadMutexattr m_default_mutexattr = nullptr;
|
||||||
@ -180,7 +150,6 @@ private:
|
|||||||
ScePthreadAttr m_default_attr = nullptr;
|
ScePthreadAttr m_default_attr = nullptr;
|
||||||
PThreadPool* m_pthread_pool = nullptr;
|
PThreadPool* m_pthread_pool = nullptr;
|
||||||
OrbisPthreadRwlockattr m_default_Rwattr = nullptr;
|
OrbisPthreadRwlockattr m_default_Rwattr = nullptr;
|
||||||
PthreadKeys* m_pthread_keys = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_pthreads();
|
void init_pthreads();
|
||||||
|
@ -25,7 +25,7 @@ struct wrapper_impl<name, PS4_SYSV_ABI R (*)(Args...), f> {
|
|||||||
static R PS4_SYSV_ABI wrap(Args... args) {
|
static R PS4_SYSV_ABI wrap(Args... args) {
|
||||||
if (std::string_view(name.value) != "scePthreadEqual" &&
|
if (std::string_view(name.value) != "scePthreadEqual" &&
|
||||||
std::string_view(name.value) != "sceUserServiceGetEvent") {
|
std::string_view(name.value) != "sceUserServiceGetEvent") {
|
||||||
LOG_WARNING(Core_Linker, "Function {} called", name.value);
|
//LOG_WARNING(Core_Linker, "Function {} called", name.value);
|
||||||
}
|
}
|
||||||
if constexpr (std::is_same_v<R, s32> || std::is_same_v<R, u32>) {
|
if constexpr (std::is_same_v<R, s32> || std::is_same_v<R, u32>) {
|
||||||
const u32 ret = f(args...);
|
const u32 ret = f(args...);
|
||||||
@ -42,8 +42,8 @@ struct wrapper_impl<name, PS4_SYSV_ABI R (*)(Args...), f> {
|
|||||||
template <StringLiteral name, class F, F f>
|
template <StringLiteral name, class F, F f>
|
||||||
constexpr auto wrapper = wrapper_impl<name, F, f>::wrap;
|
constexpr auto wrapper = wrapper_impl<name, F, f>::wrap;
|
||||||
|
|
||||||
// #define W(foo) wrapper<#foo, decltype(&foo), foo>
|
#define W(foo) wrapper<#foo, decltype(&foo), foo>
|
||||||
#define W(foo) foo
|
//#define W(foo) foo
|
||||||
|
|
||||||
#define LIB_FUNCTION(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, function) \
|
#define LIB_FUNCTION(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, function) \
|
||||||
{ \
|
{ \
|
||||||
|
Loading…
Reference in New Issue
Block a user