Mercurial > pub > dyncall > dyncall
view dyncallback/dyncall_thunk_x86.c @ 588:dfc2e6ee8782 r1.4-RC3
- more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
- syscall test: added newline to output
author | Tassilo Philipp |
---|---|
date | Mon, 19 Sep 2022 09:54:21 +0200 |
parents | f5577f6bf97a |
children |
line wrap: on
line source
/* Package: dyncall Library: dyncallback File: dyncallback/dyncall_thunk_x86.c Description: Thunk - Implementation for x86 License: Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, Tassilo Philipp <tphilipp@potion-studios.com> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "dyncall_thunk.h" void dcbInitThunk(DCThunk* p, void (*entry)()) { /* x86 thunk code: nop nop nop mov %eax, p jmp [%eax+12] nop */ p->code_load = 0xb8909090UL; /* nop;nop;nop;mov %eax, ... */ p->addr_self = p; p->code_jump = 0x900C60ffUL; /* jmp [%eax+12] ; nop */ p->addr_entry = entry; }