129 #define NBL_MAXPATHLEN 2048
149 void* (*dlopen)(
const char* filename,
int mode);
158 int (*dlclose)(
void* handle);
173 int (*dlinfo)(
void* handle,
int request,
void* arg);
186 char* (*dlerror)(void);
203 void* (*dlsym)(
void* handle,
const char* name);
224 void* (*dlsym_with_signature)(
void* handle,
const char* name,
const char* nbl_signature);
237 bool (*register_hostfunc)(
const void* entry,
const char* name,
const char* nbl_signature);
250 bool (*register_hostdata)(
const void* address,
const char* name);
283 bool (*register_hostfunc_with_callback)(
const void* entry,
const char* name,
const char* nbl_signature,
const void* c_entry,
const char* c_signature);
341 bool (*register_hostfunc_with_callback_arg)(
344 const char* nbl_signature,
346 const char* c_signature,
347 int callback_arg_index);
372 bool (*register_hostfunc_with_vaargs_policy)(
375 const char* nbl_signature,
378 bool include_terminator);
390 bool (*unregister_hostfunc)(
const void* entry,
const char* name);
403 void* (*method_stub)(
const char* nbl_signature,
const void* entry);
415 bool (*is_tr_handle)(
void* handle);
426 bool (*is_tr_symbol)(
const void* addr);
437 bool (*is_tr_signal)(
const void* addr);
454 bool (*tr_signalhandler)(
int sig, siginfo_t* info, ucontext_t* uc);
463 const void* (*get_extension)(uint32_t extension_id);
490 Nbl*
nbl_load(
int tr_mode,
const char* nbl_lib_base,
bool host_dispatch_signal);
507 static inline bool is_x86_64_arch(
const char *filename) {
508 int fd = open(filename, O_RDONLY);
509 if (fd == -1)
return false;
513 if (read(fd, &header,
sizeof(header)) ==
sizeof(header)) {
514 if (header.e_machine == EM_X86_64) ret =
true;
536 void set_host_sighandle(
int (*host_sig_handler)(
int signo,
void* siginfo,
void* ucontext,
int abort_if_unrecognized));
Nbl * nbl_load(int tr_mode, const char *nbl_lib_base, bool host_dispatch_signal)
Create and initialise an Nbl instance.
void set_host_sighandle(int(*host_sig_handler)(int signo, void *siginfo, void *ucontext, int abort_if_unrecognized))
Register a host (LoongArch) signal handler with the current NBL instance so that the translator can d...
NblVaargsPolicy
Variadic-argument handling policy for host function registration.
Definition: nbl.h:118
void nbl_unload(Nbl *nbl)
Destroy an Nbl instance previously created by nbl_load() and release all associated resources...
Dispatch table of NBL runtime functions.
Definition: nbl.h:138