summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-02-01 03:14:40 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-02-02 18:37:09 +0100
commit88a4a808c688eeabb136e9b45223a0e9c95896bc (patch)
treec4181a69ff882e1af1b7d65bf3596a6cb3dd88b9 /src/core/hle/kernel
parentKernel: Make WaitObjects share ownership of Threads waiting on them (diff)
downloadyuzu-88a4a808c688eeabb136e9b45223a0e9c95896bc.tar
yuzu-88a4a808c688eeabb136e9b45223a0e9c95896bc.tar.gz
yuzu-88a4a808c688eeabb136e9b45223a0e9c95896bc.tar.bz2
yuzu-88a4a808c688eeabb136e9b45223a0e9c95896bc.tar.lz
yuzu-88a4a808c688eeabb136e9b45223a0e9c95896bc.tar.xz
yuzu-88a4a808c688eeabb136e9b45223a0e9c95896bc.tar.zst
yuzu-88a4a808c688eeabb136e9b45223a0e9c95896bc.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/address_arbiter.cpp6
-rw-r--r--src/core/hle/kernel/address_arbiter.h2
-rw-r--r--src/core/hle/kernel/event.cpp6
-rw-r--r--src/core/hle/kernel/event.h2
-rw-r--r--src/core/hle/kernel/mutex.cpp6
-rw-r--r--src/core/hle/kernel/mutex.h2
-rw-r--r--src/core/hle/kernel/semaphore.cpp2
-rw-r--r--src/core/hle/kernel/shared_memory.cpp8
-rw-r--r--src/core/hle/kernel/shared_memory.h2
-rw-r--r--src/core/hle/kernel/thread.cpp8
-rw-r--r--src/core/hle/kernel/timer.cpp7
-rw-r--r--src/core/hle/kernel/timer.h2
12 files changed, 17 insertions, 36 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp
index 2084f24cc..42f8ce2d9 100644
--- a/src/core/hle/kernel/address_arbiter.cpp
+++ b/src/core/hle/kernel/address_arbiter.cpp
@@ -18,14 +18,12 @@ namespace Kernel {
AddressArbiter::AddressArbiter() {}
AddressArbiter::~AddressArbiter() {}
-ResultVal<SharedPtr<AddressArbiter>> AddressArbiter::Create(std::string name) {
+SharedPtr<AddressArbiter> AddressArbiter::Create(std::string name) {
SharedPtr<AddressArbiter> address_arbiter(new AddressArbiter);
- // TOOD(yuriks): Don't create Handle (see Thread::Create())
- CASCADE_RESULT(auto unused, Kernel::g_handle_table.Create(address_arbiter));
address_arbiter->name = std::move(name);
- return MakeResult<SharedPtr<AddressArbiter>>(std::move(address_arbiter));
+ return address_arbiter;
}
ResultCode AddressArbiter::ArbitrateAddress(ArbitrationType type, VAddr address, s32 value,
diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h
index a616d840f..8f6a1a8df 100644
--- a/src/core/hle/kernel/address_arbiter.h
+++ b/src/core/hle/kernel/address_arbiter.h
@@ -34,7 +34,7 @@ public:
* @param name Optional name used for debugging.
* @returns The created AddressArbiter.
*/
- static ResultVal<SharedPtr<AddressArbiter>> Create(std::string name = "Unknown");
+ static SharedPtr<AddressArbiter> Create(std::string name = "Unknown");
std::string GetTypeName() const override { return "Arbiter"; }
std::string GetName() const override { return name; }
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index 3796fbb74..898e1c98f 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -17,16 +17,14 @@ namespace Kernel {
Event::Event() {}
Event::~Event() {}
-ResultVal<SharedPtr<Event>> Event::Create(ResetType reset_type, std::string name) {
+SharedPtr<Event> Event::Create(ResetType reset_type, std::string name) {
SharedPtr<Event> evt(new Event);
- // TOOD(yuriks): Don't create Handle (see Thread::Create())
- CASCADE_RESULT(auto unused, Kernel::g_handle_table.Create(evt));
evt->signaled = false;
evt->reset_type = evt->intitial_reset_type = reset_type;
evt->name = std::move(name);
- return MakeResult<SharedPtr<Event>>(evt);
+ return evt;
}
bool Event::ShouldWait() {
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h
index 6f88afb3e..fba960d2a 100644
--- a/src/core/hle/kernel/event.h
+++ b/src/core/hle/kernel/event.h
@@ -18,7 +18,7 @@ public:
* @param reset_type ResetType describing how to create event
* @param name Optional name of event
*/
- static ResultVal<SharedPtr<Event>> Create(ResetType reset_type, std::string name = "Unknown");
+ static SharedPtr<Event> Create(ResetType reset_type, std::string name = "Unknown");
std::string GetTypeName() const override { return "Event"; }
std::string GetName() const override { return name; }
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 7c634f9bd..9f7166ca4 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -41,10 +41,8 @@ void ReleaseThreadMutexes(Thread* thread) {
Mutex::Mutex() {}
Mutex::~Mutex() {}
-ResultVal<SharedPtr<Mutex>> Mutex::Create(bool initial_locked, std::string name) {
+SharedPtr<Mutex> Mutex::Create(bool initial_locked, std::string name) {
SharedPtr<Mutex> mutex(new Mutex);
- // TOOD(yuriks): Don't create Handle (see Thread::Create())
- CASCADE_RESULT(auto unused, Kernel::g_handle_table.Create(mutex));
mutex->initial_locked = initial_locked;
mutex->locked = false;
@@ -55,7 +53,7 @@ ResultVal<SharedPtr<Mutex>> Mutex::Create(bool initial_locked, std::string name)
if (initial_locked)
mutex->Acquire();
- return MakeResult<SharedPtr<Mutex>>(mutex);
+ return mutex;
}
bool Mutex::ShouldWait() {
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h
index cdd79e265..548403614 100644
--- a/src/core/hle/kernel/mutex.h
+++ b/src/core/hle/kernel/mutex.h
@@ -22,7 +22,7 @@ public:
* @param name Optional name of mutex
* @return Pointer to new Mutex object
*/
- static ResultVal<SharedPtr<Mutex>> Create(bool initial_locked, std::string name = "Unknown");
+ static SharedPtr<Mutex> Create(bool initial_locked, std::string name = "Unknown");
std::string GetTypeName() const override { return "Mutex"; }
std::string GetName() const override { return name; }
diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp
index 234d60d85..c8cf8b9a2 100644
--- a/src/core/hle/kernel/semaphore.cpp
+++ b/src/core/hle/kernel/semaphore.cpp
@@ -21,8 +21,6 @@ ResultVal<SharedPtr<Semaphore>> Semaphore::Create(s32 initial_count, s32 max_cou
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
SharedPtr<Semaphore> semaphore(new Semaphore);
- // TOOD(yuriks): Don't create Handle (see Thread::Create())
- CASCADE_RESULT(auto unused, Kernel::g_handle_table.Create(semaphore));
// When the semaphore is created, some slots are reserved for other threads,
// and the rest is reserved for the caller thread
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index c429bb9b4..4211fcf04 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -12,14 +12,12 @@ namespace Kernel {
SharedMemory::SharedMemory() {}
SharedMemory::~SharedMemory() {}
-ResultVal<SharedPtr<SharedMemory>> SharedMemory::Create(std::string name) {
+SharedPtr<SharedMemory> SharedMemory::Create(std::string name) {
SharedPtr<SharedMemory> shared_memory(new SharedMemory);
- // TOOD(yuriks): Don't create Handle (see Thread::Create())
- CASCADE_RESULT(auto unused, Kernel::g_handle_table.Create(shared_memory));
-
shared_memory->name = std::move(name);
- return MakeResult<SharedPtr<SharedMemory>>(std::move(shared_memory));
+
+ return shared_memory;
}
ResultCode SharedMemory::Map(VAddr address, MemoryPermission permissions,
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h
index d9e741d20..5833b411c 100644
--- a/src/core/hle/kernel/shared_memory.h
+++ b/src/core/hle/kernel/shared_memory.h
@@ -29,7 +29,7 @@ public:
* Creates a shared memory object
* @param name Optional object name, used only for debugging purposes.
*/
- static ResultVal<SharedPtr<SharedMemory>> Create(std::string name = "Unknown");
+ static SharedPtr<SharedMemory> Create(std::string name = "Unknown");
std::string GetTypeName() const override { return "SharedMemory"; }
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index f092916dd..3987f9608 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -368,14 +368,6 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
SharedPtr<Thread> thread(new Thread);
- // TODO(yuriks): Thread requires a handle to be inserted into the various scheduling queues for
- // the time being. Create a handle here, it will be copied to the handle field in
- // the object and use by the rest of the code. This should be removed when other
- // code doesn't rely on the handle anymore.
- ResultVal<Handle> handle = Kernel::g_handle_table.Create(thread);
- if (handle.Failed())
- return handle.Code();
-
thread_list.push_back(thread);
thread_ready_queue.prepare(priority);
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index 7c3cdc0d0..4352fc99c 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -20,10 +20,8 @@ static Kernel::HandleTable timer_callback_handle_table;
Timer::Timer() {}
Timer::~Timer() {}
-ResultVal<SharedPtr<Timer>> Timer::Create(ResetType reset_type, std::string name) {
+SharedPtr<Timer> Timer::Create(ResetType reset_type, std::string name) {
SharedPtr<Timer> timer(new Timer);
- // TOOD(yuriks): Don't create Handle (see Thread::Create())
- CASCADE_RESULT(auto unused, Kernel::g_handle_table.Create(timer));
timer->reset_type = reset_type;
timer->signaled = false;
@@ -31,7 +29,8 @@ ResultVal<SharedPtr<Timer>> Timer::Create(ResetType reset_type, std::string name
timer->initial_delay = 0;
timer->interval_delay = 0;
timer->callback_handle = timer_callback_handle_table.Create(timer).MoveFrom();
- return MakeResult<SharedPtr<Timer>>(timer);
+
+ return timer;
}
bool Timer::ShouldWait() {
diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h
index e217d6dae..540e4e187 100644
--- a/src/core/hle/kernel/timer.h
+++ b/src/core/hle/kernel/timer.h
@@ -19,7 +19,7 @@ public:
* @param name Optional name of timer
* @return The created Timer
*/
- static ResultVal<SharedPtr<Timer>> Create(ResetType reset_type, std::string name = "Unknown");
+ static SharedPtr<Timer> Create(ResetType reset_type, std::string name = "Unknown");
std::string GetTypeName() const override { return "Timer"; }
std::string GetName() const override { return name; }