From: notaz Date: Sat, 12 Feb 2011 16:22:37 +0000 (+0200) Subject: loader: unmix wiz start/select, pnd root check X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=830ba1bf77492eb259dad9dea3d9531b51376009;p=ginge.git loader: unmix wiz start/select, pnd root check --- 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);