Commit Graph

58 Commits

Author SHA1 Message Date
6917eaf53b Use load_construct_data for kernel objects 2020-02-13 17:38:25 +08:00
3e752002c4 Replace g_kernel with Core::Global etc. 2020-02-13 17:38:21 +08:00
f557d26b40 Added CPU, mutex, process, thread, timer 2020-02-13 17:38:16 +08:00
623b0621ab Port various minor changes from yuzu PRs (#4725)
* common/thread: Remove unused functions

Many of these functions are carried over from Dolphin (where they aren't
used anymore). Given these have no use (and we really shouldn't be
screwing around with OS-specific thread scheduler handling from the
emulator, these can be removed.

The function for setting the thread name is left, however, since it can
have debugging utility usages.

* input_common/sdl: Use a type alias to shorten declaration of GetPollers

Just makes the definitions a little bit more tidy.

* input_common/sdl: Correct return values within implementations of GetPollers()

In both cases, we weren't actually returning anything, which is
undefined behavior.

* yuzu/debugger/graphics_surface: Fill in missing surface format listings

Fills in the missing surface types that were marked as unknown. The
order corresponds with the TextureFormat enum within
video_core/texture.h.

We also don't need to all of these strings as translatable (only the
first string, as it's an English word).

* yuzu/debugger/graphics_surface: Clean up connection overload deduction

We can utilize qOverload with the signal connections to make the
function deducing a little less ugly.

* yuzu/debugger/graphics_surface: Tidy up SaveSurface

- Use QStringLiteral where applicable.

- Use const where applicable

- Remove unnecessary precondition check (we already assert the pixbuf
  being non null)

* yuzu/debugger/graphics_surface: Display error messages for file I/O errors

* core: Add missing override specifiers where applicable

Applies the override specifier where applicable. In the case of
destructors that are  defaulted in their definition, they can
simply be removed.

This also removes the unnecessary inclusions being done in audin_u and
audrec_u, given their close proximity.

* kernel/thread: Make parameter of GetWaitObjectIndex() const qualified

The pointed to member is never actually modified, so it can be made
const.

* kernel/thread: Avoid sign conversion within GetCommandBufferAddress()

Previously this was performing a u64 + int sign conversion. When dealing
with addresses, we should generally be keeping the arithmetic in the
same signedness type.

This also gets rid of the static lifetime of the constant, as there's no
need to make a trivial type like this potentially live for the entire
duration of the program.

* kernel/codeset: Make CodeSet's memory data member a regular std::vector

The use of a shared_ptr is an implementation detail of the VMManager
itself when mapping memory. Because of that, we shouldn't require all
users of the CodeSet to have to allocate the shared_ptr ahead of time.
It's intended that CodeSet simply pass in the required direct data, and
that the memory manager takes care of it from that point on.

This means we just do the shared pointer allocation in a single place,
when loading modules, as opposed to in each loader.

* kernel/wait_object: Make ShouldWait() take thread members by pointer-to-const

Given this is intended as a querying function, it doesn't make sense to
allow the implementer to modify the state of the given thread.
2019-05-01 14:28:49 +02:00
5f11c5f733 Kernel: replace boost::intrusive_ptr with std::shared_ptr 2019-03-24 14:32:11 -04:00
eb050b8403 Kernel: replace usage of Core::System::GetInstance()::Timing() 2019-02-14 14:04:46 -05:00
9458e4d8ec CoreTiming: wrap into class 2018-11-04 10:26:38 -05:00
e5b93741d3 kernel/timer: add TimerManager for timer system states 2018-10-26 16:07:45 -04:00
5b45a3e1b5 Kernel/Timer: use unordered_map for callback recording 2018-10-22 21:32:34 -04:00
751ebe55e9 Kernel: pass ref down to Object and wrap ID counter into kernel state 2018-10-18 21:41:36 -04:00
c141657d83 Kernel: pass ref to timer 2018-10-18 21:41:36 -04:00
63c7b44ba8 kernel: Move object class to its own source files
General moving to keep kernel object types separate from the direct
kernel code. Also essentially a preliminary cleanup before eliminating
global kernel state in the kernel code.
2018-08-23 17:31:59 +02:00
74cd98ecad core: clean up warnings 2018-08-01 14:10:23 -05:00
7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
a8110cfd3f hle/kernel: Migrate logging macros 2018-06-22 18:54:50 -04:00
f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
e9a95b2e7d CoreTiming: Reworked CoreTiming (#3119)
* CoreTiming: New CoreTiming; Add Test for CoreTiming
2017-11-25 14:56:57 +01:00
723dc644fa ResultVal: Remove MoveFrom()
Replace it with std::move(result_val).Unwrap(), or Foo().Unwrap() in
case you already have an rvalue.
2017-06-18 19:03:15 -07:00
be031989ee Kernel: Move HandleTable to a separate file 2017-05-29 17:34:39 -07:00
85ba60d5ec Timer: restore missing signaled=true from #2421 2017-02-27 22:49:46 +02:00
dcf115778a Fix log entry in timer::signal (#2600) 2017-02-27 11:04:03 -05:00
029a11030e Timers: Immediately signal the timer if it was started with an initial value of 0. 2017-02-21 20:51:54 -05:00
84d72fd92f Merge pull request #2397 from Subv/pulse
Kernel: Implemented Pulse event and timers.
2017-01-10 10:45:00 -05:00
e52ca85711 Kernel: Implemented Pulse event and timers.
Closes #1904
2017-01-05 13:06:17 -05:00
e6a7723f2f Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.
This will be useful when implementing mutex priority inheritance.
2017-01-04 15:58:45 -05:00
8634b8cb83 Threading: Reworked the way our scheduler works.
Threads will now be awakened when the objects they're waiting on are signaled, instead of repeating the WaitSynchronization call every now and then.

The scheduler is now called once after every SVC call, and once after a thread is awakened from sleep by its timeout callback.

This new implementation is based off reverse-engineering of the real kernel.

See https://gist.github.com/Subv/02f29bd9f1e5deb7aceea1e8f019c8f4 for a more detailed description of how the real kernel handles rescheduling.
2016-12-03 22:38:14 -05:00
4ab8692475 Kernel/Events: Log an error when trying to create Pulse events and timers.
Related to #1904
2016-11-19 14:00:08 -05:00
84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
ebdae19fd2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
396a8d91a4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
12e92f17de svc: Make ResetType an enum class 2016-03-12 15:06:31 -05:00
6cccc36505 HLE/Timers: Reset OneShot timers when they are acquired instead of when they're triggered.
Closes #1139
2015-12-29 20:35:25 -05:00
751fbfdcc3 general: Silence some warnings when using clang 2015-09-16 08:51:53 -04:00
b1503b2020 Remove every trailing whitespace from the project (but externals). 2015-05-29 21:59:29 +01:00
0b7d2941cf Kernel: Move reschedules from SVCs to actual mechanisms that reschedule. 2015-05-20 18:05:47 -04:00
e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
c7dc799e19 Kernel: Properly initialize and shutdown all modules. 2015-05-01 18:27:03 -04:00
0d69b2f7bd Kernel: Use the correct format string for u64 hex. 2015-04-14 21:18:31 +02:00
8e2b248e05 Build: Fixed some warnings 2015-02-12 09:25:35 -05:00
ef24e72b26 Asserts: break/crash program, fit to style guide; log.h->assert.h
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time)
As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing)

Also removed some GEKKO cruft.
2015-02-10 18:30:31 -08:00
88a4a808c6 Kernel: Stop creating useless Handles during object creation
They're finally unnecessary, and will stop cluttering the application's
handle table.
2015-02-02 15:37:09 -02:00
7725256f64 Explicitly instantiate constructors/destructors for Kernel objects
This should speed up compile times a bit, as well as enable more liberal
use of forward declarations. (Due to SharedPtr not trying to emit the
destructor anymore.)
2015-02-02 15:37:07 -02:00
a9b86db3cf Kernel: Use separate Handle tables for CoreTiming userdata
This is to support the removal of GetHandle soon
2015-02-02 15:37:03 -02:00
ec9c773251 Kernel: Remove previous scheduled event when a Timer is re-Set 2015-02-02 15:37:02 -02:00
ad80ff1e32 Kernel: Convert Timer to (mostly) not use Handles 2015-01-30 11:47:07 -02:00
9a345de2bd Kernel: Remove useless/duplicated comments; mark functions static 2015-01-30 11:47:01 -02:00
f09806aed2 Kernel: Renamed some functions for clarity.
- ReleaseNextThread->WakeupNextThread
- ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
2015-01-21 20:48:30 -05:00
15b6a4d9ad Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void. 2015-01-21 20:47:49 -05:00
c68eb15695 WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual. 2015-01-21 20:47:49 -05:00