mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-29 14:53:18 +00:00
* libkernel: Cleanup some function places * kernel: Refactor thread functions * kernel: It builds * kernel: Fix a bunch of bugs, kernel thread heap * kernel: File cleanup pt1 * File cleanup pt2 * File cleanup pt3 * File cleanup pt4 * kernel: Add missing funcs * kernel: Add basic exceptions for linux * gnmdriver: Add workload functions * kernel: Fix new pthreads code on macOS. (#1441) * kernel: Downgrade edeadlk to log * gnmdriver: Add sceGnmSubmitCommandBuffersForWorkload * exception: Add context register population for macOS. (#1444) * kernel: Pthread rewrite touchups for Windows * kernel: Multiplatform thread implementation * mutex: Remove spamming log * pthread_spec: Make assert into a log * pthread_spec: Zero initialize array * Attempt to fix non-Windows builds * hotfix: change incorrect NID for scePthreadAttrSetaffinity * scePthreadAttrSetaffinity implementation * Attempt to fix Linux * windows: Address a bunch of address space problems * address_space: Fix unmap of region surrounded by placeholders * libs: Reduce logging * pthread: Implement condvar with waitable atomics and sleepqueue * sleepq: Separate and make faster * time: Remove delay execution * Causes high cpu usage in Tohou Luna Nights * kernel: Cleanup files again * pthread: Add missing include * semaphore: Use binary_semaphore instead of condvar * Seems more reliable * libraries/sysmodule: log module on `sceSysmoduleIsLoaded` * libraries/kernel: implement `scePthreadSetPrio` --------- Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com> Co-authored-by: Daniel R. <47796739+polybiusproxy@users.noreply.github.com>
88 lines
2.6 KiB
C++
88 lines
2.6 KiB
C++
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <sys/types.h>
|
|
#include "common/types.h"
|
|
|
|
namespace Common {
|
|
class NativeClock;
|
|
}
|
|
|
|
namespace Core::Loader {
|
|
class SymbolsResolver;
|
|
}
|
|
|
|
namespace Libraries::Kernel {
|
|
|
|
struct OrbisKernelTimeval {
|
|
s64 tv_sec;
|
|
s64 tv_usec;
|
|
};
|
|
|
|
struct OrbisKernelTimezone {
|
|
s32 tz_minuteswest;
|
|
s32 tz_dsttime;
|
|
};
|
|
|
|
struct OrbisKernelTimespec {
|
|
s64 tv_sec;
|
|
s64 tv_nsec;
|
|
|
|
std::chrono::system_clock::time_point TimePoint() const noexcept {
|
|
using namespace std::chrono;
|
|
const auto duration =
|
|
duration_cast<system_clock::duration>(seconds{tv_sec} + nanoseconds{tv_nsec});
|
|
return system_clock::time_point{duration};
|
|
}
|
|
};
|
|
|
|
struct OrbisTimesec {
|
|
time_t t;
|
|
u32 west_sec;
|
|
u32 dst_sec;
|
|
};
|
|
|
|
constexpr int ORBIS_CLOCK_REALTIME = 0;
|
|
constexpr int ORBIS_CLOCK_VIRTUAL = 1;
|
|
constexpr int ORBIS_CLOCK_PROF = 2;
|
|
constexpr int ORBIS_CLOCK_MONOTONIC = 4;
|
|
constexpr int ORBIS_CLOCK_UPTIME = 5;
|
|
constexpr int ORBIS_CLOCK_UPTIME_PRECISE = 7;
|
|
constexpr int ORBIS_CLOCK_UPTIME_FAST = 8;
|
|
constexpr int ORBIS_CLOCK_REALTIME_PRECISE = 9;
|
|
constexpr int ORBIS_CLOCK_REALTIME_FAST = 10;
|
|
constexpr int ORBIS_CLOCK_MONOTONIC_PRECISE = 11;
|
|
constexpr int ORBIS_CLOCK_MONOTONIC_FAST = 12;
|
|
constexpr int ORBIS_CLOCK_SECOND = 13;
|
|
constexpr int ORBIS_CLOCK_THREAD_CPUTIME_ID = 14;
|
|
constexpr int ORBIS_CLOCK_PROCTIME = 15;
|
|
constexpr int ORBIS_CLOCK_EXT_NETWORK = 16;
|
|
constexpr int ORBIS_CLOCK_EXT_DEBUG_NETWORK = 17;
|
|
constexpr int ORBIS_CLOCK_EXT_AD_NETWORK = 18;
|
|
constexpr int ORBIS_CLOCK_EXT_RAW_NETWORK = 19;
|
|
|
|
namespace Dev {
|
|
u64& GetInitialPtc();
|
|
|
|
Common::NativeClock* GetClock();
|
|
} // namespace Dev
|
|
|
|
u64 PS4_SYSV_ABI sceKernelGetTscFrequency();
|
|
u64 PS4_SYSV_ABI sceKernelGetProcessTime();
|
|
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter();
|
|
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounterFrequency();
|
|
u64 PS4_SYSV_ABI sceKernelReadTsc();
|
|
int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp);
|
|
s32 PS4_SYSV_ABI sceKernelGettimezone(OrbisKernelTimezone* tz);
|
|
int PS4_SYSV_ABI sceKernelConvertLocaltimeToUtc(time_t param_1, int64_t param_2, time_t* seconds,
|
|
OrbisKernelTimezone* timezone, int* dst_seconds);
|
|
|
|
int PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time, OrbisTimesec* st,
|
|
unsigned long* dst_sec);
|
|
|
|
void RegisterTime(Core::Loader::SymbolsResolver* sym);
|
|
|
|
} // namespace Libraries::Kernel
|