All pastes #486432 Raw Edit

Chao7

public text v1 · immutable
·published 2007-05-13 21:57 UTC
rendered paste body

[BITS 32]
[CPU PRESCOTT]

luaopen_base       equ 0x005C91D5
szluaopen_base     equ 0x005C9110
luaopen_package    equ 0x005C91D9
szluaopen_package  equ 0x005C911F
luaopen_table      equ 0x005C91DD
szluaopen_table    equ 0x005C9131
luaopen_io         equ 0x005C91E1
szluaopen_io       equ 0x005C9141
luaopen_os         equ 0x005C91E5
szluaopen_os       equ 0x005C914E
luaopen_string     equ 0x005C91E9
szluaopen_string   equ 0x005C915B
luaopen_math       equ 0x005C91ED
szluaopen_math     equ 0x005C916C
luaopen_debug      equ 0x005C91F2
szluaopen_debug    equ 0x005C917B
luaopen_jit        equ 0x005C91F6
szluaopen_jit      equ 0x005C918B
luaopen_coco       equ 0x005C91F9
szluaopen_coco     equ 0x005C9199
lua_pushcclosure   equ 0x005C91FD
szlua_pushcclosure equ 0x005C91A8
lua_pushstring     equ 0x005C9201
szlua_pushstring   equ 0x005C91BB
lua_call           equ 0x005C9205
szlua_call         equ 0x005C91CC

push ebx ; func ptr
push esi ; str ptr
push edx ; edx is base reloc ptr, becomes state ptr - passed by eax
push edi ; call func

mov ebx, edx
mov esi, edx
mov edi, edx

add ebx, luaopen_base
add esi, szluaopen_base
add edi, lua_pushcclosure

mov edx, eax ; grab state ptr passed thru eax

; base
add esi, 12
call near luahack_register

; package
add esi, 11
call near luahack_register

; table
add esi, 18
call near luahack_register

; io
add esi, 16
call near luahack_register

; os
add esi, 13
call near luahack_register

; string
add esi, 13
call near luahack_register

; math
add esi, 17
call near luahack_register

; debug
add esi, 15
call near luahack_register

; jit
add esi, 16
call near luahack_register

; coco
add esi, 14
call near luahack_register

pop edi ; call func
pop edx ; edx is base reloc ptr, becomes state ptr - passed by eax
pop esi ; str ptr
pop ebx ; func ptr
ret

luahack_register:
push ebx
push edx
call [ edi ]
add esp, 4*2
push esi
push edx
call [ edi + 4 ]
add esp, 4*2
push dword 0x00000000
push dword 0x00000001
push edx
call [ edi + 8 ]
add esp, 4*3
ret