mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Add serviceAssumeDomain + minor codegen optimization in serviceDispatch*
This commit is contained in:
parent
96fc7dd8cd
commit
d7564ce80d
@ -156,6 +156,16 @@ NX_CONSTEXPR void serviceCreateDomainSubservice(Service* s, Service* parent, u32
|
|||||||
s->pointer_buffer_size = parent->pointer_buffer_size;
|
s->pointer_buffer_size = parent->pointer_buffer_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Hints the compiler that a service will always contain a domain object.
|
||||||
|
* @param[in] s Service object.
|
||||||
|
*/
|
||||||
|
NX_CONSTEXPR void serviceAssumeDomain(Service* s)
|
||||||
|
{
|
||||||
|
if (!s->object_id)
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Closes a service.
|
* @brief Closes a service.
|
||||||
* @param[in] s Service object.
|
* @param[in] s Service object.
|
||||||
@ -410,7 +420,10 @@ NX_INLINE Result serviceDispatchImpl(
|
|||||||
SfDispatchParams disp
|
SfDispatchParams disp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
void* in = serviceMakeRequest(s, request_id, disp.context,
|
// Make a copy of the service struct, so that the compiler can assume that it won't be modified by function calls.
|
||||||
|
Service srv = *s;
|
||||||
|
|
||||||
|
void* in = serviceMakeRequest(&srv, request_id, disp.context,
|
||||||
in_data_size, disp.in_send_pid,
|
in_data_size, disp.in_send_pid,
|
||||||
disp.buffer_attrs, disp.buffers,
|
disp.buffer_attrs, disp.buffers,
|
||||||
disp.in_num_objects, disp.in_objects,
|
disp.in_num_objects, disp.in_objects,
|
||||||
@ -422,7 +435,7 @@ NX_INLINE Result serviceDispatchImpl(
|
|||||||
Result rc = svcSendSyncRequest(disp.target_session == INVALID_HANDLE ? s->session : disp.target_session);
|
Result rc = svcSendSyncRequest(disp.target_session == INVALID_HANDLE ? s->session : disp.target_session);
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
void* out = NULL;
|
void* out = NULL;
|
||||||
rc = serviceParseResponse(s,
|
rc = serviceParseResponse(&srv,
|
||||||
out_data_size, &out,
|
out_data_size, &out,
|
||||||
disp.out_num_objects, disp.out_objects,
|
disp.out_num_objects, disp.out_objects,
|
||||||
disp.out_handle_attrs, disp.out_handles);
|
disp.out_handle_attrs, disp.out_handles);
|
||||||
|
Loading…
Reference in New Issue
Block a user