mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-30 23:24:19 +01:00
Added boot2_run IPC code
Cleaned up ipc.h a little and removed unused IPC_MISC stuff
This commit is contained in:
parent
de1284379d
commit
bb683c50a2
19
boot2.c
19
boot2.c
@ -41,7 +41,7 @@ void boot2_init() {
|
|||||||
|
|
||||||
for (i = 0x40; i < 0x140; i++, ptr += 2048) {
|
for (i = 0x40; i < 0x140; i++, ptr += 2048) {
|
||||||
nand_read_page(i, ptr, ecc);
|
nand_read_page(i, ptr, ecc);
|
||||||
__nand_wait();
|
nand_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->len != sizeof(struct wadheader))
|
if (hdr->len != sizeof(struct wadheader))
|
||||||
@ -104,13 +104,14 @@ int boot2_run(u32 tid_hi, u32 tid_lo) {
|
|||||||
patch[2] = tid_hi;
|
patch[2] = tid_hi;
|
||||||
patch[3] = tid_lo;
|
patch[3] = tid_lo;
|
||||||
|
|
||||||
|
gecko_printf("booting boot2 with title 0x%08x, 0x%08x\n", tid_hi, tid_lo);
|
||||||
powerpc_hang();
|
powerpc_hang();
|
||||||
memcpy((void *)0x11000000, boot2, sizeof boot2);
|
memcpy((void *)0x11000000, boot2, sizeof boot2);
|
||||||
ptr = (void *)0x11000000 + hdr->hdrsize + hdr->loadersize;
|
ptr = (void *)0x11000000 + hdr->hdrsize + hdr->loadersize;
|
||||||
for (i = 0; i < sizeof(boot2); i += 1) {
|
for (i = 0; i < sizeof(boot2); i += 1) {
|
||||||
if (memcmp(ptr+i, match, sizeof(match)) == 0) {
|
if (memcmp(ptr+i, match, sizeof(match)) == 0) {
|
||||||
memcpy(ptr+i, patch, sizeof(patch));
|
memcpy(ptr+i, patch, sizeof(patch));
|
||||||
gecko_printf("patched data @%08x\n", ptr+i);
|
gecko_printf("patched data @%08x\n", (u32)ptr+i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,3 +121,17 @@ int boot2_run(u32 tid_hi, u32 tid_lo) {
|
|||||||
gecko_printf("boot2 is at %p\n", vector);
|
gecko_printf("boot2 is at %p\n", vector);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void boot2_ipc(volatile ipc_request *req)
|
||||||
|
{
|
||||||
|
u32 ret = 0;
|
||||||
|
|
||||||
|
switch (req->req) {
|
||||||
|
case IPC_BOOT2_RUN:
|
||||||
|
ret = boot2_run((u32)req->args[0], (u32)req->args[1]);
|
||||||
|
ipc_post(req->code, req->tag, 1, ret);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gecko_printf("IPC: unknown SLOW BOOT2 request %04X\n", req->req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
1
boot2.h
1
boot2.h
@ -1,6 +1,7 @@
|
|||||||
#ifndef __BOOT2_H__
|
#ifndef __BOOT2_H__
|
||||||
#define __BOOT2_H__
|
#define __BOOT2_H__
|
||||||
|
|
||||||
|
void boot2_ipc(volatile ipc_request *req);
|
||||||
int boot2_run(u32 tid_hi, u32 tid_lo);
|
int boot2_run(u32 tid_hi, u32 tid_lo);
|
||||||
void boot2_init();
|
void boot2_init();
|
||||||
|
|
||||||
|
4
ipc.c
4
ipc.c
@ -9,6 +9,7 @@
|
|||||||
#include "nand.h"
|
#include "nand.h"
|
||||||
#include "sdhc.h"
|
#include "sdhc.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
|
#include "boot2.h"
|
||||||
|
|
||||||
static volatile ipc_request in_queue[IPC_IN_SIZE] ALIGNED(32) MEM2_BSS;
|
static volatile ipc_request in_queue[IPC_IN_SIZE] ALIGNED(32) MEM2_BSS;
|
||||||
static volatile ipc_request out_queue[IPC_OUT_SIZE] ALIGNED(32) MEM2_BSS;
|
static volatile ipc_request out_queue[IPC_OUT_SIZE] ALIGNED(32) MEM2_BSS;
|
||||||
@ -106,6 +107,9 @@ static int process_slow(volatile ipc_request *req)
|
|||||||
case IPC_DEV_AES:
|
case IPC_DEV_AES:
|
||||||
aes_ipc(req);
|
aes_ipc(req);
|
||||||
break;
|
break;
|
||||||
|
case IPC_DEV_BOOT2:
|
||||||
|
boot2_ipc(req);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
gecko_printf("IPC: unknown SLOW request %02x-%04x\n", req->device, req->req);
|
gecko_printf("IPC: unknown SLOW request %02x-%04x\n", req->device, req->req);
|
||||||
}
|
}
|
||||||
|
4
ipc.h
4
ipc.h
@ -11,7 +11,7 @@
|
|||||||
#define IPC_DEV_SD 0x02
|
#define IPC_DEV_SD 0x02
|
||||||
#define IPC_DEV_KEYS 0x03
|
#define IPC_DEV_KEYS 0x03
|
||||||
#define IPC_DEV_AES 0x04
|
#define IPC_DEV_AES 0x04
|
||||||
#define IPC_DEV_MISC 0x10
|
#define IPC_DEV_BOOT2 0x05
|
||||||
|
|
||||||
#define IPC_SYS_PING 0x0000
|
#define IPC_SYS_PING 0x0000
|
||||||
#define IPC_SYS_JUMP 0x0001
|
#define IPC_SYS_JUMP 0x0001
|
||||||
@ -51,7 +51,7 @@
|
|||||||
#define IPC_AES_SETKEY 0x0002
|
#define IPC_AES_SETKEY 0x0002
|
||||||
#define IPC_AES_DECRYPT 0x0003
|
#define IPC_AES_DECRYPT 0x0003
|
||||||
|
|
||||||
#define IPC_MISC_BACKUP_DOBLOCK 0x0001
|
#define IPC_BOOT2_RUN 0x0000
|
||||||
|
|
||||||
#define IPC_CODE (f,d,r) (((f)<<24)|((d)<<16)|(r))
|
#define IPC_CODE (f,d,r) (((f)<<24)|((d)<<16)|(r))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user