Commit graph

48 commits

Author SHA1 Message Date
Lioncash fbb82e61e3 kernel/hle_ipc: Convert std::shared_ptr IPC header instances to std::optional
There's no real need to use a shared lifetime here, since we don't
actually expose them to anything else. This is also kind of an
unnecessary use of the heap given the objects themselves are so small;
small enough, in fact that changing over to optionals actually reduces
the overall size of the HLERequestContext struct (818 bytes to 808
bytes).
2019-03-07 23:34:37 -05:00
Lioncash 2561a79c39 hle/ipc_helpers: Fix clang-format warnings 2019-01-29 21:11:04 -05:00
Lioncash ac603cf130 hle/ipc_helpers: Allow pushing signed values
This is kind of a large hole in the API, given we allow popping signed
values. This fixes that.
2019-01-29 13:09:32 -05:00
Lioncash 1f0c8bfeda core/kernel: Remove unnecessary inclusions
Gets rid of a few unnecessary header dependencies in some source files.
2018-12-31 19:04:16 -05:00
Lioncash 6383653a8d hle_ipc: Add member function for querying the existence of a domain header
Gets rid of the need to call the getter and then check for null.
2018-10-29 23:28:04 -04:00
David Marcec 08819ec70a Removed MakeBuilder as it's not needed anymore 2018-09-19 15:13:56 +10:00
fearlessTobi 63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
Lioncash 0cbcd6ec9a kernel: Eliminate kernel global state
As means to pave the way for getting rid of global state within core,
This eliminates kernel global state by removing all globals. Instead
this introduces a KernelCore class which acts as a kernel instance. This
instance lives in the System class, which keeps its lifetime contained
to the lifetime of the System class.

This also forces the kernel types to actually interact with the main
kernel instance itself instead of having transient kernel state placed
all over several translation units, keeping everything together. It also
has a nice consequence of making dependencies much more explicit.

This also makes our initialization a tad bit more correct. Previously we
were creating a kernel process before the actual kernel was initialized,
which doesn't really make much sense.

The KernelCore class itself follows the PImpl idiom, which allows
keeping all the implementation details sealed away from everything else,
which forces the use of the exposed API and allows us to avoid any
unnecessary inclusions within the main kernel header.
2018-08-28 22:31:51 -04:00
Lioncash bf45092c61 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-01 23:34:42 -04:00
bunnei 5c42cadbc9
Merge pull request #800 from lioncash/set
set_sys: Implement SetColorSetId()
2018-07-25 10:25:29 -07:00
Lioncash 76f191ce36 ipc_helper: Add helper member function for popping enum values to RequestParser 2018-07-24 00:47:51 -04:00
Lioncash 22fd3f0026 hle_ipc: Make constructors explicit where applicable 2018-07-23 22:40:24 -04:00
Lioncash 2a1daf8f83 ipc_helpers: Make member variables of ResponseBuilder private
These aren't used externally at all, so they can be made private.
2018-07-23 22:29:07 -04:00
Lioncash 0a0b3c4b9f ipc_helpers: Add PushEnum() member function to ResponseBuilder
Allows pushing strongly-typed enum members without the need to always
cast them at the call sites.

Note that we *only* allow strongly-typed enums in this case. The reason
for this is that strongly typed enums have a guaranteed defined size, so
the size of the data being pushed is always deterministic. With regular
enums this can be a little more error-prone, so we disallow them.

This function simply uses the underlying type of the enum to determine
the size of the data. For example, if an enum is defined as:

enum class SomeEnum : u16 {
  SomeEntry
};

