From 830ba1bf77492eb259dad9dea3d9531b51376009 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 12 Feb 2011 18:22:37 +0200 Subject: [PATCH] loader: unmix wiz start/select, pnd root check --- loader/emu.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/loader/emu.c b/loader/emu.c index dd507ff..2c64aa6 100644 --- a/loader/emu.c +++ b/loader/emu.c @@ -1,4 +1,8 @@ // vim:shiftwidth=2:expandtab +// a "gentle" reminder +#ifdef __ARM_EABI__ +#error loader is meant to be OABI! +#endif #include #include #include @@ -438,7 +442,8 @@ static u32 xread32_io_cmn(u32 a, u32 *handled) // ???? ???? YXBA DURiLe ???? VdVuMS LR?? ???? // | GPIOC[31:16] | GPIOB[31:16] | case 0xa058: // GPIOBPAD - d = pollux.btn_state & 0x0300; + d = (pollux.btn_state >> 1) & 0x0100; + d |= (pollux.btn_state << 1) & 0x0200; d |= (pollux.btn_state >> 3) & 0x0080; d |= (pollux.btn_state >> 5) & 0x0040; d |= (pollux.btn_state >> 6) & 0x0c00; @@ -925,6 +930,14 @@ void emu_init(void *map_bottom) void *pret; int ret; +#ifdef PND + if (geteuid() == 0) { + fprintf(stderr, "don't try to run as root, device registers or memory " + "might get trashed crashing the OS or even damaging the device.\n"); + exit(1); + } +#endif + g_linkpage = (void *)(((u32)map_bottom - LINKPAGE_ALLOC) & ~0xfff); pret = mmap(g_linkpage, LINKPAGE_ALLOC, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0); -- 2.39.5