fatal: Use new IPC interface

This commit is contained in:
fincs 2019-09-19 04:23:00 +02:00
parent 6ad0042147
commit 51db782e7a
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60

View File

@ -1,7 +1,6 @@
// Copyright 2017 plutoo
#include "types.h"
#include "result.h"
#include "kernel/ipc.h"
#include "kernel/detect.h"
#include "kernel/svc.h"
#include "services/fatal.h"
@ -26,33 +25,22 @@ static void _fatalImpl(u32 cmd_id, Result err, FatalType type, FatalContext *ctx
rc = smGetServiceOriginal(&srv, smEncodeName("fatal:u"));
if (R_SUCCEEDED(rc)) {
IpcCommand c;
ipcInitialize(&c);
ipcSendPid(&c);
if (ctx != NULL) {
ipcAddSendBuffer(&c, ctx, sizeof(*ctx), BufferType_Normal);
}
struct {
u64 magic;
u64 cmd_id;
const struct {
u32 result;
u32 type;
u64 pid_placeholder;
} *raw;
} in = { err, type };
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = cmd_id;
raw->result = err;
raw->type = type;
raw->pid_placeholder = 0; // Overwritten by fatal with PID descriptor.
ipcDispatch(srv);
Service s;
serviceCreate(&s, srv);
serviceDispatchIn(&s, cmd_id, in,
.buffer_attrs = { ctx ? (SfBufferAttr_In | SfBufferAttr_HipcMapAlias) : 0U },
.buffers = { { ctx, sizeof(*ctx) } },
.in_send_pid = true,
);
}
}
switch (type) {
case FatalType_ErrorReport:
break;
@ -72,7 +60,7 @@ void NORETURN fatalSimple(Result err) {
}
void fatalWithType(Result err, FatalType type) {
_fatalImpl(1, err, type, NULL);
_fatalImpl(1, err, type, NULL);
}
void fatalWithContext(Result err, FatalType type, FatalContext *ctx) {