summaryrefslogtreecommitdiff
path: root/src/stage4
diff options
context:
space:
mode:
Diffstat (limited to 'src/stage4')
-rw-r--r--src/stage4/lib/native_ptr.js29
-rw-r--r--src/stage4/main.js7
2 files changed, 35 insertions, 1 deletions
diff --git a/src/stage4/lib/native_ptr.js b/src/stage4/lib/native_ptr.js
index d15fec5..39c9fef 100644
--- a/src/stage4/lib/native_ptr.js
+++ b/src/stage4/lib/native_ptr.js
@@ -62,4 +62,31 @@ function native_ptr_type(size, buf_to_obj, obj_to_buf) {
ret.prototype.obj_to_buf = obj_to_buf;
return ret;
-} \ No newline at end of file
+}
+
+/*
+typedef struct{
+ void* address;
+ mach_msg_size_t count;
+ boolean_t deallocate: 8;
+ mach_msg_copy_options_t copy: 8;
+ mach_msg_type_name_t disposition : 8;
+ mach_msg_descriptor_type_t type : 8;
+} mach_msg_ool_ports_descriptor_t;
+ */
+function mach_msg_ool_ports_descriptor_t_buf_to_obj(buf) {
+ var ret = {};
+
+ ret.address = u8x4_to_u32(buf);
+ ret.count = u8x4_to_u32([buf[4], buf[5], buf[6], buf[7]]);
+ ret.deallocate = buf[8];
+ ret.copy = buf[9];
+ ret.disposition = buf[10];
+ ret.type = buf[11];
+
+ return ret;
+}
+
+var mach_msg_ool_ports_descriptor_t = native_ptr_type(12,
+ mach_msg_ool_ports_descriptor_t_buf_to_obj,
+ function(){}); \ No newline at end of file
diff --git a/src/stage4/main.js b/src/stage4/main.js
index f251666..7e79786 100644
--- a/src/stage4/main.js
+++ b/src/stage4/main.js
@@ -64,6 +64,13 @@ 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);
+ write_u32(addy, 0x41414141);
+ write_u32(addy + 4, 0x42424242);
+ write_u32(addy + 8, ((19 << 16) + (MACH_MSG_OOL_PORTS_DESCRIPTOR << 24)));
+ p0laris_log("%s", JSON.stringify(np4.deref()));
+
// p0laris_log("%s", Proxy.toString());
p0laris_log("%x %x %x %x", np1.deref(), np2.deref(), np3.deref());