static void stubRestoreFuncs(void) { int i, slot; const struct mapi_stub *stub; assert(stub_allow_override()); for (stub = public_stubs, i = 0; i < MAPI_TABLE_NUM_STATIC; stub++, i++) { slot = (stub->slot == -1) ? MAPI_LAST_SLOT : stub->slot; entry_generate_default_code((char *)stub_get_addr(stub), slot); } #if !defined(STATIC_DISPATCH_ONLY) for (stub = dynamic_stubs, i = 0; i < num_dynamic_stubs; stub++, i++) { slot = (stub->slot == -1) ? MAPI_LAST_SLOT : stub->slot; entry_generate_default_code((char *)stub_get_addr(stub), slot); } #endif // !defined(STATIC_DISPATCH_ONLY) }
mapi_func entry_generate(int slot) { void *code = u_execmem_alloc(entry_stub_size); if (!code) { return NULL; } // Add 1 to the base address to force Thumb mode when jumping to the stub code = (void *)((char *)code + 1); entry_generate_default_code(code, slot); return (mapi_func) code; }