summaryrefslogtreecommitdiffstats
path: root/utils/hwstub/tools/hwstub_shell.cpp
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2014-11-26 00:00:11 +0100
committerMarcin Bukat <marcin.bukat@gmail.com>2014-11-28 19:38:02 +0100
commite99c036ed1b96abf0c4b196e5f58ef93b7effdfe (patch)
tree0d5f487d19ece13a815e7fae12a91abfaaa11221 /utils/hwstub/tools/hwstub_shell.cpp
parent9439635aa27e7604d01dddb30a505a3402f3b4df (diff)
downloadrockbox-e99c036ed1b96abf0c4b196e5f58ef93b7effdfe.tar.gz
rockbox-e99c036ed1b96abf0c4b196e5f58ef93b7effdfe.zip
hwstub_shell: add support for call and jump
Change-Id: Ie09d0db21831b79255da858bada7382a08ff4eef Reviewed-on: http://gerrit.rockbox.org/1052 Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com> Tested: Marcin Bukat <marcin.bukat@gmail.com>
Diffstat (limited to 'utils/hwstub/tools/hwstub_shell.cpp')
-rw-r--r--utils/hwstub/tools/hwstub_shell.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/hwstub/tools/hwstub_shell.cpp b/utils/hwstub/tools/hwstub_shell.cpp
index 30d1ac3b3f..8b7a8b9e80 100644
--- a/utils/hwstub/tools/hwstub_shell.cpp
+++ b/utils/hwstub/tools/hwstub_shell.cpp
@@ -206,6 +206,26 @@ int my_lua_writen(lua_State *state)
return 0;
}
+int my_lua_call(lua_State *state)
+{
+ int n = lua_gettop(state);
+ if(n != 1)
+ luaL_error(state, "call takes target address argument");
+
+ hwstub_call(g_hwdev, luaL_checkunsigned(state, 1));
+ return 0;
+}
+
+int my_lua_jump(lua_State *state)
+{
+ int n = lua_gettop(state);
+ if(n != 1)
+ luaL_error(state, "jump takes target address argument");
+
+ hwstub_jump(g_hwdev, luaL_checkunsigned(state, 1));
+ return 0;
+}
+
int my_lua_printlog(lua_State *state)
{
print_log(g_hwdev);
@@ -329,6 +349,10 @@ bool my_lua_import_hwstub()
lua_setfield(g_lua, -2, "write32");
lua_pushcclosure(g_lua, my_lua_printlog, 0);
lua_setfield(g_lua, -2, "print_log");
+ lua_pushcclosure(g_lua, my_lua_call, 0);
+ lua_setfield(g_lua, -2, "call");
+ lua_pushcclosure(g_lua, my_lua_jump, 0);
+ lua_setfield(g_lua, -2, "jump");
lua_setfield(g_lua, -2, "dev");