if PushEnum(SomeEnum::SomeEntry); is called, then it will push a
u16-size amount of data.
2018-07-20 15:00:58 -04:00
bunnei fadab1d5f3 ipc: Add support for PopIpcInterface() method.
- This can be used for domain objects as inputs to service functions.
2018-05-01 21:57:44 -04:00
mailwl 827152d1fd Fix: change check for domain order and existance of domain message header 2018-02-20 21:59:58 +03:00
mailwl 1572c45aa0 IPC: add domain header to response if only it exists in request 2018-02-20 19:27:49 +03:00
bunnei 714a576113 ResponseBuilder: Use a bit field for customizing instead of always_move_handles. 2018-01-24 22:24:20 -05:00
bunnei 1b1d399e5f hle: Rename RequestBuilder to ResponseBuilder. 2018-01-24 22:24:10 -05:00
bunnei f0035420d7 ipc_helpers: Make interface domain agnostic and add header validation. 2018-01-24 22:19:01 -05:00
bunnei 27bad0598a hle: Integrate Domain handling into ServerSession. 2018-01-24 22:18:56 -05:00
bunnei 67758857e4 hle: Remove Domain and SyncObject kernel objects. 2018-01-24 22:18:54 -05:00
Subv 67c43e9200 IPC: Don't create an unnecessary port when using PushIpcInterface outside of a domain. 2018-01-22 17:31:23 -05:00
bunnei 8e50d6002b fsp_srv: Various improvements to IStorage:Read implementation. 2018-01-21 15:51:43 -05:00
gdkchan 59575d5cae Stub PopLaunchParameter and implement Buffer C Descriptors reading on hle_ipc (#96)
* Stub PopLaunchParameter and implement Buffer C Descriptors reading

* Address PR feedback

* Ensure we push a u64 not a size_t

* Fix formatting
2018-01-18 14:54:34 -05:00
Subv 5bc14e791a IPC: Push domain objects as move handles when not in a domain. 2018-01-16 18:42:08 -05:00
Subv fb73e8b723 IPC: Allow passing arguments to the Interfaces when using PushIpcInterface 2018-01-10 23:28:13 -05:00
Subv ba2ffd7b81 IPC: Take the number of domain objects as a parameter in MakeBuilder. 2018-01-07 17:11:58 -05:00
Subv 80f6df5414 IPC: Fixed pushing ResultCodes into the command buffer.
They should have 32 bits of padding after the error code now.
2018-01-07 17:11:54 -05:00
Subv 32847d8b86 IPC: Add functions to read the input move/copy objects from an IPC request. 2018-01-07 17:11:51 -05:00
Subv 0368324f79 IPC Cleanup: Remove 3DS-specific code and translate copy, move and domain objects in IPC requests.
Popping objects from the buffer is still not implemented.
2018-01-07 17:11:47 -05:00
Subv 226786f0b0 IPC: Use the correct size when pushing raw data to the command buffer and fixed pushing domain objects.
Domain object ids are always stored immediately after the raw data.
2018-01-07 17:11:43 -05:00
bunnei dcdaac8a0b kernel: Fix implementation of ConvertSessionToDomain. 2017-12-29 00:36:22 -05:00
bunnei 3f2a738d34 ipc_helpers: Fix alignment (was wrong as a result of a dynarmic bug). 2017-10-17 18:03:47 -04:00
bunnei 4fb1b24d68 hle: Implement ConvertSessionToDomain, various cleanups. 2017-10-15 01:24:22 -04:00
bunnei 960a1416de hle: Initial implementation of NX service framework and IPC. 2017-10-14 22:18:42 -04:00
Huw Pascoe a13ab958cb Fixed type conversion ambiguity 2017-09-30 09:34:35 +01:00
Yuri Kunde Schlesner 92ca422088 Kernel: Allow clearing request_objects to re-use buffer space
Reduces the necessary allocation to max(in_handles, out_handles) rather
than (in_handles + out_handles).
2017-06-11 13:10:21 -07:00
Yuri Kunde Schlesner 21436f5ef7 IPC: Add Pop/PushObjects methods to RequestParser/Builder
These use the context functions to create and look-up handles for the
user.
2017-06-11 13:10:20 -07:00
Yuri Kunde Schlesner 1c4b0ebb1f IPC: Add basic HLERequestContext support to RequestParser/Builder 2017-06-11 13:10:16 -07:00
Yuri Kunde Schlesner be031989ee Kernel: Move HandleTable to a separate file 2017-05-29 17:34:39 -07:00
Lectem 12ed746477 IPCHelper Skip method + address comments for apt 2017-03-18 11:47:40 +01:00
Lectem 77f4fc473f fix #2560 and other comments 2017-03-18 10:44:01 +01:00
Lectem fb70c9683c move push out of class body and add u8 u16 bool specializations 2017-03-18 10:44:01 +01:00
Lectem 501e23ce59 refactor APT service to use the new IPC helpers 2017-03-18 10:44:01 +01:00
Lectem 2ee472b9c7 fix wwylele's comment and use typename in templates 2017-02-05 00:29:07 +01:00
Lectem f91c51467a move Pop methods out of class body 2016-12-26 14:42:06 +01:00
Lectem 8f2b642415 IPC helpers 2016-12-26 14:07:29 +01:00