diff options
| author | spv420 <unomilliono@gmail.com> | 2022-04-24 07:27:47 -0400 |
|---|---|---|
| committer | spv420 <unomilliono@gmail.com> | 2022-04-24 07:27:47 -0400 |
| commit | 202fff8a0da664f8aa4e03e9e9e11fe0b8d87199 (patch) | |
| tree | dd7052eba54df7f7d24c92a2301c0da28260f9e1 /src/js/lib/myutils.js | |
| parent | 7fdce8d27df9fa1288238c4829961f1e97f71c31 (diff) | |
yeet
Diffstat (limited to 'src/js/lib/myutils.js')
| -rw-r--r-- | src/js/lib/myutils.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/js/lib/myutils.js b/src/js/lib/myutils.js index 08ba89e..0106402 100644 --- a/src/js/lib/myutils.js +++ b/src/js/lib/myutils.js @@ -25,4 +25,39 @@ function printf() { } return calls4arg.apply(this, args_to_pass); +} + +function syslog() { + if (arguments.length > 4) { + return printf("warning: tried to printf with %d args, max %d.\n", arguments.length, 4); + } + + var args_to_pass = new Array(); + + sym = "syslog"; + + if (sym in sym_cache) { + var addy = sym_cache[sym]; + } else { + var dlsym_addy = read_u32(reserve_addr + 24 + slid); + var shc_slide = read_u32(reserve_addr + 20 + slid); + var addy = call4arg(dlsym_addy + shc_slide, 0xfffffffe, sptr(sym), 0, 0); + sym_cache[sym] = addy; + } + + args_to_pass.push(addy); + + for (var i = 0; i < arguments.length; i++) { + if (arguments[i].constructor === String) { + args_to_pass.push(sptr(arguments[i])); + } else { + args_to_pass.push(arguments[i]); + } + } + + return callnarg.apply(this, args_to_pass); +} + +function sleep(t) { + return calls4arg("sleep", t, 0, 0, 0); }
\ No newline at end of file |
