-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
63 lines (41 loc) · 1.45 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# include "ellhal.h"
# include "ellloader.h"
# include "ell.h"
static int elllibrary = 0 ;
typedef void (*ELLREGISTER ) ( int* address , int length ) ;
ELLREGISTER ellregister = 0 ;
typedef void (*ELLENTRY) () ;
ELLENTRY ellentry = 0 ;
unsigned char* ebuffer = 0 ;
int ebufferlength = 100*1024 ;
int main ( int argc , char* argv [] ) {
ebuffer = (unsigned char* ) EllMalloc ( ebufferlength ) ;
if ( !ebuffer ) {
EllLog ( "ell ebuffer is NULL\n" ) ;
return 0 ;
}
// 注册ebuffer,将ell 加载到该区域
EllMemoryRegister ( ebuffer , ebufferlength ) ;
// 加载ell
// 参数1 : 指令集
// 参数2 : 应用程序(一个目录,ell以应用程序为单位被加载,
// 一个ell应用程序可有n个目标文件构成,ell通过动态连接器将这些目标文件变为可执行)
elllibrary = EllInstall ( ELL_THUMB16_ROUTINE , "GTKINGS" ) ;
// 取得符号入口(符号类型不仅仅局限在函数,全局变量等也可以访问)
ellregister = (ELLREGISTER) EllGetSymbolEntry ( elllibrary , "RomSendDataToEll" ) ;
ellentry = (ELLENTRY) EllGetSymbolEntry ( elllibrary , "gtkings" ) ;
EllLog ( "ell register %x\n" , ellregister ) ;
EllLog ( "ell entry %x\n" , ellentry ) ;
if ( ellregister ) {
int apiaddress [4] = {
0 , 0 , 0 , 0
} ;
// 将ROM系统层接口地址传递给ell
// ellregister ( apiaddress , sizeof (apiaddress) ) ;
}
// if ( ellentry ) ellentry () ;
EllUninstall ( elllibrary ) ;
// MMTCheckOverflow () ;
MMTCheckLeaked () ;
return 1 ;
}