Skip to content

Commit 6b6c1a6

Browse files
author
WangONC
committed
provide 64-bit support for modules loading
1 parent 83b2f95 commit 6b6c1a6

File tree

4 files changed

+318
-211
lines changed

4 files changed

+318
-211
lines changed

src/androidemu/emulator.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,12 @@ def load_library(self, filename, do_init=True):
141141
libmod = self.modules.load_module(filename)
142142
if do_init:
143143
logger.debug("Calling init for: %s " % filename)
144+
# DT_INIT should be called before DT_INIT_ARRAY if both are present
145+
if libmod.init is not None:
146+
logger.debug("Calling DT_INIT: %x " % libmod.init)
147+
self.call_native(libmod.init, 0, 0, 0)
144148
for fun_ptr in libmod.init_array:
145-
logger.debug("Calling init function: %x " % fun_ptr)
149+
logger.debug("Calling DT_INIT_ARRAY function: %x " % fun_ptr)
146150
self.call_native(fun_ptr, 0, 0, 0)
147151
return libmod
148152

src/androidemu/internal/arm.py

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
R_ARM_JUMP_SLOT = 22
66
R_ARM_RELATIVE = 23
77

8+
R_AARCH64_NONE = 0
9+
R_AARCH64_ABS64 = 257
810
R_AARCH64_GLOB_DAT = 1025
911
R_AARCH64_JUMP_SLOT = 1026
1012
R_AARCH64_RELATIVE = 1027
13+
R_AARCH64_TLSDESC = 1031
14+
R_AARCH64_IRELATIVE = 1032
15+
R_AARCH64_TLS_DTPREL = 1028
16+
R_AARCH64_TLS_TPREL = 1029

src/androidemu/internal/module.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ class Module:
55
:type base int
66
:type size int
77
"""
8-
def __init__(self, filename, address, size, symbols_resolved, init_array=[]):
8+
def __init__(self, filename, address, size, symbols_resolved, init_array=[], init=None):
99
self.filename = filename
1010
self.base = address
1111
self.size = size
1212
self.symbols = symbols_resolved
1313
self.symbol_lookup = dict()
1414
self.init_array = list(init_array)
15+
self.init = init
1516

1617
# Create fast lookup.
1718
for symbol_name, symbol in self.symbols.items():

0 commit comments

Comments
 (0)