summaryrefslogtreecommitdiff
path: root/utils/hwstub/tools/hwstub_shell.cpp
diff options
context:
space:
mode:
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)
206 return 0; 206 return 0;
207} 207}
208 208
209int my_lua_call(lua_State *state)
210{
211 int n = lua_gettop(state);
212 if(n != 1)
213 luaL_error(state, "call takes target address argument");
214
215 hwstub_call(g_hwdev, luaL_checkunsigned(state, 1));
216 return 0;
217}
218
219int my_lua_jump(lua_State *state)
220{
221 int n = lua_gettop(state);
222 if(n != 1)
223 luaL_error(state, "jump takes target address argument");
224
225 hwstub_jump(g_hwdev, luaL_checkunsigned(state, 1));
226 return 0;
227}
228
209int my_lua_printlog(lua_State *state) 229int my_lua_printlog(lua_State *state)
210{ 230{
211 print_log(g_hwdev); 231 print_log(g_hwdev);
@@ -329,6 +349,10 @@ bool my_lua_import_hwstub()
329 lua_setfield(g_lua, -2, "write32"); 349 lua_setfield(g_lua, -2, "write32");
330 lua_pushcclosure(g_lua, my_lua_printlog, 0); 350 lua_pushcclosure(g_lua, my_lua_printlog, 0);
331 lua_setfield(g_lua, -2, "print_log"); 351 lua_setfield(g_lua, -2, "print_log");
352 lua_pushcclosure(g_lua, my_lua_call, 0);
353 lua_setfield(g_lua, -2, "call");
354 lua_pushcclosure(g_lua, my_lua_jump, 0);
355 lua_setfield(g_lua, -2, "jump");
332 356
333 lua_setfield(g_lua, -2, "dev"); 357 lua_setfield(g_lua, -2, "dev");
334 358