1 // Copyright 2015 Citra Emulator Project
2 // Licensed under GPLv2 or any later version
3 // Refer to the license.txt file included.
4 
5 #pragma once
6 
7 #include <memory>
8 #include <boost/serialization/shared_ptr.hpp>
9 #include "core/global.h"
10 #include "core/hle/kernel/event.h"
11 #include "core/hle/service/service.h"
12 
13 namespace Core {
14 class System;
15 }
16 
17 namespace Service::BOSS {
18 
19 class Module final {
20 public:
21     explicit Module(Core::System& system);
22     ~Module() = default;
23 
24     class Interface : public ServiceFramework<Interface> {
25     public:
26         Interface(std::shared_ptr<Module> boss, const char* name, u32 max_session);
27         ~Interface() = default;
28 
29     protected:
30         /**
31          * BOSS::InitializeSession service function
32          *  Inputs:
33          *      0 : Header Code[0x00010082]
34          *    1-2 : programID, normally zero for using the programID determined from the input PID
35          *      3 : 0x20, ARM11-kernel processID translate-header.
36          *  Outputs:
37          *      1 : Result of function, 0 on success, otherwise error code
38          */
39         void InitializeSession(Kernel::HLERequestContext& ctx);
40 
41         /**
42          * BOSS::RegisterStorage service function
43          *  Inputs:
44          *      0 : Header Code[0x00020100]
45          *    1-2 : u64 extdataID
46          *      3 : u32 boss_size
47          *      4 : u8 extdata_type: 0 = NAND, 1 = SD
48          *  Outputs:
49          *      1 : Result of function, 0 on success, otherwise error code
50          */
51         void SetStorageInfo(Kernel::HLERequestContext& ctx);
52 
53         /**
54          * BOSS::UnregisterStorage service function
55          *  Inputs:
56          *      0 : Header Code[0x00030000]
57          *  Outputs:
58          *      1 : Result of function, 0 on success, otherwise error code
59          */
60         void UnregisterStorage(Kernel::HLERequestContext& ctx);
61 
62         /**
63          * BOSS::GetStorageInfo service function
64          *  Inputs:
65          *      0 : Header Code[0x00040000]
66          *  Outputs:
67          *      1 : Result of function, 0 on success, otherwise error code
68          *      2 : u32 unknown value
69          */
70         void GetStorageInfo(Kernel::HLERequestContext& ctx);
71 
72         /**
73          * BOSS::RegisterPrivateRootCa service function
74          *  Inputs:
75          *      0 : Header Code[0x00050042]
76          *      1 : u32 Size
77          *      2 : MappedBufferDesc(permission = R)
78          *      3 : u32 buff_addr
79          *  Outputs:
80          *      1 : Result of function, 0 on success, otherwise error code
81          *      2 : buff_size << 4 | 0xA
82          *      3 : u32 buff_addr
83          */
84         void RegisterPrivateRootCa(Kernel::HLERequestContext& ctx);
85 
86         /**
87          * BOSS::RegisterPrivateClientCert service function
88          *  Inputs:
89          *      0 : Header Code[0x00060084]
90          *      1 : u32 buffer 1 size
91          *      2 : u32 buffer 2 size
92          *      3 : MappedBufferDesc1(permission = R)
93          *      4 : u32 buff_addr1
94          *      5 : MappedBufferDesc2(permission = R)
95          *      6 : u32 buff_addr2
96          *  Outputs:
97          *      1 : Result of function, 0 on success, otherwise error code
98          *      2 : buff1_size << 4 | 0xA
99          *      3 : u32 buff_addr1
100          *      4 : buff2_size << 4 | 0xA
101          *      5 : u32 buff_addr2
102          */
103         void RegisterPrivateClientCert(Kernel::HLERequestContext& ctx);
104 
105         /**
106          * BOSS::GetNewArrivalFlag service function
107          *  Inputs:
108          *      0 : Header Code[0x00070000]
109          *  Outputs:
110          *      1 : Result of function, 0 on success, otherwise error code
111          *      2 : u8 flag
112          */
113         void GetNewArrivalFlag(Kernel::HLERequestContext& ctx);
114 
115         /**
116          * BOSS::RegisterNewArrivalEvent service function
117          *  Inputs:
118          *      0 : Header Code[0x00080002]
119          *      1 : u32 unknown1
120          *      2 : u32 unknown2
121          *  Outputs:
122          *      1 : Result of function, 0 on success, otherwise error code
123          */
124         void RegisterNewArrivalEvent(Kernel::HLERequestContext& ctx);
125 
126         /**
127          * BOSS::SetOptoutFlag service function
128          *  Inputs:
129          *      0 : Header Code[0x00090040]
130          *      1 : u8 output_flag
131          *  Outputs:
132          *      1 : Result of function, 0 on success, otherwise error code
133          */
134         void SetOptoutFlag(Kernel::HLERequestContext& ctx);
135 
136         /**
137          * BOSS::GetOptoutFlag service function
138          *  Inputs:
139          *      0 : Header Code[0x000A0000]
140          *  Outputs:
141          *      1 : Result of function, 0 on success, otherwise error code
142          *      2 : u8 output_flag
143          */
144         void GetOptoutFlag(Kernel::HLERequestContext& ctx);
145 
146         /**
147          * BOSS::RegisterTask service function
148          *  Inputs:
149          *      0 : Header Code[0x000B00C2]
150          *      1 : TaskID buffer size
151          *      2 : u8 unknown value, Usually zero, regardless of HTTP GET/POST.
152          *      3 : u8 unknown value, Usually zero, regardless of HTTP GET/POST.
153          *      4 : MappedBufferDesc1(permission = R)
154          *      5 : buff_addr
155          *  Outputs:
156          *      1 : Result of function, 0 on success, otherwise error code
157          *      2 : buff_size << 4 | 0xA
158          *      3 : u32 buff_addr
159          */
160         void RegisterTask(Kernel::HLERequestContext& ctx);
161 
162         /**
163          * BOSS::UnregisterTask service function
164          *  Inputs:
165          *      0 : Header Code[0x000C0082]
166          *      1 : TaskID buffer size
167          *      2 : u8 unknown value
168          *      3 : MappedBufferDesc1(permission = R)
169          *      4 : buff_addr
170          *  Outputs:
171          *      1 : Result of function, 0 on success, otherwise error code
172          *      2 : buff_size << 4 | 0xA
173          *      3 : u32 buff_addr
174          */
175         void UnregisterTask(Kernel::HLERequestContext& ctx);
176 
177         /**
178          * BOSS::ReconfigureTask service function
179          *  Inputs:
180          *      0 : Header Code[0x000D0082]
181          *      1 : TaskID buffer size
182          *      2 : u8 unknown value
183          *      3 : MappedBufferDesc1(permission = R)
184          *      4 : buff_addr
185          *  Outputs:
186          *      1 : Result of function, 0 on success, otherwise error code
187          *      2 : buff_size << 4 | 0xA
188          *      3 : u32 buff_addr
189          */
190         void ReconfigureTask(Kernel::HLERequestContext& ctx);
191 
192         /**
193          * BOSS::GetTaskIdList service function
194          *  Inputs:
195          *      0 : Header Code[0x000E0000]
196          *  Outputs:
197          *      1 : Result of function, 0 on success, otherwise error code
198          */
199         void GetTaskIdList(Kernel::HLERequestContext& ctx);
200 
201         /**
202          * BOSS::GetStepIdList service function
203          *  Inputs:
204          *      0 : Header Code[0x000F0042]
205          *      1 : u32 buffer size
206          *      2 : MappedBufferDesc(permission = R)
207          *      3 : u32 buff_addr
208          *
209          *  Outputs:
210          *      1 : Result of function, 0 on success, otherwise error code
211          *      2 : buff_size << 4 | 0xA
212          *      3 : u32 buff_addr
213          */
214         void GetStepIdList(Kernel::HLERequestContext& ctx);
215 
216         /**
217          * BOSS::GetNsDataIdList service function
218          *  Inputs:
219          *      0 : Header Code[0x00100102]
220          *      1 : u32 filter
221          *      2 : u32 Buffer size in words(max entries)
222          *      3 : u16, starting word-index in the internal NsDataId list
223          *      4 : u32, start_NsDataId
224          *      5 : MappedBufferDesc(permission = W)
225          *      6 : u32 buff_addr
226          *  Outputs:
227          *      1 : Result of function, 0 on success, otherwise error code
228          *      2 : u16 Actual number of output entries
229          *      3 : u16 Last word-index copied to output in the internal NsDataId list
230          *      4 : buff_size << 4 | 0xC
231          *      5 : u32 buff_addr
232          */
233         void GetNsDataIdList(Kernel::HLERequestContext& ctx);
234 
235         /**
236          * BOSS::GetNsDataIdList1 service function
237          *  Inputs:
238          *      0 : Header Code[0x00110102]
239          *      1 : u32 filter
240          *      2 : u32 Buffer size in words(max entries)
241          *      3 : u16, starting word-index in the internal NsDataId list
242          *      4 : u32, start_NsDataId
243          *      5 : MappedBufferDesc(permission = W)
244          *      6 : u32 buff_addr
245          *  Outputs:
246          *      1 : Result of function, 0 on success, otherwise error code
247          *      2 : u16 Actual number of output entries
248          *      3 : u16 Last word-index copied to output in the internal NsDataId list
249          *      4 : buff_size << 4 | 0xC
250          *      5 : u32 buff_addr
251          */
252         void GetNsDataIdList1(Kernel::HLERequestContext& ctx);
253 
254         /**
255          * BOSS::GetNsDataIdList2 service function
256          *  Inputs:
257          *      0 : Header Code[0x00120102]
258          *      1 : u32 filter
259          *      2 : u32 Buffer size in words(max entries)
260          *      3 : u16, starting word-index in the internal NsDataId list
261          *      4 : u32, start_NsDataId
262          *      5 : MappedBufferDesc(permission = W)
263          *      6 : u32 buff_addr
264          *  Outputs:
265          *      1 : Result of function, 0 on success, otherwise error code
266          *      2 : u16 Actual number of output entries
267          *      3 : u16 Last word-index copied to output in the internal NsDataId list
268          *      4 : buff_size << 4 | 0xC
269          *      5 : u32 buff_addr
270          */
271         void GetNsDataIdList2(Kernel::HLERequestContext& ctx);
272 
273         /**
274          * BOSS::GetNsDataIdList3 service function
275          *  Inputs:
276          *      0 : Header Code[0x00130102]
277          *      1 : u32 filter
278          *      2 : u32 Buffer size in words(max entries)
279          *      3 : u16, starting word-index in the internal NsDataId list
280          *      4 : u32, start_NsDataId
281          *      5 : MappedBufferDesc(permission = W)
282          *      6 : u32 buff_addr
283          *  Outputs:
284          *      1 : Result of function, 0 on success, otherwise error code
285          *      2 : u16 Actual number of output entries
286          *      3 : u16 Last word-index copied to output in the internal NsDataId list
287          *      4 : buff_size << 4 | 0xC
288          *      5 : u32 buff_addr
289 
290          */
291         void GetNsDataIdList3(Kernel::HLERequestContext& ctx);
292 
293         /**
294          * BOSS::SendProperty service function
295          *  Inputs:
296          *      0 : Header Code[0x00140082]
297          *      1 : u16 PropertyID
298          *      2 : u32 size
299          *      3 : MappedBufferDesc(permission = R)
300          *      4 : u32 buff_addr
301          *  Outputs:
302          *      1 : Result of function, 0 on success, otherwise error code
303          *      2 : buff_size << 4 | 0xA
304          *      3 : u32 buff_addr
305          */
306         void SendProperty(Kernel::HLERequestContext& ctx);
307 
308         /**
309          * BOSS::SendPropertyHandle service function
310          *  Inputs:
311          *      0 : Header Code[0x00150042]
312          *      2 : u16 PropertyID
313          *      3 : 0x0
314          *      4 : Handle
315          *  Outputs:
316          *      1 : Result of function, 0 on success, otherwise error code
317          */
318         void SendPropertyHandle(Kernel::HLERequestContext& ctx);
319 
320         /**
321          * BOSS::ReceiveProperty service function
322          *  Inputs:
323          *      0 : Header Code[0x00160082]
324          *      1 : u16 PropertyID
325          *      2 : u32 Size
326          *      3 : MappedBufferDesc(permission = W)
327          *      4 : u32 buff addr
328          *  Outputs:
329          *      1 : Result of function, 0 on success, otherwise error code
330          *      2 : Actual read size
331          *      4 : buff_size << 4 | 0xC
332          *      5 : u32 buff_addr
333          */
334         void ReceiveProperty(Kernel::HLERequestContext& ctx);
335 
336         /**
337          * BOSS::UpdateTaskInterval service function
338          *  Inputs:
339          *      0 : Header Code[0x00170082]
340          *      1 : u32 unknown value
341          *      2 : u8 unknown value
342          *      3 : MappedBufferDesc1(permission = R)
343          *      4 : buff_addr
344          *  Outputs:
345          *      1 : Result of function, 0 on success, otherwise error code
346          *      2 : buff_size << 4 | 0xA
347          *      3 : u32 buff_addr
348          */
349         void UpdateTaskInterval(Kernel::HLERequestContext& ctx);
350 
351         /**
352          * BOSS::UpdateTaskCount service function
353          *  Inputs:
354          *      0 : Header Code[0x00180082]
355          *      1 : u32 buff_size
356          *      2 : u32 unknown2
357          *      3 : MappedBufferDesc(permission = R)
358          *      4 : u32 buff_addr
359          *  Outputs:
360          *      1 : Result of function, 0 on success, otherwise error code
361          *      2 : buff_size << 4 | 0xA
362          *      3 : u32 buff_addr
363          */
364         void UpdateTaskCount(Kernel::HLERequestContext& ctx);
365 
366         /**
367          * BOSS::GetTaskInterval service function
368          *  Inputs:
369          *      0 : Header Code[0x00190042]
370          *      1 : u32 size
371          *      2 : MappedBufferDesc(permission = R)
372          *      3 : u32 buff_addr
373          *  Outputs:
374          *      1 : Result of function, 0 on success, otherwise error code
375          *      2 : u32 unknown value
376          *      3 : buff_size << 4 | 0xA
377          *      4 : u32 buff_addr
378          */
379         void GetTaskInterval(Kernel::HLERequestContext& ctx);
380 
381         /**
382          * BOSS::GetTaskCount service function
383          *  Inputs:
384          *      0 : Header Code[0x001A0042]
385          *      1 : u32 size
386          *      2 : MappedBufferDesc(permission = R)
387          *      3 : u32 buff_addr
388          *  Outputs:
389          *      1 : Result of function, 0 on success, otherwise error code
390          *      2 : u32 unknown value
391          *      3 : buff_size << 4 | 0xA
392          *      4 : u32 buff_addr
393          */
394         void GetTaskCount(Kernel::HLERequestContext& ctx);
395 
396         /**
397          * BOSS::GetTaskServiceStatus service function
398          *  Inputs:
399          *      0 : Header Code[0x001B0042]
400          *      1 : u32 size
401          *      2 : MappedBufferDesc(permission = R)
402          *      3 : u32 buff_addr
403          *  Outputs:
404          *      1 : Result of function, 0 on success, otherwise error code
405          *      2 : u8 unknown value
406          *      3 : buff_size << 4 | 0xA
407          *      4 : u32 buff_addr
408          */
409         void GetTaskServiceStatus(Kernel::HLERequestContext& ctx);
410 
411         /**
412          * BOSS::StartTask service function
413          *  Inputs:
414          *      0 : Header Code[0x001C0042]
415          *      1 : TaskID buffer size
416          *      2 : MappedBufferDesc(permission = R)
417          *      3 : u32 buff_addr
418          *  Outputs:
419          *      1 : Result of function, 0 on success, otherwise error code
420          *      2 : buff_size << 4 | 0xA
421          *      3 : u32 buff_addr
422          */
423         void StartTask(Kernel::HLERequestContext& ctx);
424 
425         /**
426          * BOSS::StartTaskImmediate service function
427          *  Inputs:
428          *      0 : Header Code[0x001D0042]
429          *      1 : TaskID buffer size
430          *      2 : MappedBufferDesc(permission = R)
431          *      3 : u32 buff_addr
432          *  Outputs:
433          *      1 : Result of function, 0 on success, otherwise error code
434          *      2 : buff_size << 4 | 0xA
435          *      3 : u32 buff_addr
436          */
437         void StartTaskImmediate(Kernel::HLERequestContext& ctx);
438 
439         /**
440          * BOSS::CancelTask service function
441          *  Inputs:
442          *      0 : Header Code[0x001E0042]
443          *      1 : TaskID buffer size
444          *      2 : MappedBufferDesc(permission = R)
445          *      3 : u32 buff_addr
446          *  Outputs:
447          *      1 : Result of function, 0 on success, otherwise error code
448          *      2 : buff_size << 4 | 0xA
449          *      3 : u32 buff_addr
450          */
451         void CancelTask(Kernel::HLERequestContext& ctx);
452 
453         /**
454          * BOSS::GetTaskFinishHandle service function
455          *  Inputs:
456          *      0 : Header Code[0x001F0000]
457          *  Outputs:
458          *      1 : Result of function, 0 on success, otherwise error code
459          *      2 : 0x0
460          *      3 : Task Finish Handle
461          */
462         void GetTaskFinishHandle(Kernel::HLERequestContext& ctx);
463 
464         /**
465          * BOSS::GetTaskState service function
466          *  Inputs:
467          *      0 : Header Code[0x00200082]
468          *      1 : TaskID buffer size
469          *      2 : u8 state
470          *      3 : MappedBufferDesc(permission = R)
471          *      4 : u32 buff_addr
472          *  Outputs:
473          *      1 : Result of function, 0 on success, otherwise error code
474          *      2 : u8 TaskStatus
475          *      3 : u32 Current state value for task PropertyID 0x4
476          *      4 : u8 unknown value
477          *      5 : buff_size << 4 | 0xA
478          *      6 : u32 buff_addr
479          */
480         void GetTaskState(Kernel::HLERequestContext& ctx);
481 
482         /**
483          * BOSS::GetTaskResult service function
484          *  Inputs:
485          *      0 : Header Code[0x00210042]
486          *      1 : u32 size
487          *      2 : MappedBufferDesc(permission = R)
488          *      3 : u32 buff_addr
489          *  Outputs:
490          *      1 : Result of function, 0 on success, otherwise error code
491          *      2 : u8 unknown value
492          *      3 : u32 unknown value
493          *      4 : u8 unknown value
494          *      5 : buff_size << 4 | 0xA
495          *      6 : u32 buff_addr
496          */
497         void GetTaskResult(Kernel::HLERequestContext& ctx);
498 
499         /**
500          * BOSS::GetTaskCommErrorCode service function
501          *  Inputs:
502          *      0 : Header Code[0x00220042]
503          *      1 : u32 size
504          *      2 : MappedBufferDesc(permission = R)
505          *      3 : u32 buff_addr
506          *  Outputs:
507          *      1 : Result of function, 0 on success, otherwise error code
508          *      2 : u32 unknown value
509          *      3 : u32 unknown value
510          *      4 : u8 unknown value
511          *      5 : buff_size << 4 | 0xA
512          *      6 : u32 buff_addr
513          */
514         void GetTaskCommErrorCode(Kernel::HLERequestContext& ctx);
515 
516         /**
517          * BOSS::GetTaskStatus service function
518          *  Inputs:
519          *      0 : Header Code[0x002300C2]
520          *      1 : u32 size
521          *      2 : u8 unknown value
522          *      3 : u8 unknown value
523          *      4 : MappedBufferDesc(permission = R)
524          *      5 : u32 buff_addr
525          *  Outputs:
526          *      1 : Result of function, 0 on success, otherwise error code
527          *      2 : u8 unknown value
528          *      3 : buff_size << 4 | 0xA
529          *      4 : u32 buff_addr
530          */
531         void GetTaskStatus(Kernel::HLERequestContext& ctx);
532 
533         /**
534          * BOSS::GetTaskError service function
535          *  Inputs:
536          *      0 : Header Code[0x00240082]
537          *      1 : u32 size
538          *      2 : u8 unknown value
539          *      3 : MappedBufferDesc(permission = R)
540          *      4 : u32 buff_addr
541          *  Outputs:
542          *      1 : Result of function, 0 on success, otherwise error code
543          *      2 : u8 unknown value
544          *      3 : buff_size << 4 | 0xA
545          *      4 : u32 buff_addr
546          */
547         void GetTaskError(Kernel::HLERequestContext& ctx);
548 
549         /**
550          * BOSS::GetTaskInfo service function
551          *  Inputs:
552          *      0 : Header Code[0x00250082]
553          *      1 : u32 size
554          *      2 : u8 unknown value
555          *      3 : MappedBufferDesc(permission = R)
556          *      4 : u32 buff_addr
557          *  Outputs:
558          *      1 : Result of function, 0 on success, otherwise error code
559          *      2 : buff_size << 4 | 0xA
560          *      3 : u32 buff_addr
561          */
562         void GetTaskInfo(Kernel::HLERequestContext& ctx);
563 
564         /**
565          * BOSS::DeleteNsData service function
566          *  Inputs:
567          *      0 : Header Code[0x00260040]
568          *      1 : u32 NsDataID
569          *  Outputs:
570          *      1 : Result of function, 0 on success, otherwise error code
571          */
572         void DeleteNsData(Kernel::HLERequestContext& ctx);
573 
574         /**
575          * BOSS::GetNsDataHeaderInfo service function
576          *  Inputs:
577          *      0 : Header Code[0x002700C2]
578          *      1 : u32, NsDataID
579          *      2 : u8, type
580          *      3 : u32, Size
581          *      4 : MappedBufferDesc(permission = W)
582          *      5 : u32 buff_addr
583          *  Outputs:
584          *      1 : Result of function, 0 on success, otherwise error code
585          *      2 : buff_size << 4 | 0xC
586          *      3 : u32, buff_addr
587          */
588         void GetNsDataHeaderInfo(Kernel::HLERequestContext& ctx);
589 
590         /**
591          * BOSS::ReadNsData service function
592          *  Inputs:
593          *      0 : Header Code[0x00280102]
594          *      1 : u32, NsDataID
595          *    2-3 : u64, offset
596          *      4 : u32, Size
597          *      5 : MappedBufferDesc(permission = W)
598          *      6 : u32, buff_addr
599          *  Outputs:
600          *      1 : Result of function, 0 on success, otherwise error code
601          *      2 : u32 Actual read size
602          *      3 : u32, unknown value
603          *      4 : buff_size << 4 | 0xC
604          *      5 : u32, buff_addr
605          */
606         void ReadNsData(Kernel::HLERequestContext& ctx);
607 
608         /**
609          * BOSS::SetNsDataAdditionalInfo service function
610          *  Inputs:
611          *      0 : Header Code[0x00290080]
612          *      1 : u32 unknown value
613          *      2 : u32 unknown value
614          *  Outputs:
615          *      1 : Result of function, 0 on success, otherwise error code
616          */
617         void SetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx);
618 
619         /**
620          * BOSS::GetNsDataAdditionalInfo service function
621          *  Inputs:
622          *      0 : Header Code[0x002A0040]
623          *      1 : u32 unknown value
624          *  Outputs:
625          *      1 : Result of function, 0 on success, otherwise error code
626          *      2 : u32 unknown value
627          */
628         void GetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx);
629 
630         /**
631          * BOSS::SetNsDataNewFlag service function
632          *  Inputs:
633          *      0 : Header Code[0x002B0080]
634          *      1 : u32 unknown value
635          *      2 : u8 flag
636          *  Outputs:
637          *      1 : Result of function, 0 on success, otherwise error code
638          */
639         void SetNsDataNewFlag(Kernel::HLERequestContext& ctx);
640 
641         /**
642          * BOSS::GetNsDataNewFlag service function
643          *  Inputs:
644          *      0 : Header Code[0x002C0040]
645          *      1 : u32 unknown value
646          *  Outputs:
647          *      1 : Result of function, 0 on success, otherwise error code
648          *      2 : u8 flag
649          */
650         void GetNsDataNewFlag(Kernel::HLERequestContext& ctx);
651 
652         /**
653          * BOSS::GetNsDataLastUpdate service function
654          *  Inputs:
655          *      0 : Header Code[0x002D0040]
656          *      1 : u32 unknown value
657          *  Outputs:
658          *      1 : Result of function, 0 on success, otherwise error code
659          *      2 : u32 unknown value
660          *      3 : u32 unknown value
661          */
662         void GetNsDataLastUpdate(Kernel::HLERequestContext& ctx);
663 
664         /**
665          * BOSS::GetErrorCode service function
666          *  Inputs:
667          *      0 : Header Code[0x002E0040]
668          *      1 : u8 input
669          *  Outputs:
670          *      1 : Result of function, 0 on success, otherwise error code
671          *      2 : u32 unknown value
672          */
673         void GetErrorCode(Kernel::HLERequestContext& ctx);
674 
675         /**
676          * BOSS::RegisterStorageEntry service function
677          *  Inputs:
678          *      0 : Header Code[0x002F0140]
679          *      1 : u32 unknown value
680          *      2 : u32 unknown value
681          *      3 : u32 unknown value
682          *      4 : u16 unknown value
683          *      5 : u8 unknown value
684          *  Outputs:
685          *      1 : Result of function, 0 on success, otherwise error code
686          */
687         void RegisterStorageEntry(Kernel::HLERequestContext& ctx);
688 
689         /**
690          * BOSS::GetStorageEntryInfo service function
691          *  Inputs:
692          *      0 : Header Code[0x00300000]
693          *  Outputs:
694          *      1 : Result of function, 0 on success, otherwise error code
695          *      2 : u32 unknown value
696          *      3 : u16 unknown value
697          */
698         void GetStorageEntryInfo(Kernel::HLERequestContext& ctx);
699 
700         /**
701          * BOSS::SetStorageOption service function
702          *  Inputs:
703          *      0 : Header Code[0x00310100]
704          *      1 : u8 unknown value
705          *      2 : u32 unknown value
706          *      3 : u16 unknown value
707          *      4 : u16 unknown value
708          *  Outputs:
709          *      1 : Result of function, 0 on success, otherwise error code
710          */
711         void SetStorageOption(Kernel::HLERequestContext& ctx);
712 
713         /**
714          * BOSS::GetStorageOption service function
715          *  Inputs:
716          *      0 : Header Code[0x00320000]
717          *  Outputs:
718          *      1 : Result of function, 0 on success, otherwise error code
719          *      2 : u8 unknown value
720          *      3 : u32 unknown value
721          *      4 : u16 unknown value
722          *      5 : u16 unknown value
723          */
724         void GetStorageOption(Kernel::HLERequestContext& ctx);
725 
726         /**
727          * BOSS::StartBgImmediate service function
728          *  Inputs:
729          *      0 : Header Code[0x00330042]
730          *      1 : TaskID buffer size
731          *      2 : MappedBufferDesc(permission = R)
732          *      3 : u32, buff_addr
733          *  Outputs:
734          *      1 : Result of function, 0 on success, otherwise error code
735          *      2 : buff_size << 4 | 0xA
736          *      3 : u32, buff_addr
737          */
738         void StartBgImmediate(Kernel::HLERequestContext& ctx);
739 
740         /**
741          * BOSS::GetTaskProperty0 service function
742          *  Inputs:
743          *      0 : Header Code[0x00340042]
744          *      1 : u32 size
745          *      2 : MappedBufferDesc(permission = R)
746          *      3 : u32 buff_addr
747          *  Outputs:
748          *      1 : Result of function, 0 on success, otherwise error code
749          *      2 : u8 current state
750          *      3 : buff_size << 4 | 0xA
751          *      4 : u32 buff_addr
752          */
753         void GetTaskProperty0(Kernel::HLERequestContext& ctx);
754 
755         /**
756          * BOSS::RegisterImmediateTask service function
757          *  Inputs:
758          *      0 : Header Code[0x003500C2]
759          *      1 : u32 size
760          *      2 : u8 unknown value
761          *      3 : u8 unknown value
762          *      4 : MappedBufferDesc(permission = R)
763          *      5 : u32 buff_addr
764          *  Outputs:
765          *      1 : Result of function, 0 on success, otherwise error code
766          *      2 : buff_size << 4 | 0xA
767          *      3 : u32 buff_addr
768          */
769         void RegisterImmediateTask(Kernel::HLERequestContext& ctx);
770 
771         /**
772          * BOSS::SetTaskQuery service function
773          *  Inputs:
774          *      0 : Header Code[0x00360084]
775          *      1 : u32 buffer1 size
776          *      2 : u32 buffer2 size
777          *      3 : MappedBufferDesc1(permission = R)
778          *      4 : u32 buff1_addr
779          *      5 : MappedBufferDesc2(permission = R)
780          *      6 : u32 buff2_addr
781          *  Outputs:
782          *      1 : Result of function, 0 on success, otherwise error code
783          *      2 : buff1_size << 4 | 0xA
784          *      3 : u32 buff1_addr
785          *      4 : buff2_size << 4 | 0xA
786          *      5 : u32 buff2_addr
787          */
788         void SetTaskQuery(Kernel::HLERequestContext& ctx);
789 
790         /**
791          * BOSS::GetTaskQuery service function
792          *  Inputs:
793          *      0 : Header Code[0x00370084]
794          *      1 : u32 buffer1 size
795          *      2 : u32 buffer2 size
796          *      3 : MappedBufferDesc1(permission = R)
797          *      4 : u32 buff1_addr
798          *      5 : MappedBufferDesc2(permission = W)
799          *      6 : u32 buff2_addr
800          *  Outputs:
801          *      1 : Result of function, 0 on success, otherwise error code
802          *      2 : buff1_size << 4 | 0xA
803          *      3 : u32 buff1_addr
804          *      4 : buff2_size << 4 | 0xC
805          *      5 : u32 buff2_addr
806          */
807         void GetTaskQuery(Kernel::HLERequestContext& ctx);
808 
809         /**
810          * BOSS_P::InitializeSessionPrivileged service function
811          *  Inputs:
812          *      0 : Header Code[0x04010082]
813          *    1-2 : programID, normally zero for using the programID determined from the input PID
814          *      3 : 0x20, ARM11-kernel processID translate-header.
815          *  Outputs:
816          *      1 : Result of function, 0 on success, otherwise error code
817          */
818         void InitializeSessionPrivileged(Kernel::HLERequestContext& ctx);
819 
820         /**
821          * BOSS_P::GetAppNewFlag service function
822          *  Inputs:
823          *      0 : Header Code[0x04040080]
824          *    1-2 : u64 ProgramID
825          *  Outputs:
826          *      1 : Result of function, 0 on success, otherwise error code
827          *      2 : u8 flag, 0 = nothing new, 1 = new content
828          */
829         void GetAppNewFlag(Kernel::HLERequestContext& ctx);
830 
831         /**
832          * BOSS_P::GetNsDataIdListPrivileged service function
833          *  Inputs:
834          *      0 : Header Code[0x040D0182]
835          *    1-2 : u64 ProgramID
836          *      3 : u32 filter
837          *      4 : u32 Buffer size in words(max entries)
838          *      5 : u16, starting word-index in the internal NsDataId list
839          *      6 : u32, start_NsDataId
840          *      7 : MappedBufferDesc(permission = W)
841          *      8 : u32 buff_addr
842          *  Outputs:
843          *      1 : Result of function, 0 on success, otherwise error code
844          *      2 : u16 Actual number of output entries
845          *      3 : u16 Last word-index copied to output in the internal NsDataId list
846          *      4 : buff_size << 4 | 0xC
847          *      5 : u32 buff_addr
848          */
849         void GetNsDataIdListPrivileged(Kernel::HLERequestContext& ctx);
850 
851         /**
852          * BOSS_P::GetNsDataIdListPrivileged1 service function
853          *  Inputs:
854          *      0 : Header Code[0x040E0182]
855          *    1-2 : u64 ProgramID
856          *      3 : u32 filter
857          *      4 : u32 Buffer size in words(max entries)
858          *      5 : u16, starting word-index in the internal NsDataId list
859          *      6 : u32, start_NsDataId
860          *      7 : MappedBufferDesc(permission = W)
861          *      8 : u32 buff_addr
862          *  Outputs:
863          *      1 : Result of function, 0 on success, otherwise error code
864          *      2 : u16 Actual number of output entries
865          *      3 : u16 Last word-index copied to output in the internal NsDataId list
866          *      4 : buff_size << 4 | 0xC
867          *      5 : u32 buff_addr
868          */
869         void GetNsDataIdListPrivileged1(Kernel::HLERequestContext& ctx);
870 
871         /**
872          * BOSS_P::SendPropertyPrivileged service function
873          *  Inputs:
874          *      0 : Header Code[0x04130082]
875          *      1 : u16 PropertyID
876          *      2 : u32 size
877          *      3 : MappedBufferDesc(permission = R)
878          *      4 : u32 buff_addr
879          *  Outputs:
880          *      1 : Result of function, 0 on success, otherwise error code
881          *      2 : buff_size << 4 | 0xA
882          *      3 : u32 buff_addr
883          */
884         void SendPropertyPrivileged(Kernel::HLERequestContext& ctx);
885 
886         /**
887          * BOSS_P::DeleteNsDataPrivileged service function
888          *  Inputs:
889          *      0 : Header Code[0x041500C0]
890          *    1-2 : u64 ProgramID
891          *      3 : u32 NsDataID
892          *  Outputs:
893          *      1 : Result of function, 0 on success, otherwise error code
894          */
895         void DeleteNsDataPrivileged(Kernel::HLERequestContext& ctx);
896 
897         /**
898          * BOSS_P::GetNsDataHeaderInfoPrivileged service function
899          *  Inputs:
900          *      0 : Header Code[0x04160142]
901          *    1-2 : u64 ProgramID
902          *      3 : u32, NsDataID
903          *      4 : u8, type
904          *      5 : u32, Size
905          *      6 : MappedBufferDesc(permission = W)
906          *      7 : u32 buff_addr
907          *  Outputs:
908          *      1 : Result of function, 0 on success, otherwise error code
909          *      2 : buff_size << 4 | 0xC
910          *      3 : u32, buff_addr
911          */
912         void GetNsDataHeaderInfoPrivileged(Kernel::HLERequestContext& ctx);
913 
914         /**
915          * BOSS_P::ReadNsDataPrivileged service function
916          *  Inputs:
917          *      0 : Header Code[0x04170182]
918          *    1-2 : u64 ProgramID
919          *      3 : u32, NsDataID
920          *    4-5 : u64, offset
921          *      6 : u32, Size
922          *      7 : MappedBufferDesc(permission = W)
923          *      8 : u32, buff_addr
924          *  Outputs:
925          *      1 : Result of function, 0 on success, otherwise error code
926          *      2 : u32 Actual read size
927          *      3 : u32, unknown value
928          *      4 : buff_size << 4 | 0xC
929          *      5 : u32, buff_addr
930          */
931         void ReadNsDataPrivileged(Kernel::HLERequestContext& ctx);
932 
933         /**
934          * BOSS_P::SetNsDataNewFlagPrivileged service function
935          *  Inputs:
936          *      0 : Header Code[0x041A0100]
937          *    1-2 : u64 ProgramID
938          *      3 : u32 unknown value
939          *      4 : u8 flag
940          *  Outputs:
941          *      1 : Result of function, 0 on success, otherwise error code
942          */
943         void SetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ctx);
944 
945         /**
946          * BOSS_P::GetNsDataNewFlagPrivileged service function
947          *  Inputs:
948          *      0 : Header Code[0x041B00C0]
949          *    1-2 : u64 ProgramID
950          *      3 : u32 unknown value
951          *  Outputs:
952          *      1 : Result of function, 0 on success, otherwise error code
953          *      2 : u8 flag
954          */
955         void GetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ctx);
956 
957     protected:
958         std::shared_ptr<Module> boss;
959 
960     private:
961         u8 new_arrival_flag;
962         u8 ns_data_new_flag;
963         u8 ns_data_new_flag_privileged;
964         u8 output_flag;
965 
966         template <class Archive>
serialize(Archive & ar,const unsigned int)967         void serialize(Archive& ar, const unsigned int) {
968             ar& new_arrival_flag;
969             ar& ns_data_new_flag;
970             ar& ns_data_new_flag_privileged;
971             ar& output_flag;
972         }
973         friend class boost::serialization::access;
974     };
975 
976 private:
977     std::shared_ptr<Kernel::Event> task_finish_event;
978 
979     template <class Archive>
serialize(Archive & ar,const unsigned int)980     void serialize(Archive& ar, const unsigned int) {
981         ar& task_finish_event;
982     }
983     friend class boost::serialization::access;
984 };
985 
986 void InstallInterfaces(Core::System& system);
987 
988 } // namespace Service::BOSS
989 
990 namespace boost::serialization {
991 template <class Archive>
load_construct_data(Archive & ar,Service::BOSS::Module * t,const unsigned int)992 void load_construct_data(Archive& ar, Service::BOSS::Module* t, const unsigned int) {
993     ::new (t) Service::BOSS::Module(Core::Global<Core::System>());
994 }
995 } // namespace boost::serialization
996