launch.c
18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
#include <PR/bcp.h>
#include <PR/R4300.h>
#include <PR/bbsim.h>
#include <PR/bbskapi.h>
#include <PR/os.h>
#include <PR/os_bb.h>
#include <PR/os_bbfs.h>
#include <PR/os_bbatb.h>
#include <PR/os_bbexec.h>
#include <PR/ramrom.h>
#include <PR/os_bbsa.h>
#include <libfb.h>
#include "launch.h"
#define ALIGN_DCACHE __attribute__((aligned(DCACHE_LINESIZE)))
#define printstr fbPrintf
static u32 gMiSecModeRegEntryVal;
OSBbSaTickets gTickets ALIGN_DCACHE;
OSBbSaGameMetaData gGameMeta[32];
extern u32 __osBbHackFlags;
u8 certBuf[16384] ALIGN_DCACHE;
u8 rlBuf[16384] ALIGN_DCACHE;
/*
* debug print support
*/
#undef PRINTF
#ifdef DEBUG
#define PRINTF osSyncPrintf
#else
#define PRINTF(format, args...)
#endif
#define fbhBlue GPACK_RGBA5551(0,0,80,1)
#define fbhGreen GPACK_RGBA5551(0,80,0,1)
#define fbhRed GPACK_RGBA5551(80,0,0,1)
#define fbhYellow GPACK_RGBA5551(80,80,0,1)
#define fbhMagenta GPACK_RGBA5551(80,0,80,1)
#define fbhCyan GPACK_RGBA5551(0,80,80,1)
#define fbLemonChiffon GPACK_RGBA5551(255,250,205,1)
#define fbLightSlateBlue GPACK_RGBA5551(132,112,255,1)
#define fbLightPink1 GPACK_RGBA5551(255,174,185,1)
#define fbThistle2 GPACK_RGBA5551(238,210,238,1)
#define fbSeaGreen4 GPACK_RGBA5551(105,139,105,1)
#define fbTomato1 GPACK_RGBA5551(255,99,71,1)
#define fbTurquoise2 GPACK_RGBA5551(0,229,238,1)
#define fbSienna4 GPACK_RGBA5551(139,71,38,1)
/*
* Thread and stack structures
*/
char bootStack[STACKSIZE] __attribute__ ((aligned (8)));
static OSThread idleThread;
static char idleThreadStack[STACKSIZE] __attribute__ ((aligned (8)));
static OSThread mainThread;
static char mainThreadStack[STACKSIZE] __attribute__ ((aligned (8)));
/*
* FS specific definitions
*/
static void idleproc(char *);
static void mainproc(char *);
static OSBbFs gFs; /* too big to plop on the stack */
/* XXX: hard-coded size requires more consideration */
#define BB_SYSAPP_NUM_DIR_ENTRIES 256
static OSBbDirEnt gFsDirs[BB_SYSAPP_NUM_DIR_ENTRIES];
static const char gTicketFname[] = "ticket.sys";
#define BB_SYSAPP_CERT_BUF_SIZE (16*1024*4)
static u8 gCertBuf[BB_SYSAPP_CERT_BUF_SIZE] ALIGN_DCACHE;
#define BB_SYSAPP_RL_BUF_SIZE (16*1024*4)
static u8 gRlBuf[BB_SYSAPP_RL_BUF_SIZE] ALIGN_DCACHE;
#define DMA_QUEUE_SIZE 200
static OSMesg PiMessages[DMA_QUEUE_SIZE];
static OSMesgQueue PiMessageQ;
static OSMesg SiMessages[DMA_QUEUE_SIZE];
static OSMesgQueue SiMessageQ;
/*
* simple graphics
*/
static OSMesgQueue retraceMessageQ;
static OSMesg dummyMessage, retraceMessageBuf;
static u16 cfb[320*240] __attribute__((aligned(64)));
/*
* controller
*/
static OSMesgQueue contMessageQ;
OSContStatus statusData[MAXCONTROLLERS];
OSContPad controllerData[MAXCONTROLLERS];
static u16 lastbutton[MAXCONTROLLERS];
static int no_controller = 1;
int gBeginTest = 0;
static void
initController(void)
{
int i, c = 0;
u8 pattern;
if (__osBbIsBb<2)
__osBbHackFlags = 1;
else
__osBbHackFlags = 0;
osCreateMesgQueue(&contMessageQ, &dummyMessage, 1);
osSetEventMesg(OS_EVENT_SI, &contMessageQ, (OSMesg) 0);
osContInit(&contMessageQ, &pattern, &statusData[0]);
for (i = 0; i < MAXCONTROLLERS; i++) {
if ((pattern & (1 << i)) &&
!(statusData[i].errno & CONT_NO_RESPONSE_ERROR)) {
++c;
no_controller = 0;
}
}
}
static void
processButton(u16 button, int lastbutton)
{
if (button & D_JPAD && !(lastbutton & D_JPAD)) {
// pad down
}
if (button & U_JPAD && !(lastbutton & U_JPAD)) {
// pad up
}
// output anything changing here
if ((button & A_BUTTON && !(lastbutton & A_BUTTON)) ||
(button & START_BUTTON && !(lastbutton & START_BUTTON))){
// start or A button pressed
gBeginTest = 1;
}
}
static void
readControllers(void)
{
int i;
OSContPad *pad;
osRecvMesg(&contMessageQ, &dummyMessage, OS_MESG_BLOCK);
osContGetReadData(controllerData);
for (i = 0; i < MAXCONTROLLERS; ++i) {
pad = &controllerData[i];
if (!pad->errno && pad->button != lastbutton[i]) {
processButton(pad->button, lastbutton[i]);
lastbutton[i] = pad->button;
}
}
}
void __osBbVideoPllInit(u32);
void boot(u32 miSecModeRegVal)
{
gMiSecModeRegEntryVal = miSecModeRegVal;
/* Init the video PLL */
__osBbVideoPllInit(OS_TV_NTSC);
osInitialize();
osCreateThread(&idleThread, 1, (void(*)(void *))idleproc, (void *)0,
idleThreadStack+STACKSIZE, 8);
osStartThread(&idleThread);
}
static void
idleproc(char *argv) /* priority 8 */
{
osCreateViManager(OS_PRIORITY_VIMGR);
fbInit(FB_LOW_RES);
#ifdef DEBUG
/* should allow usb printing */
osBbUsbInit();
#endif
/*
* Start PI Mgr for access to cartridge - start before the debugger
*/
osCreatePiManager((OSPri) OS_PRIORITY_PIMGR, &PiMessageQ, PiMessages,
DMA_QUEUE_SIZE);
osCreateMesgQueue(&SiMessageQ, SiMessages, DMA_QUEUE_SIZE);
osSetEventMesg(OS_EVENT_SI, &SiMessageQ, (OSMesg)DMA_QUEUE_SIZE);
/*
* The main thread's priority must be the same or lower than the original
* idle's thread priority. This allows the idle thread to change its
* priority to 0 before the main thread starts execution.
*/
osCreateThread(&mainThread, 3, (void(*)(void *))mainproc, argv,
mainThreadStack+STACKSIZE/8, (OSPri)7);
osStartThread(&mainThread);
osSetThreadPri(0, OS_PRIORITY_IDLE);
for(;;){}
}
void pause()
{
fbPrintf(fbWhite, 5, 4, "Press A to move to next test");
osWritebackDCacheAll();
gBeginTest=0;
do {
osRecvMesg(&retraceMessageQ, NULL, OS_MESG_BLOCK);
osContStartReadData(&contMessageQ);
readControllers();
}while(!gBeginTest);
fbPrintf(fbWhite, 5, 4, "performing test ");
fbPrintf(fbhGreen, 10, 8, " ");
osWritebackDCacheAll();
}
void reportResult(int pass)
{
if(pass){
fbPrintf(fbhGreen, 10, 8, "PASS");
}
else{
fbPrintf(fbhRed, 10, 8, "FAIL");
}
osWritebackDCacheAll();
}
#define LAUNCH_TEST_ERROR -1
#define LAUNCH_TEST_FAIL 0
#define LAUNCH_TEST_INJECT_ERR_CMD_SIG 1
#define LAUNCH_TEST_INJECT_ERR_TIK_SIG 2
int launchTest(u32 cid,int injectErr,int tryLaunch)
{
int ticketIndx, ret;
/* ticket of interest */
for(ticketIndx=0; ticketIndx<gTickets.numTickets; ticketIndx++)
if(cid == (u32)gTickets.ticket[ticketIndx].cmd.head.id)
break;
if(ticketIndx>=gTickets.numTickets)
return LAUNCH_TEST_ERROR;
if(injectErr==LAUNCH_TEST_INJECT_ERR_CMD_SIG){
gTickets.ticket[ticketIndx].cmd.head.contentMetaDataSign[0]++;
}
else if(injectErr==LAUNCH_TEST_INJECT_ERR_TIK_SIG){
gTickets.ticket[ticketIndx].head.ticketSign[0]++;
}
osBbSaCertInit();
ret = osBbSaGamePrelaunch(&(gTickets.ticket[ticketIndx]));
if(injectErr==LAUNCH_TEST_INJECT_ERR_CMD_SIG){
gTickets.ticket[ticketIndx].cmd.head.contentMetaDataSign[0]--;
}
else if(injectErr==LAUNCH_TEST_INJECT_ERR_TIK_SIG){
gTickets.ticket[ticketIndx].head.ticketSign[0]--;
}
if(tryLaunch){
if(ret!=SALAUNCH_OK)
return LAUNCH_TEST_ERROR;
osBbSaGameLaunch(&gGameMeta[ticketIndx].launch);
return LAUNCH_TEST_FAIL;
}
else{
if(ret==SALAUNCH_OK || ret==SALAUNCH_PERSONALIZE)
return LAUNCH_TEST_ERROR;
return LAUNCH_TEST_FAIL;
}
return LAUNCH_TEST_ERROR;
}
int createCertSigError(char *certName)
{
s32 fsret,fd;
OSBbStatBuf fsStat;
BbRsaCert *cert;
int i,numCerts;
/* alter sigs for failure test */
osBbFRename("cert.sys","_cert.sys");
fd = osBbFOpen("_cert.sys","r");
if(fd<0){
return -1;
}
fsret = osBbFStat(fd, &fsStat, NULL, 0);
if(fsret !=0)
return -1;
if(fsStat.size >= sizeof gCertBuf)
return -1;
if(osBbFRead(fd, 0, gCertBuf, fsStat.size)<0){
osBbFClose(fd);
return -1;
}
osBbFClose(fd);
numCerts=*(u32 *)gCertBuf;
for(i=0, cert=(BbRsaCert *)(gCertBuf+4);
i<numCerts && strcmp(cert->certId.name.server,certName);
i++, cert++){}
if(i==numCerts)
return -1;
(cert->signature.rsa2048)[0] ++;
fd=osBbFCreate("cert.sys",1,fsStat.size);
if(fd<0){
return -1;
}
osBbFWrite(fd,0,gCertBuf,fsStat.size);
osBbFClose(fd);
return 0;
}
int twiddleAppByte(char *app,u32 offset)
{
s32 fsret,fd;
OSBbStatBuf fsStat;
fd = osBbFOpen(app,"rw");
if(fd<0){
return -1;
}
fsret = osBbFStat(fd, &fsStat, NULL, 0);
if(fsStat.size<=offset)
return -1;
if(osBbFRead(fd, offset&(~(16384-1)), gCertBuf, 16384)<0){
osBbFClose(fd);
return -1;
}
gCertBuf[offset&(16384-1)]^=1;
if(osBbFWrite(fd, offset&(~(16384-1)), gCertBuf, 16384)<0){
osBbFClose(fd);
return -1;
}
osBbFClose(fd);
return 0;
}
void mainproc(char *argv)
{
int ret, ticketIndx;
u32 cid;
s32 fsret;
BbTicketBundle ticketBundle;
BbAppLaunchCrls appRls;
/* setup text output to screen */
osCreateMesgQueue(&retraceMessageQ, &retraceMessageBuf, 1);
osViSetEvent(&retraceMessageQ, dummyMessage, 1);
osViBlack(1);
osViSwapBuffer(cfb);
fbSetBg(fbBlack);
fbClear();
osViBlack(0);
osWritebackDCacheAll();
osViSwapBuffer(cfb);
fbClear();
initController();
printstr(fbWhite, 3, 2, "Launch Test");
osWritebackDCacheAll();
if(osBbFInit(&gFs)<0){
goto exit;
}
fsret = osBbFReadDir(gFsDirs, BB_SYSAPP_NUM_DIR_ENTRIES);
if(fsret<0){
goto exit;
}
osBbSaMetaGetTickets(&gTickets);
osBbSaMetaGetData(&gTickets,gGameMeta);
pause();
/* ptr checks for skLaunchSetup() */
ret=0;
fbPrintf(fbWhite, 5, 6, "Conducting ptr checks ");
osWritebackDCacheAll();
/* checks go here. set ret=0 if one fails */
cid = 0x00020004;
for(ticketIndx=0; ticketIndx<gTickets.numTickets; ticketIndx++)
if(cid == (u32)gTickets.ticket[ticketIndx].cmd.head.id)
break;
if((ticketIndx < gTickets.numTickets) &&
(BB_SYSAPP_PASS == osBbSaBundleTicket(&(gTickets.ticket[ticketIndx]),
&ticketBundle, &appRls))){
do{
void *tmp;
#define UPPER_MEM_LIMIT(a) (0x80800000 - (sizeof (a) + 4))
#define LOWER_MEM_LIMIT(a) (0x80000000 - (sizeof (a) + 4))
/* initial sanity check */
if(SK_API_SUCCESS != skLaunchSetup(&ticketBundle, &appRls, rlBuf))
break;
/* ticket bundle ptr */
if(SK_API_SUCCESS == skLaunchSetup(
(void *) UPPER_MEM_LIMIT(ticketBundle), &appRls, rlBuf))
break;
if(SK_API_SUCCESS == skLaunchSetup(
(void *) LOWER_MEM_LIMIT(ticketBundle), &appRls, rlBuf))
break;
/* the ticket */
tmp = ticketBundle.ticket;
ticketBundle.ticket =
(void *)(UPPER_MEM_LIMIT(ticketBundle.ticket));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.ticket = tmp;
break;
}
ticketBundle.ticket =
(void *)(LOWER_MEM_LIMIT(ticketBundle.ticket));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.ticket = tmp;
break;
}
ticketBundle.ticket = tmp;
/* the ticket chain */
tmp = ticketBundle.ticketChain[0];
ticketBundle.ticketChain[0] =
(void *)(UPPER_MEM_LIMIT(ticketBundle.ticketChain[0]));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.ticketChain[0] = tmp;
break;
}
ticketBundle.ticketChain[0] =
(void *)(LOWER_MEM_LIMIT(ticketBundle.ticketChain[0]));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.ticketChain[0] = tmp;
break;
}
ticketBundle.ticketChain[0] = tmp;
tmp = ticketBundle.ticketChain[1];
ticketBundle.ticketChain[1] =
(void *)(UPPER_MEM_LIMIT(ticketBundle.ticketChain[1]));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.ticketChain[1] = tmp;
break;
}
ticketBundle.ticketChain[1] =
(void *)(LOWER_MEM_LIMIT(ticketBundle.ticketChain[1]));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.ticketChain[1] = tmp;
break;
}
ticketBundle.ticketChain[1] = tmp;
/* the cmd chain */
tmp = ticketBundle.cmdChain[0];
ticketBundle.cmdChain[0] =
(void *)(UPPER_MEM_LIMIT(ticketBundle.cmdChain[0]));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.cmdChain[0] = tmp;
break;
}
ticketBundle.cmdChain[0] =
(void *)(LOWER_MEM_LIMIT(ticketBundle.cmdChain[0]));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.cmdChain[0] = tmp;
break;
}
ticketBundle.cmdChain[0] = tmp;
tmp = ticketBundle.cmdChain[1];
ticketBundle.cmdChain[1] =
(void *)(UPPER_MEM_LIMIT(ticketBundle.cmdChain[1]));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.cmdChain[1] = tmp;
break;
}
ticketBundle.cmdChain[1] =
(void *)(LOWER_MEM_LIMIT(ticketBundle.cmdChain[1]));
if(SK_API_SUCCESS == skLaunchSetup(&ticketBundle, &appRls, rlBuf)){
ticketBundle.cmdChain[1] = tmp;
break;
}
ticketBundle.cmdChain[1] = tmp;
/* appRls ptr */
if(SK_API_SUCCESS == skLaunchSetup(
&ticketBundle, (void *) UPPER_MEM_LIMIT(appRls), rlBuf))
break;
if(SK_API_SUCCESS == skLaunchSetup(
&ticketBundle, (void *) LOWER_MEM_LIMIT(appRls), rlBuf))
break;
/* Keylist ptr */
if(SK_API_SUCCESS == skLaunchSetup(
&ticketBundle, &appRls, (void *)(0x80000000-4)))
break;
if(SK_API_SUCCESS == skLaunchSetup(
&ticketBundle, &appRls, (void *)(0x80800000-16380)))
break;
/* final sanity check */
if(SK_API_SUCCESS != skLaunchSetup(&ticketBundle, &appRls, rlBuf))
break;
ret = 1;
}while(0);
}
reportResult(ret);
pause();
fbPrintf(fbWhite, 5, 6, "cmd sign by xs chain ");
osWritebackDCacheAll();
ret = launchTest(0x00020001,0,0);
reportResult(ret==LAUNCH_TEST_FAIL);
pause();
fbPrintf(fbWhite, 5, 6, "xs sign by cp chain ");
osWritebackDCacheAll();
ret = launchTest(0x00020002,0,0);
reportResult(ret==LAUNCH_TEST_FAIL);
pause();
/* bbid bad */
fbPrintf(fbWhite, 5, 6, "bbid bad ");
osWritebackDCacheAll();
ret = launchTest(0x00020003,0,0);
reportResult(ret==LAUNCH_TEST_FAIL);
pause();
/* app hash bad */
fbPrintf(fbWhite, 5, 6, "app hash bad ");
osWritebackDCacheAll();
twiddleAppByte("00020004.app",0);
ret = launchTest(0x00020004,0,1);
twiddleAppByte("00020004.app",0);
if(ret==LAUNCH_TEST_FAIL){
twiddleAppByte("00020004.app",16384);
ret = launchTest(0x00020004,0,1);
twiddleAppByte("00020004.app",16384);
}
reportResult(ret==LAUNCH_TEST_FAIL);
pause();
/* cert sig errors */
if(createCertSigError("CP00000001")<0)
goto exit;
fbPrintf(fbWhite, 5, 6, "cp sig bad ");
osWritebackDCacheAll();
ret = launchTest(0x00020000,0,0);
reportResult(ret==LAUNCH_TEST_FAIL);
pause();
osBbFRename("_cert.sys","cert.sys");
if(createCertSigError("CPCA00000001")<0)
goto exit;
fbPrintf(fbWhite, 5, 6, "cpca sig bad ");
osWritebackDCacheAll();
ret = launchTest(0x00020000,0,0);
reportResult(ret==LAUNCH_TEST_FAIL);
pause();
osBbFRename("_cert.sys","cert.sys");
if(createCertSigError("XS00000001")<0)
goto exit;
fbPrintf(fbWhite, 5, 6, "xs sig bad ");
osWritebackDCacheAll();
ret = launchTest(0x00020000,0,0);
reportResult(ret==LAUNCH_TEST_FAIL);
pause();
osBbFRename("_cert.sys","cert.sys");
if(createCertSigError("XSCA00000001")<0)
goto exit;
fbPrintf(fbWhite, 5, 6, "xsca sig bad ");
osWritebackDCacheAll();
ret = launchTest(0x00020000,0,0);
reportResult(ret==LAUNCH_TEST_FAIL);
/* ticket sig errors */
osBbFRename("_cert.sys","cert.sys");
pause();
fbPrintf(fbWhite, 5, 6, "cmd sig bad ");
osWritebackDCacheAll();
ret = launchTest(0x00020000,LAUNCH_TEST_INJECT_ERR_CMD_SIG,0);
reportResult(ret==LAUNCH_TEST_FAIL);
pause();
fbPrintf(fbWhite, 5, 6, "ticket sig bad ");
osWritebackDCacheAll();
ret = launchTest(0x00020000,LAUNCH_TEST_INJECT_ERR_TIK_SIG,0 );
reportResult(ret==LAUNCH_TEST_FAIL);
osBbFRename("_cert.sys","cert.sys");
fbPrintf(fbWhite, 5, 4, " ");
fbPrintf(fbWhite, 3, 11, "All tests complete ");
osWritebackDCacheAll();
while(1){}
return;
exit:
/* power off (cannot do this since not in secure mode) */
printstr(fbWhite, 3, 12, "TEST ERROR!!!");
osWritebackDCacheAll();
while(1){}
return;
}