| 465 |
theseven |
1 |
#include "syscallwrappers.h"
|
|
|
2 |
|
|
|
3 |
|
| 468 |
theseven |
4 |
#define EMCORE_LIB_HEADER(lib_identifier, lib_version, lib_min_version, init_func, shutdown_func, \
|
|
|
5 |
api_pointer) \
|
| 465 |
theseven |
6 |
struct emcore_syscall_table* __emcore_syscall; \
|
|
|
7 |
int __emcore_lib_init() \
|
|
|
8 |
{ \
|
|
|
9 |
asm volatile("swi\t2\n\tldr\tr1, =__emcore_syscall\n\tstr\tr0, [r1]\n\t" \
|
| 538 |
theseven |
10 |
"b\t__emcore_lib_init_c\n\t.ltorg\n__emcore_lib_init_c:\n\t" \
|
| 465 |
theseven |
11 |
::: "r0", "r1", "r2", "r3", "r12", "lr", "cc", "memory"); \
|
| 466 |
theseven |
12 |
if (__emcore_syscall->table_version < EMCORE_API_VERSION \
|
|
|
13 |
|| __emcore_syscall->table_minversion > EMCORE_API_VERSION) \
|
| 465 |
theseven |
14 |
return 0x80000000; \
|
|
|
15 |
} \
|
| 466 |
theseven |
16 |
struct emcorelib_header __emcore_lib_header __attribute__((section(".emcoreentrypoint"))) = \
|
| 465 |
theseven |
17 |
{ \
|
|
|
18 |
.headerversion = EMCORELIB_HEADER_VERSION, \
|
| 466 |
theseven |
19 |
.identifier = lib_identifier, \
|
|
|
20 |
.version = lib_version, \
|
| 468 |
theseven |
21 |
.minversion = lib_min_version, \
|
|
|
22 |
.setupfunc = __emcore_lib_init, \
|
|
|
23 |
.initfunc = init_func, \
|
| 466 |
theseven |
24 |
.shutdownfunc = shutdown_func, \
|
|
|
25 |
.api = &api_pointer \
|
| 465 |
theseven |
26 |
};
|
| 489 |
theseven |
27 |
|
|
|
28 |
|
|
|
29 |
extern struct emcore_syscall_table* __emcore_syscall;
|