notaz.gp2x.de
/
ginge.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cc559d9
)
loader: unmix wiz start/select, pnd root check
author
notaz
<notaz@pixelinis>
Sat, 12 Feb 2011 16:22:37 +0000
(18:22 +0200)
committer
notaz
<notaz@pixelinis>
Sat, 12 Feb 2011 16:22:37 +0000
(18:22 +0200)
loader/emu.c
patch
|
blob
|
blame
|
history
diff --git
a/loader/emu.c
b/loader/emu.c
index
dd507ff
..
2c64aa6
100644
(file)
--- a/
loader/emu.c
+++ b/
loader/emu.c
@@
-1,4
+1,8
@@
// vim:shiftwidth=2:expandtab
// vim:shiftwidth=2:expandtab
+// a "gentle" reminder
+#ifdef __ARM_EABI__
+#error loader is meant to be OABI!
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@
-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
// ???? ???? 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;
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;
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);
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);