static int glew_abi_init(struct x86_ctx_t *ctx) { struct x86_regs_t *regs = ctx->regs; struct mem_t *mem = ctx->mem; unsigned int version_ptr; struct glew_version_t version; /* Arguments */ version_ptr = regs->ecx; glew_debug("\tversion_ptr=0x%x\n", version_ptr); /* Return version */ assert(sizeof(struct glew_version_t) == 8); version.major = X86_GLEW_RUNTIME_VERSION_MAJOR; version.minor = X86_GLEW_RUNTIME_VERSION_MINOR; mem_write(mem, version_ptr, sizeof version, &version); glew_debug("\tGLEW Runtime host implementation v. %d.%d\n", version.major, version.minor); /* Return success */ return 0; }
int glew_abi_call(X86Context *ctx) { struct x86_regs_t *regs = ctx->regs; int code; int ret; /* Function code */ code = regs->ebx; if (code <= glew_call_invalid || code >= glew_call_count) fatal("%s: invalid GLEW function (code %d).\n%s", __FUNCTION__, code, glew_err_code); /* Debug */ glew_debug("GLEW runtime call '%s' (code %d)\n", glew_call_name[code], code); /* Call GLEW function */ assert(glew_abi_table[code]); ret = glew_abi_table[code](ctx); /* Return value */ return ret; }
void glew_init(void) { glew_debug("Initializing Glew...\n"); }
void glew_done(void) { glew_debug("Finalizing Glew...\n"); }