summaryrefslogtreecommitdiff
path: root/src/stage4/lib
diff options
context:
space:
mode:
authorspv420 <spv@spv.sh>2022-08-01 01:10:25 -0400
committerspv420 <spv@spv.sh>2022-08-01 01:10:25 -0400
commit0df8ea8b4bb9d9ee9d45a56eb5df2c2c6a23127c (patch)
treeae0643c4bb134b8ab721de846e7197145fe1933e /src/stage4/lib
parent9d184c28ecd7ee3080145df9034217ff7443ef8b (diff)
native_ptr w00t
Diffstat (limited to 'src/stage4/lib')
-rw-r--r--src/stage4/lib/native_ptr.js20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/stage4/lib/native_ptr.js b/src/stage4/lib/native_ptr.js
index 464d865..3741e80 100644
--- a/src/stage4/lib/native_ptr.js
+++ b/src/stage4/lib/native_ptr.js
@@ -33,7 +33,6 @@ class native_ptr {
if (Object.getPrototypeOf(this).deref_all != undefined) {
this.size *= this.count;
- p0laris_log("get lucky %d", this.size);
}
if (this.addy === undefined) {
@@ -197,34 +196,27 @@ function mach_msg_header_t_obj_to_buf(obj) {
function mach_msg_body_t_buf_to_obj(buf) {
var ret = {};
- ret.msgh_descriptor_count = u32_to_u8x4(buf);
+ ret.msgh_descriptor_count = u8x4_to_u32(buf);
return ret;
}
function mach_msg_body_t_obj_to_buf(obj) {
- var ret = u8x4_to_u32(obj.msgh_descriptor_count);
+ var ret = u32_to_u8x4(obj.msgh_descriptor_count);
return ret;
}
function Request_sp_buf_to_obj(buf) {
var ret = {};
- p0laris_log("w00t %d %s", buf.length, Object.getOwnPropertyNames(Object.getPrototypeOf(buf)).toString());
var Head_buf = buf.subarray(0, 24);
- p0laris_log("w00t");
var msgh_body_buf = buf.subarray(24, 28);
- p0laris_log("w00t");
var init_port_set_buf = buf.subarray(28);
- p0laris_log("w00t");
ret.Head = mach_msg_header_t_buf_to_obj(Head_buf);
- p0laris_log("w00t");
ret.msgh_body = mach_msg_body_t_buf_to_obj(msgh_body_buf);
- p0laris_log("w00t");
ret.init_port_set = new Array();
for (var i = 0; i < (buf.length - 28) / 28; i++) {
- p0laris_log("%d", i);
var init_port_set_buf = buf.subarray((i * 28) + 28);
ret.init_port_set.push(mach_msg_ool_ports_descriptor_t_buf_to_obj(init_port_set_buf));
}
@@ -236,7 +228,6 @@ function Request_sp_obj_to_buf(obj) {
var ret = new Uint8Array(this.size * this.count);
var tmp = mach_msg_header_t_obj_to_buf(obj.Head);
var begin = 0;
- p0laris_log("w00t");
var i = 0;
begin = i;
@@ -245,7 +236,6 @@ function Request_sp_obj_to_buf(obj) {
ret[i] = tmp[i - begin];
}
- p0laris_log("w00t");
begin = i;
var tmp = mach_msg_body_t_obj_to_buf(obj.msgh_body);
@@ -254,7 +244,6 @@ function Request_sp_obj_to_buf(obj) {
ret[i] = tmp[i - begin];
}
- p0laris_log("w00t");
begin = i;
for (var i = 0; i < obj.init_port_set.length; i++) {
@@ -263,7 +252,6 @@ function Request_sp_obj_to_buf(obj) {
ret[begin + (i * 12) + j] = tmp[j];
}
}
- p0laris_log("w00t");
return ret;
}
@@ -279,4 +267,6 @@ var mach_msg_ool_ports_descriptor_t = native_ptr_type(12,
var Request_sp = native_ptr_type(24 + 4 + 12,
Request_sp_buf_to_obj,
Request_sp_obj_to_buf);
-Request_sp.prototype.deref_all = true; \ No newline at end of file
+Request_sp.prototype.deref_all = true;
+
+var mach_port_t = native_ptr_type(4); \ No newline at end of file