Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Change how arguments are sent to the start method
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Dec 7, 2017
1 parent b8d1dc9 commit 44c5637
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion exploit/runNro.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ module.exports = (res, args) => {
utils.log("closing sm and jumping...");
sc.svcCloseHandle(sc.smHandle).assertOk();
sc.smHandle = undefined;
utils.log("returned " + utils.paddr(sc.call(utils.add2(sc.svcNroBase, 0x80), [libtransistorContext])));
var handle = sc.svcGetThreadId().assertOk();
utils.log("returned " + utils.paddr(sc.call(utils.add2(sc.svcNroBase, 0x80), [0, handle, libtransistorContext])));

var logBufferAddr = [libtransistorContext[6], libtransistorContext[7]];
var logLengthAddr = [libtransistorContext[8], libtransistorContext[9]];
Expand Down
17 changes: 17 additions & 0 deletions exploit/svc.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,23 @@ svcMixin.svcCreateSharedMemory = function (size, permission1, permission2) {
return this.svcWithResult(0x50, [handleBuffer, size, permission1, permission2]).replaceValue(handleBuffer[0]);
};

/*
Usages:
svcGetThreadId()
svcGetThreadId(tid)
*/
svcMixin.svcGetThreadId = function (tid) {
if (tid === undefined) {
tid = 0xffff8000;
}

if (typeof (tid) === 'number') { tid = [tid, 0]; }
if (!Array.isArray(tid)) { throw new Error('invalid tid type'); }

var handleBuffer = new Uint32Array(2);
return this.svcWithResult(0x25, [handleBuffer, tid]).replaceValue([handleBuffer[0], handleBuffer[1]]);
};

/*
Usages:
svcMapSharedMemory(handle, size)
Expand Down

0 comments on commit 44c5637

Please sign in to comment.