Kernel: Remove useless/duplicated comments; mark functions static
This commit is contained in:
parent
206cabc0e4
commit
9a345de2bd
6 changed files with 8 additions and 32 deletions
|
@ -28,7 +28,6 @@ public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// Arbitrate an address
|
|
||||||
ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value, u64 nanoseconds) {
|
ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value, u64 nanoseconds) {
|
||||||
AddressArbiter* object = Kernel::g_handle_table.Get<AddressArbiter>(handle).get();
|
AddressArbiter* object = Kernel::g_handle_table.Get<AddressArbiter>(handle).get();
|
||||||
|
|
||||||
|
@ -92,8 +91,7 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an address arbiter
|
static AddressArbiter* CreateAddressArbiter(Handle& handle, const std::string& name) {
|
||||||
AddressArbiter* CreateAddressArbiter(Handle& handle, const std::string& name) {
|
|
||||||
AddressArbiter* address_arbiter = new AddressArbiter;
|
AddressArbiter* address_arbiter = new AddressArbiter;
|
||||||
// TOOD(yuriks): Fix error reporting
|
// TOOD(yuriks): Fix error reporting
|
||||||
handle = Kernel::g_handle_table.Create(address_arbiter).ValueOr(INVALID_HANDLE);
|
handle = Kernel::g_handle_table.Create(address_arbiter).ValueOr(INVALID_HANDLE);
|
||||||
|
@ -101,7 +99,6 @@ AddressArbiter* CreateAddressArbiter(Handle& handle, const std::string& name) {
|
||||||
return address_arbiter;
|
return address_arbiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an address arbiter
|
|
||||||
Handle CreateAddressArbiter(const std::string& name) {
|
Handle CreateAddressArbiter(const std::string& name) {
|
||||||
Handle handle;
|
Handle handle;
|
||||||
CreateAddressArbiter(handle, name);
|
CreateAddressArbiter(handle, name);
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
/// Address arbitration types
|
|
||||||
enum class ArbitrationType : u32 {
|
enum class ArbitrationType : u32 {
|
||||||
Signal,
|
Signal,
|
||||||
WaitIfLessThan,
|
WaitIfLessThan,
|
||||||
|
@ -27,10 +26,8 @@ enum class ArbitrationType : u32 {
|
||||||
DecrementAndWaitIfLessThanWithTimeout,
|
DecrementAndWaitIfLessThanWithTimeout,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Arbitrate an address
|
|
||||||
ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value, u64 nanoseconds);
|
ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value, u64 nanoseconds);
|
||||||
|
|
||||||
/// Create an address arbiter
|
|
||||||
Handle CreateAddressArbiter(const std::string& name = "Unknown");
|
Handle CreateAddressArbiter(const std::string& name = "Unknown");
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
|
@ -69,7 +69,7 @@ ResultCode ClearEvent(Handle handle) {
|
||||||
* @param name Optional name of event
|
* @param name Optional name of event
|
||||||
* @return Newly created Event object
|
* @return Newly created Event object
|
||||||
*/
|
*/
|
||||||
Event* CreateEvent(Handle& handle, const ResetType reset_type, const std::string& name) {
|
static Event* CreateEvent(Handle& handle, const ResetType reset_type, const std::string& name) {
|
||||||
Event* evt = new Event;
|
Event* evt = new Event;
|
||||||
|
|
||||||
// TOOD(yuriks): Fix error reporting
|
// TOOD(yuriks): Fix error reporting
|
||||||
|
|
|
@ -40,7 +40,7 @@ static MutexMap g_mutex_held_locks;
|
||||||
* @param mutex Mutex that is to be acquired
|
* @param mutex Mutex that is to be acquired
|
||||||
* @param thread Thread that will acquire the mutex
|
* @param thread Thread that will acquire the mutex
|
||||||
*/
|
*/
|
||||||
void MutexAcquireLock(Mutex* mutex, Thread* thread) {
|
static void MutexAcquireLock(Mutex* mutex, Thread* thread) {
|
||||||
g_mutex_held_locks.insert(std::make_pair(thread, mutex));
|
g_mutex_held_locks.insert(std::make_pair(thread, mutex));
|
||||||
mutex->holding_thread = thread;
|
mutex->holding_thread = thread;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ void MutexAcquireLock(Mutex* mutex, Thread* thread) {
|
||||||
* Resumes a thread waiting for the specified mutex
|
* Resumes a thread waiting for the specified mutex
|
||||||
* @param mutex The mutex that some thread is waiting on
|
* @param mutex The mutex that some thread is waiting on
|
||||||
*/
|
*/
|
||||||
void ResumeWaitingThread(Mutex* mutex) {
|
static void ResumeWaitingThread(Mutex* mutex) {
|
||||||
// Find the next waiting thread for the mutex...
|
// Find the next waiting thread for the mutex...
|
||||||
auto next_thread = mutex->WakeupNextThread();
|
auto next_thread = mutex->WakeupNextThread();
|
||||||
if (next_thread != nullptr) {
|
if (next_thread != nullptr) {
|
||||||
|
@ -73,7 +73,7 @@ void ReleaseThreadMutexes(Thread* thread) {
|
||||||
g_mutex_held_locks.erase(thread);
|
g_mutex_held_locks.erase(thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReleaseMutex(Mutex* mutex) {
|
static bool ReleaseMutex(Mutex* mutex) {
|
||||||
if (mutex->locked) {
|
if (mutex->locked) {
|
||||||
auto locked = g_mutex_held_locks.equal_range(mutex->holding_thread);
|
auto locked = g_mutex_held_locks.equal_range(mutex->holding_thread);
|
||||||
|
|
||||||
|
@ -89,10 +89,6 @@ bool ReleaseMutex(Mutex* mutex) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Releases a mutex
|
|
||||||
* @param handle Handle to mutex to release
|
|
||||||
*/
|
|
||||||
ResultCode ReleaseMutex(Handle handle) {
|
ResultCode ReleaseMutex(Handle handle) {
|
||||||
Mutex* mutex = Kernel::g_handle_table.Get<Mutex>(handle).get();
|
Mutex* mutex = Kernel::g_handle_table.Get<Mutex>(handle).get();
|
||||||
if (mutex == nullptr) return InvalidHandle(ErrorModule::Kernel);
|
if (mutex == nullptr) return InvalidHandle(ErrorModule::Kernel);
|
||||||
|
@ -113,7 +109,7 @@ ResultCode ReleaseMutex(Handle handle) {
|
||||||
* @param name Optional name of mutex
|
* @param name Optional name of mutex
|
||||||
* @return Pointer to new Mutex object
|
* @return Pointer to new Mutex object
|
||||||
*/
|
*/
|
||||||
Mutex* CreateMutex(Handle& handle, bool initial_locked, const std::string& name) {
|
static Mutex* CreateMutex(Handle& handle, bool initial_locked, const std::string& name) {
|
||||||
Mutex* mutex = new Mutex;
|
Mutex* mutex = new Mutex;
|
||||||
// TODO(yuriks): Fix error reporting
|
// TODO(yuriks): Fix error reporting
|
||||||
handle = Kernel::g_handle_table.Create(mutex).ValueOr(INVALID_HANDLE);
|
handle = Kernel::g_handle_table.Create(mutex).ValueOr(INVALID_HANDLE);
|
||||||
|
@ -129,12 +125,6 @@ Mutex* CreateMutex(Handle& handle, bool initial_locked, const std::string& name)
|
||||||
return mutex;
|
return mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a mutex
|
|
||||||
* @param initial_locked Specifies if the mutex should be locked initially
|
|
||||||
* @param name Optional name of mutex
|
|
||||||
* @return Handle to newly created object
|
|
||||||
*/
|
|
||||||
Handle CreateMutex(bool initial_locked, const std::string& name) {
|
Handle CreateMutex(bool initial_locked, const std::string& name) {
|
||||||
Handle handle;
|
Handle handle;
|
||||||
Mutex* mutex = CreateMutex(handle, initial_locked, name);
|
Mutex* mutex = CreateMutex(handle, initial_locked, name);
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
* @param name Name of shared memory object
|
* @param name Name of shared memory object
|
||||||
* @return Pointer to newly created shared memory object
|
* @return Pointer to newly created shared memory object
|
||||||
*/
|
*/
|
||||||
SharedMemory* CreateSharedMemory(Handle& handle, const std::string& name) {
|
static SharedMemory* CreateSharedMemory(Handle& handle, const std::string& name) {
|
||||||
SharedMemory* shared_memory = new SharedMemory;
|
SharedMemory* shared_memory = new SharedMemory;
|
||||||
// TOOD(yuriks): Fix error reporting
|
// TOOD(yuriks): Fix error reporting
|
||||||
handle = Kernel::g_handle_table.Create(shared_memory).ValueOr(INVALID_HANDLE);
|
handle = Kernel::g_handle_table.Create(shared_memory).ValueOr(INVALID_HANDLE);
|
||||||
|
@ -44,14 +44,6 @@ Handle CreateSharedMemory(const std::string& name) {
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Maps a shared memory block to an address in system memory
|
|
||||||
* @param handle Shared memory block handle
|
|
||||||
* @param address Address in system memory to map shared memory block to
|
|
||||||
* @param permissions Memory block map permissions (specified by SVC field)
|
|
||||||
* @param other_permissions Memory block map other permissions (specified by SVC field)
|
|
||||||
* @return Result of operation, 0 on success, otherwise error code
|
|
||||||
*/
|
|
||||||
ResultCode MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions,
|
ResultCode MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions,
|
||||||
MemoryPermission other_permissions) {
|
MemoryPermission other_permissions) {
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
* @param name Optional name of timer
|
* @param name Optional name of timer
|
||||||
* @return Newly created Timer object
|
* @return Newly created Timer object
|
||||||
*/
|
*/
|
||||||
Timer* CreateTimer(Handle& handle, const ResetType reset_type, const std::string& name) {
|
static Timer* CreateTimer(Handle& handle, const ResetType reset_type, const std::string& name) {
|
||||||
Timer* timer = new Timer;
|
Timer* timer = new Timer;
|
||||||
|
|
||||||
handle = Kernel::g_handle_table.Create(timer).ValueOr(INVALID_HANDLE);
|
handle = Kernel::g_handle_table.Create(timer).ValueOr(INVALID_HANDLE);
|
||||||
|
|
Loading…
Reference in a new issue