Commit Graph

51 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
02bc9e9de1 core/hle/ipc: Remove unnecessary includes
Removes a few inclusion dependencies from the headers or replaces
existing ones with ones that don't indirectly include the required
headers.

This allows removing an inclusion of core/memory.h, meaning that if the
memory header is ever changed in the future, it won't result in
rebuilding the entirety of the HLE services (as the IPC headers are used
quite ubiquitously throughout the HLE service implementations).
2019-03-05 09:53:38 -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
Zach Hilman
170d707850 hle_ipc: Refactor SleepClientThread to avoid ReadableEvent 2018-11-29 09:14:20 -05:00
Zach Hilman
a56fc84e7a hle_ipc: Use event pair for SleepClientThread 2018-11-29 08:42:26 -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
Lioncash
0cc347462d hle_ipc: Make GetDomainMessageHeader return a regular pointer
Nothing requires the shared owner ship here, so we can just return a
plain pointer.
2018-10-29 23:18:25 -04:00
Lioncash
90a981a03a kernel/process: Make the handle table per-process
In the kernel, there isn't a singular handle table that everything gets
tossed into or used, rather, each process gets its own handle table that
it uses. This currently isn't an issue for us, since we only execute one
process at the moment, but we may as well get this out of the way so
it's not a headache later on.
2018-10-20 16:38:32 -04:00
fearlessTobi
63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
Lioncash
ff5024ee2a hle_ipc: Make WriteToOutgoingCommandBuffer()'s reference parameter const
This function doesn't modify anything within the reference Thread
instance.
2018-08-09 02:51:38 -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
Lioncash
a2304fad16 kernel: Remove unnecessary includes
Removes unnecessary direct dependencies in some headers and also gets
rid of indirect dependencies that were being relied on to be included.
2018-07-31 10:15:17 -04:00
Lioncash
22fd3f0026 hle_ipc: Make constructors explicit where applicable 2018-07-23 22:40:24 -04:00
Lioncash
ff500a7b68 hle_ipc: Introduce generic WriteBuffer overload for multiple container types
This introduces a slightly more generic variant of WriteBuffer().
Notably, this variant doesn't constrain the arguments to only accepting
std::vector instances. It accepts whatever adheres to the
ContiguousContainer concept in the C++ standard library.

This essentially means, std::array, std::string, and std::vector can be
used directly with this interface. The interface no longer forces you to
solely use containers that dynamically allocate.

To ensure our overloads play nice with one another, we only enable the
container-based WriteBuffer if the argument is not a pointer, otherwise
we fall back to the pointer-based one.
2018-07-19 17:05:12 -04:00
Lioncash
46458e7284 core/memory, core/hle/kernel: Use std::move where applicable
Avoids pointless copies
2018-07-18 19:34:31 -04:00
bunnei
170e19d4ea nvflinger: Fix for BufferQueue event handling. 2018-07-17 00:26:23 -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
David
ff2f0d980a GetSharedFontInOrderOfPriority (#381)
* GetSharedFontInOrderOfPriority

* Update pl_u.cpp

* Ability to use ReadBuffer and WriteBuffer with different buffer indexes, fixed up GetSharedFontInOrderOfPriority

* switched to NGLOG

* Update pl_u.cpp

* Update pl_u.cpp

* language_code is actually language code and not index

* u32->u64

* final cleanups
2018-05-01 16:28:36 -04:00
bunnei
c86af6939c hle_ipc: Add SleepClientThread to block current thread within HLE routines. 2018-03-18 20:56:34 -04:00
bunnei
2faa83ca13 hle_ipc: Use shared_ptr instead of unique_ptr to allow copies. 2018-03-18 20:56:33 -04:00
bunnei
019f1a0cf0 hle_ipc: Remove GetPointer(..) usage with WriteToOutgoingCommandBuffer. 2018-03-18 20:56:33 -04:00
mailwl
6797d4a907 Service/hid: stub some functions 2018-02-16 06:15:05 +03:00
bunnei
88bfec37ce hle_ipc: Remove const from WriteBuffer size. 2018-02-14 14:21:10 -05:00
bunnei
6fd19f05f1 hle_ipc: Add GetReadBufferSize and check write buffer size. 2018-02-14 00:14:17 -05:00
bunnei
1ce6fff064 hle_ipc: Add helper functions for reading and writing buffers. 2018-02-13 23:26:03 -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
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
MerryMage
e35644c005 clang-format 2018-01-16 18:05:21 +00:00
bunnei
1247c53786 yuzu: Update license text to be consistent across project. 2018-01-13 16:22:39 -05:00
bunnei
039fc7f985 core: Fix recent GCC build breaks. 2018-01-11 22:24:09 -05:00
Subv
ab86b80cac IPC: Corrected some definitions for the buffer C descriptor flags. 2018-01-10 23:28:02 -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
3597650f22 service: Return proper result code for IPC::CommandType::Close. 2017-10-31 19:30:05 -04:00
bunnei
b283cf7348 hle_ipc: Parse out buffer X/A/B/B descriptors from incoming command buffer. 2017-10-18 21:38:01 -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
Yuri Kunde Schlesner
0dfafdbe59 Kernel/IPC: Make HLERequestContext usable from outside kernel 2017-06-18 16:05:12 -07:00
Yuri Kunde Schlesner
d8f6000f54 Kernel/IPC: Use boost::small_vector for HLE context objects 2017-06-11 16:34:13 -07: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
8cb65fe65a Kernel: Basic support for IPC translation for HLE services 2017-06-11 13:10:21 -07:00
Yuri Kunde Schlesner
05fee70211 Kernel: Add methods in HLERequestContext abstracting handle creation 2017-06-11 13:07:33 -07:00
Yuri Kunde Schlesner
20e5abb308 ServiceFramework: Use separate copy of command buffer
Copy the IPC command buffer to/from the request context before/after the
handler is invoked. This is part of a move away from using global data
for handling IPC requests.
2017-06-11 13:07:33 -07:00
Yuri Kunde Schlesner
84c497292a Service: Add new ServiceFramework framework for writing HLE services
The old "Interface" class had a few problems such as using free
functions (Which didn't allow you to write the service handler as if it
were a regular class.) which weren't very extensible. (Only received one
parameter with a pointer to the Interface object.)

The new ServiceFramework aims to solve these problems by working with
member functions and passing a generic context struct as parameter. This
struct can be extended in the future without having to update all
existing service implementations.
2017-06-08 00:11:37 -07:00
Yuri Kunde Schlesner
6dc133c24a Kernel: Remove some unnecessary namespace qualifications 2017-06-06 14:51:42 -07:00
Yuri Kunde Schlesner
6354d08359 Kernel: Add a dedicated SetHleHandler method to ServerPort/ServerSession
This allows attaching a HLE handle to a ServerPort at any point after it
is created, allowing port/session creation to be generic between HLE and
regular services.
2017-06-06 02:56:32 -07:00