Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/917
-gerrit
commit f82f6df2c6a0a1cccbec4b879cce82c594cf8c00 Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Sat Apr 21 20:58:06 2012 +0300
Fix build with lua5.2
Reuse the following commit for qemu-0.15.x: c6fae6554d1fd48780258bef2b3be4b45ef3a588
Change-Id: I8b4ddd12aff3fb4a1799a1b446fdc71162b6b40f Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- qemu-0.15.x/serialice.c | 34 +++++++++++++++++++--------------- 1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/qemu-0.15.x/serialice.c b/qemu-0.15.x/serialice.c index 317aaea..4ad082b 100644 --- a/qemu-0.15.x/serialice.c +++ b/qemu-0.15.x/serialice.c @@ -221,7 +221,11 @@ static int serialice_lua_registers(void)
lua_newuserdata(L, sizeof(void *)); luaL_newmetatable(L, "registermt"); +#if LUA_VERSION_NUM <= 501 luaL_register(L, NULL, registermt); +#elif LUA_VERSION_NUM >= 502 + luaL_setfuncs(L, registermt, 0); +#endif lua_setmetatable(L, -2); lua_setglobal(L, "regs");
@@ -242,7 +246,7 @@ static int serialice_lua_init(void)
/* Set global variable SerialICE_mainboard */ lua_pushstring(L, serialice_mainboard); - lua_setfield(L, LUA_GLOBALSINDEX, "SerialICE_mainboard"); + lua_setglobal(L, "SerialICE_mainboard");
/* Enable Register Access */ serialice_lua_registers(); @@ -290,7 +294,7 @@ static int serialice_io_read_filter(uint32_t * data, uint16_t port, int size) { int ret, result;
- lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_io_read_filter"); + lua_getglobal(L, "SerialICE_io_read_filter"); lua_pushinteger(L, port); // port lua_pushinteger(L, size); // datasize result = lua_pcall(L, 2, 2, 0); @@ -310,7 +314,7 @@ static int serialice_io_write_filter(uint32_t * data, uint16_t port, int size) { int ret, result;
- lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_io_write_filter"); + lua_getglobal(L, "SerialICE_io_write_filter"); lua_pushinteger(L, port); // port lua_pushinteger(L, size); // datasize lua_pushinteger(L, *data); // data @@ -336,7 +340,7 @@ static int serialice_memory_read_filter(uint32_t addr, uint32_t * data, { int ret = 0, result;
- lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_memory_read_filter"); + lua_getglobal(L, "SerialICE_memory_read_filter"); lua_pushinteger(L, addr); // addr lua_pushinteger(L, size); // datasize result = lua_pcall(L, 2, 3, 0); @@ -366,7 +370,7 @@ static int serialice_memory_write_filter(uint32_t addr, int size, int ret = 0, result; int write_to_qemu, write_to_serialice;
- lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_memory_write_filter"); + lua_getglobal(L, "SerialICE_memory_write_filter"); lua_pushinteger(L, addr); // address lua_pushinteger(L, size); // datasize lua_pushinteger(L, *data); // data @@ -397,9 +401,9 @@ static int serialice_msr_filter(int flags, uint32_t addr, uint32_t * hi, int ret, result;
if (flags & FILTER_WRITE) { - lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_msr_write_filter"); + lua_getglobal(L, "SerialICE_msr_write_filter"); } else { - lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_msr_read_filter"); + lua_getglobal(L, "SerialICE_msr_read_filter"); }
lua_pushinteger(L, addr); // port @@ -427,7 +431,7 @@ static int serialice_cpuid_filter(uint32_t eax, uint32_t ecx, { int ret, result;
- lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_cpuid_filter"); + lua_getglobal(L, "SerialICE_cpuid_filter");
lua_pushinteger(L, eax); // eax before calling lua_pushinteger(L, ecx); // ecx before calling @@ -471,13 +475,13 @@ static void serialice_log(int flags, uint32_t data, uint32_t addr, int size) int result;
if ((flags & LOG_WRITE) && (flags & LOG_MEMORY)) { - lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_memory_write_log"); + lua_getglobal(L, "SerialICE_memory_write_log"); } else if (!(flags & LOG_WRITE) && (flags & LOG_MEMORY)) { - lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_memory_read_log"); + lua_getglobal(L, "SerialICE_memory_read_log"); } else if ((flags & LOG_WRITE) && !(flags & LOG_MEMORY)) { - lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_io_write_log"); + lua_getglobal(L, "SerialICE_io_write_log"); } else { // if (!(flags & LOG_WRITE) && !(flags & LOG_MEMORY)) - lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_io_read_log"); + lua_getglobal(L, "SerialICE_io_read_log"); }
lua_pushinteger(L, addr); // addr/port @@ -500,9 +504,9 @@ static void serialice_msr_log(int flags, uint32_t addr, uint32_t hi, int result;
if (flags & LOG_WRITE) { - lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_msr_write_log"); + lua_getglobal(L, "SerialICE_msr_write_log"); } else { // if (!(flags & LOG_WRITE)) - lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_msr_read_log"); + lua_getglobal(L, "SerialICE_msr_read_log"); }
lua_pushinteger(L, addr); // addr/port @@ -522,7 +526,7 @@ static void serialice_cpuid_log(uint32_t eax, uint32_t ecx, cpuid_regs_t res, { int result;
- lua_getfield(L, LUA_GLOBALSINDEX, "SerialICE_cpuid_log"); + lua_getglobal(L, "SerialICE_cpuid_log");
lua_pushinteger(L, eax); // input: eax lua_pushinteger(L, ecx); // input: ecx