mirror of
https://github.com/ptitSeb/box86.git
synced 2026-11-08 17:39:19 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5584e62db3 | ||
|
|
9b968777a0 | ||
|
|
62b7326a75 | ||
|
|
6b7275f475 | ||
|
|
7f174da3c7 | ||
|
|
5a1c7b50e7 | ||
|
|
39283bf99e | ||
|
|
95ec71bd0a | ||
|
|
756a7fddf2 | ||
|
|
e1f897cab9 | ||
|
|
eb35ed9a1b | ||
|
|
f439a401a0 | ||
|
|
bfd4c8cb5c | ||
|
|
3fca45b256 | ||
|
|
bda27e69ba | ||
|
|
1e88171d45 | ||
|
|
d9a2f6b7bb | ||
|
|
94de344d05 | ||
|
|
3dd188dedd | ||
|
|
a5562ea8bd | ||
|
|
8f86acfef6 | ||
|
|
890cf8841a | ||
|
|
55e0e5571b | ||
|
|
19e062a79c | ||
|
|
916a10fae8 | ||
|
|
4f8849e914 | ||
|
|
713098471e | ||
|
|
bab00e6e42 | ||
|
|
c0836a75ed | ||
|
|
6cb611971a | ||
|
|
3ba09947d2 | ||
|
|
523c3db8c4 | ||
|
|
d94b7fba23 | ||
|
|
ae76bbcafe | ||
|
|
b987e9086a | ||
|
|
47fc82a839 | ||
|
|
fcff7e85fe | ||
|
|
147ec021ea | ||
|
|
cb7f4d373e | ||
|
|
3db9dfd7ea | ||
|
|
18fa4d2134 | ||
|
|
b63ec10cf7 | ||
|
|
c44ce3acbd | ||
|
|
fbd494d348 | ||
|
|
b98412de11 | ||
|
|
cd17162a00 | ||
|
|
dd63e8cc86 | ||
|
|
1d0ca9bf0c | ||
|
|
c0704f6a34 | ||
|
|
a7750a38b9 | ||
|
|
58307888df | ||
|
|
b1ad6f19c0 | ||
|
|
b254c69771 | ||
|
|
0360d2562d | ||
|
|
2df3d1967e | ||
|
|
54c600660b | ||
|
|
4e8e889900 | ||
|
|
66ed58df03 | ||
|
|
a8d4175cd1 | ||
|
|
1c286c1c5e | ||
|
|
011a1057bf | ||
|
|
1d8af4b523 | ||
|
|
cbb12339c9 | ||
|
|
c4c2a525fb | ||
|
|
fd1a581598 | ||
|
|
4902ba83c4 | ||
|
|
5c6453f931 | ||
|
|
880de4491c | ||
|
|
e9ed82bdc5 | ||
|
|
048acfda7b | ||
|
|
ca2013fb97 | ||
|
|
dad24e4fba | ||
|
|
0fea396a1b | ||
|
|
393358d936 | ||
|
|
236e0f1f75 | ||
|
|
cf78416e24 | ||
|
|
80e64bab6d | ||
|
|
98725002e6 | ||
|
|
e834fd31c8 | ||
|
|
53d00d528c | ||
|
|
e6b31b2d7e | ||
|
|
b61ed02ee4 | ||
|
|
512d06ae48 | ||
|
|
66c2faf379 | ||
|
|
4ba2a4ec27 | ||
|
|
6d2d8b8a3c | ||
|
|
e9570fe320 | ||
|
|
97c5983a4e | ||
|
|
4bdbb91d4d | ||
|
|
e84ab5d5dd | ||
|
|
4aaea970cd | ||
|
|
614300d911 | ||
|
|
ab4c78c288 | ||
|
|
d4590ee13e | ||
|
|
456d4f999d | ||
|
|
1ecc2d930a | ||
|
|
7881e1ec14 | ||
|
|
b9184bba5d | ||
|
|
ff51cf7c72 | ||
|
|
18f13de0f0 | ||
|
|
fe1652bf7f | ||
|
|
06c7772c0a | ||
|
|
dd56fd116e | ||
|
|
e7db118ef4 | ||
|
|
14964b55b9 | ||
|
|
cf59aef0f5 | ||
|
|
59ccc7fdef | ||
|
|
5bb72f548f | ||
|
|
58d96434e8 | ||
|
|
a1093a9b37 | ||
|
|
cccf15ce6c | ||
|
|
f977f8067e | ||
|
|
656e407e6d | ||
|
|
0b0309d5c3 | ||
|
|
112cee940e | ||
|
|
82f5a3bff4 | ||
|
|
24c1fae0ce | ||
|
|
9c8f25777c | ||
|
|
3ec4dce187 | ||
|
|
9f7c0fa57a | ||
|
|
fff085a79b | ||
|
|
1ce5dcf37d | ||
|
|
4b6a9486d8 | ||
|
|
8f1096a082 | ||
|
|
bee55277d9 |
No files matched your search
Regular → Executable
+12
@@ -1,3 +1,15 @@
|
||||
Current version
|
||||
=======
|
||||
|
||||
v0.0.4
|
||||
=======
|
||||
* Improved the Init of dependant Libs. More things work now.
|
||||
* Added a lot of wrapped functions.
|
||||
* Added a few wrapped libs (like libz or some other x11 related libs)
|
||||
* For trace enabled build, Trace can be enabled only after a certain amount of opcodes (still, a debugger would be better)
|
||||
* Some fixes in a few opcodes, and implemented x87 rounding (SuperMeatBoy behaves better now)
|
||||
* FTL 1.6.9 stiil sounds bad, but older 1.5.13 seems fine (different set of libs)
|
||||
|
||||
v0.0.2
|
||||
=======
|
||||
* A full commercial games runs fine on the Pandora: Airline Tycoon Deluxe
|
||||
|
||||
+40
-14
@@ -9,7 +9,7 @@ option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACH
|
||||
option(LD80BITS "Set to ON if host device have 80bits long double (i.e. i386)" ${LD80BITS})
|
||||
option(NOALIGN "Set to ON if host device doesn't need re-align (i.e. i386)" ${NOALIGN})
|
||||
option(HAVE_TRACE "Set to ON to have Trace ability (needs ZydisInfo library)" ${HAVE_TRACE})
|
||||
|
||||
option(USE_FLOAT "Set to ON to use only float, no double, in all x87 Emulation" ${USE_FLOAT})
|
||||
|
||||
# Pandora
|
||||
if(PANDORA)
|
||||
@@ -29,7 +29,11 @@ if(HAVE_TRACE)
|
||||
add_definitions(-DHAVE_TRACE)
|
||||
endif()
|
||||
|
||||
add_definitions(-g -std=gnu99 -funwind-tables -O3 -fvisibility=hidden -no-pie -fjump-tables)
|
||||
if(USE_FLOAT)
|
||||
add_definitions(-DUSE_FLOAT)
|
||||
endif()
|
||||
|
||||
add_definitions(-g -std=gnu99 -funwind-tables -O3 -fvisibility=hidden)
|
||||
|
||||
if(USE_CCACHE)
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
@@ -89,64 +93,86 @@ set(WRAPPEDS
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedsdl2image.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedsmpeg2.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedvorbisfile.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibvorbis.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibogg.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedpng16.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxxf86vm.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxrandr.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxext.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedxinerama.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxfixes.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxcursor.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxrender.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxi.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxss.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibx11xcb.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxcb.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibz.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedopenal.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedalut.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibjpeg.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedcurl.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedudev0.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappeddbus.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappediconv.c"
|
||||
"${CMAKE_HOME_DIRECTORY}/src/wrappedldlinux.c"
|
||||
)
|
||||
set(WRAPPER "${CMAKE_HOME_DIRECTORY}/src/wrapper.c" "${CMAKE_HOME_DIRECTORY}/src/wrapper.h")
|
||||
add_custom_command(OUTPUT ${WRAPPER} COMMAND "${CMAKE_HOME_DIRECTORY}/rebuild_wrappers.py" "${CMAKE_HOME_DIRECTORY}" MAIN_DEPENDENCY "${CMAKE_HOME_DIRECTORY}/rebuild_wrappers.py" DEPENDS ${WRAPPEDS})
|
||||
set_source_files_properties(${WRAPPER} PROPERTIES GENERATED TRUE)
|
||||
|
||||
add_executable(box86 ${ELFLOADER_SRC} ${WRAPPEDS})
|
||||
target_link_libraries(box86 m dl rt pthread)
|
||||
if(USE_FLOAT)
|
||||
set(BOX86 box86f)
|
||||
else()
|
||||
set(BOX86 box86)
|
||||
endif()
|
||||
|
||||
target_link_libraries(box86 -no-pie -Wl,-Ttext-segment,0xA8000000)
|
||||
add_executable(${BOX86} ${ELFLOADER_SRC} ${WRAPPEDS})
|
||||
target_link_libraries(${BOX86} m dl rt pthread)
|
||||
|
||||
add_test(test01 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
target_link_libraries(${BOX86} -Wl,-Ttext-segment,0xA8000000)
|
||||
|
||||
add_test(test01 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test01 -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref01.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
|
||||
add_test(test02 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
add_test(test02 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test02 -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref02.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
|
||||
add_test(test03 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
add_test(test03 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test03 -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref03.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
|
||||
add_test(test04 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
add_test(test04 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test04 -D TEST_ARGS2=yeah -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref04.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
|
||||
add_test(test05 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
add_test(test05 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test05 -D TEST_ARGS2=7 -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref05.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
|
||||
add_test(test06 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
add_test(test06 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test06 -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref06.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
|
||||
add_test(test07 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
add_test(test07 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test07 -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref07.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
|
||||
add_test(test08 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
add_test(test08 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test08 -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref08.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
|
||||
add_test(test09 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
|
||||
add_test(test09 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
|
||||
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test09 -D TEST_OUTPUT=tmpfile.txt
|
||||
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref09.txt
|
||||
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
Compiling
|
||||
----
|
||||
*for Pandora*
|
||||
|
||||
`mkdir build; cd build; cmake .. -DPANDORA=1; make`
|
||||
|
||||
*or for Other ARM Linux*
|
||||
|
||||
`mkdir build; cd build; cmake .. -DLD80BITS=1 -DNOALIGN=1; make`
|
||||
|
||||
*or for x86 Linux*
|
||||
|
||||
`mkdir build; cd build; cmake .. ; make`
|
||||
|
||||
*or use ccmake*
|
||||
|
||||
Alternatively, you can use the curses-bases ccmake (or any other gui frontend for cmake) to select wich platform to use interactively.
|
||||
|
||||
*use ccache if you have it*
|
||||
Add `-DUSE_CCACHE=1` if you have ccache (it's better if you plan to touch the sources)
|
||||
|
||||
*to have a Trace Enabled build*
|
||||
To have a trace enabled build (warning, it will be slower), add `-DHAVE_TRACE=1` but you will need, at runtime, to have the [Zydis library](https://github.com/zyantific/zydis) library in your `LD_LIBRARY_PATH` or in the system lib folders.
|
||||
|
||||
----
|
||||
|
||||
Testing
|
||||
----
|
||||
A few tests are included.
|
||||
They can be launched with `ctest`
|
||||
They are very basic and don't test much for now.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2018-2019 Sebastien Chevalier ("ptitSeb")
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -6,13 +6,41 @@ Box86 will let run x86 Linux program (games) on non-x86 Linux, like ARM (needs t
|
||||
|
||||
Also, Box86 use native version for some "system" libraries, like libc, libm, or SDL and OpenGL, leading to more performance and easier integration with host system.
|
||||
|
||||
Most x86 Games needs OpenGL, so on ARM platform, a solution like gl4es is probably needed.
|
||||
Most x86 Games needs OpenGL, so on ARM platform, a solution like [gl4es](https://github.com/ptitSeb/gl4es) is probably needed.
|
||||
|
||||
Current version is higly experimental and early, and most stuff wont run and run correctly. For now, WorldOfGoo does run correctly. FTL runs but sound is distorted...
|
||||
Note that current version of Box86 doesn't feature any form of JIT/Dynarec: expect everything to be slow.
|
||||
|
||||
Current version is higly experimental and early, and most stuff wont run and run correctly. For example, WorldOfGoo does run correctly (at least on the Pandora), Airline Tycoon Deluxe runs too. but if FTL runs, the music is distorted...
|
||||
|
||||
If you are serious about developping Box86, you should install ccache and activate it's support in the cmake project (use ccmake for example)
|
||||
To have the TRACE enabled (i.e. dumping to stdout all individual x86 instruction execute, with dump of registers), you'll also need [Zydis library](https://github.com/zyantific/zydis) accessible on your system.
|
||||
|
||||
Some x86 internal opcode use parts of "Realmode X86 Emulator Library", see [x86primop.c](src/x86primop.c) for copyright details
|
||||
|
||||
Change log is accessible [here](CHANGELOG.md)
|
||||
Here are 2 videos, one of "Airline Tycoon Deluxe" running on an gigahertz OpenPandora, and the other of "Bit.Trip.Runner" running on an ODroid XU4.
|
||||
|
||||
[](https://www.youtube.com/watch?v=bLt0hMoFDLk) [](https://www.youtube.com/watch?v=8hr71S029Hg)
|
||||
|
||||
----
|
||||
|
||||
Compiling
|
||||
----
|
||||
How to compile can be found [here](COMPILE.md)
|
||||
|
||||
----
|
||||
|
||||
Usage
|
||||
----
|
||||
|
||||
There are a few environnement variable to control Box86 behavour.
|
||||
|
||||
See [here](USAGE.md) for all variables and what they do.
|
||||
----
|
||||
|
||||
Version history
|
||||
----
|
||||
|
||||
The change log is [here](CHANGELOG.md)
|
||||
|
||||
|
||||
(If you use Box86 in your project, please don't forget to mention Box86)
|
||||
@@ -0,0 +1,46 @@
|
||||
Usage
|
||||
----
|
||||
|
||||
There are many environnement variable to control Box86 behavour.
|
||||
|
||||
##### BOX86_LOG
|
||||
Controls the Verbose level of the log
|
||||
* 0
|
||||
* NONE : No message (exept some fatal error)
|
||||
* 1
|
||||
* INFO : Current default. Show some log
|
||||
* 2
|
||||
* DEBUG : Verbose a lot of stuffs (like relocations or function called)
|
||||
* 3
|
||||
* DUMP : All DEBUG plus DUMP of all ELF Info
|
||||
|
||||
#### BOX86_LD_LIBRARY_PATH
|
||||
Controls the folder scanned to look for x86 libs. Default is current folder and `lib` in current folder.
|
||||
Also `/usr/lib/i386-linux-gnu` and `/lib/i386-linux-gnu` are added if they exists
|
||||
|
||||
#### BOX86_PATH
|
||||
Controls the folder scanned to look for x86 executable. Default is current folder and `bin` in current folder.
|
||||
|
||||
#### BOX86_DLSYM_ERROR
|
||||
* 0 : default. Don't log `dlsym` error
|
||||
* 1 : Log dlsym error
|
||||
|
||||
#### BOX86_TRACE_FILE
|
||||
Send all log and trace to a file instead of `stdout`
|
||||
|
||||
#### BOX86_TRACE
|
||||
Only on build with trace enabled. Trace allow the logging of all instruction execute, along with register dump
|
||||
* 0 : No trace
|
||||
* 1 : Trace enabled. The trace start after the init off all depending libs is done
|
||||
* symbolname : Trace only `symbolname` (trace is disable if the symbol is not found)
|
||||
* 0xXXXXXXX-0xYYYYYYY : trace only between the 2 addresses
|
||||
|
||||
#### BOX86_TRACE_START
|
||||
Only on build with trace enabled.
|
||||
* NNNNNNN : Start trace anly after NNNNNNNN opcode execute (number is an `uint64_t`)
|
||||
|
||||
#### BOX86_TRACE_XMM
|
||||
Only on build with trace enabled.
|
||||
* 0 : Default, the XMM (i.e. SSE/SSE2) register will not be logged with the general and x87 registers
|
||||
* 1 : Dump the XMM registers
|
||||
|
||||
+10
-4
@@ -88,6 +88,12 @@ typedef union ui64_s {
|
||||
uint32_t d[2];
|
||||
} ui64_t;
|
||||
|
||||
#ifdef USE_FLOAT
|
||||
#define ST0val ST0.f
|
||||
#else
|
||||
#define ST0val ST0.d
|
||||
#endif
|
||||
|
||||
""",
|
||||
"wrapper.h": """/*****************************************************************
|
||||
* File automatically generated by rebuild_wrappers.py (v1.0.0.02)
|
||||
@@ -202,10 +208,10 @@ typedef void (*wrapper_t)(x86emu_t* emu, uintptr_t fnc);
|
||||
"R_EAX=(unsigned short)fn({0});", # W
|
||||
"R_EAX=(uint32_t)fn({0});", # u
|
||||
"ui64_t r; r.u=(uint64_t)fn({0}); R_EAX=r.d[0]; R_EDX=r.d[1];", # U
|
||||
"float fl=fn({0}); fpu_do_push(emu); ST0.d = fl;", # f
|
||||
"double db=fn({0}); fpu_do_push(emu); ST0.d = db;", # d
|
||||
"long double ld=fn({0}); fpu_do_push(emu); ST0.d = ld;", # D
|
||||
"double db=fn({0}); fpu_do_push(emu); ST0.d = db;", # L
|
||||
"float fl=fn({0}); fpu_do_push(emu); ST0val = fl;", # f
|
||||
"double db=fn({0}); fpu_do_push(emu); ST0val = db;", # d
|
||||
"long double ld=fn({0}); fpu_do_push(emu); ST0val = ld;", # D
|
||||
"double db=fn({0}); fpu_do_push(emu); ST0val = db;", # L
|
||||
"R_EAX=(uintptr_t)fn({0});", # p
|
||||
"\n#error Invalid return type: va_list\n", # V
|
||||
]
|
||||
|
||||
+4
-2
@@ -23,10 +23,10 @@ box86context_t *NewBox86Context(int argc)
|
||||
|
||||
context->deferedInit = 1;
|
||||
|
||||
context->maplib = NewLibrarian();
|
||||
context->maplib = NewLibrarian(context);
|
||||
context->system = NewBridge();
|
||||
// create vsyscall
|
||||
context->vsyscall = AddBridge(context->system, vFv, x86Syscall);
|
||||
context->vsyscall = AddBridge(context->system, vFv, x86Syscall, 0);
|
||||
|
||||
context->box86lib = dlopen(NULL, RTLD_NOW|RTLD_GLOBAL);
|
||||
context->dlprivate = NewDLPrivate();
|
||||
@@ -37,6 +37,7 @@ box86context_t *NewBox86Context(int argc)
|
||||
context->argv = (char**)calloc(context->argc, sizeof(char*));
|
||||
|
||||
pthread_mutex_init(&context->mutex_once, NULL);
|
||||
pthread_mutex_init(&context->mutex_once2, NULL);
|
||||
|
||||
return context;
|
||||
}
|
||||
@@ -93,6 +94,7 @@ void FreeBox86Context(box86context_t** context)
|
||||
FreeCallbackList(&(*context)->callbacks);
|
||||
|
||||
pthread_mutex_destroy(&(*context)->mutex_once);
|
||||
pthread_mutex_destroy(&(*context)->mutex_once2);
|
||||
|
||||
free(*context);
|
||||
*context = NULL;
|
||||
|
||||
@@ -58,6 +58,7 @@ typedef struct box86context_s {
|
||||
callbacklist_t *callbacks; // all callbacks
|
||||
|
||||
pthread_mutex_t mutex_once;
|
||||
pthread_mutex_t mutex_once2;
|
||||
|
||||
library_t *libclib; // shortcut to libc library (if loaded, so probably yes)
|
||||
library_t *sdl1lib; // shortcut to SDL1 library (if loaded)
|
||||
@@ -66,6 +67,8 @@ typedef struct box86context_s {
|
||||
library_t *sdl2lib; // shortcut to SDL2 library (if loaded)
|
||||
library_t *sdl2mixerlib;
|
||||
library_t *sdl2imagelib;
|
||||
library_t *zlib;
|
||||
library_t *vorbisfile;
|
||||
|
||||
int deferedInit;
|
||||
elfheader_t **deferedInitList;
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@
|
||||
|
||||
#define BOX86_MAJOR 0
|
||||
#define BOX86_MINOR 0
|
||||
#define BOX86_REVISION 2
|
||||
#define BOX86_REVISION 4
|
||||
|
||||
#endif //__BOX86_VERSION_H_
|
||||
+4
-3
@@ -46,7 +46,7 @@ void FreeBridge(bridge_t** bridge)
|
||||
*bridge = NULL;
|
||||
}
|
||||
|
||||
uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc)
|
||||
uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N)
|
||||
{
|
||||
brick_t *b = bridge->last;
|
||||
if(b->sz == NBRICK) {
|
||||
@@ -58,7 +58,8 @@ uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc)
|
||||
b->b[b->sz].S = 'S'; b->b[b->sz].C='C';
|
||||
b->b[b->sz].w = w;
|
||||
b->b[b->sz].f = (uintptr_t)fnc;
|
||||
b->b[b->sz].C3 = 0xC3;
|
||||
b->b[b->sz].C3 = N?0xC2:0xC3;
|
||||
b->b[b->sz].N = N;
|
||||
// add bridge to map, for fast recovery
|
||||
int ret;
|
||||
khint_t k = kh_put(bridgemap, bridge->bridgemap, (uintptr_t)fnc, &ret);
|
||||
@@ -79,7 +80,7 @@ uintptr_t CheckBridged(bridge_t* bridge, void* fnc)
|
||||
void* GetNativeFnc(uintptr_t fnc)
|
||||
{
|
||||
onebridge_t *b = (onebridge_t*)fnc;
|
||||
if(b->CC != 0xCC || b->S!='S' || b->C!='C' || b->C3!=0xC3)
|
||||
if(b->CC != 0xCC || b->S!='S' || b->C!='C' || (b->C3!=0xC3 && b->C3!=0xC2))
|
||||
return NULL; // not a bridge?!
|
||||
return (void*)b->f;
|
||||
}
|
||||
+1
-1
@@ -10,7 +10,7 @@ typedef struct bridge_s bridge_t;
|
||||
bridge_t *NewBridge();
|
||||
void FreeBridge(bridge_t** bridge);
|
||||
|
||||
uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc);
|
||||
uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N);
|
||||
uintptr_t CheckBridged(bridge_t* bridge, void* fnc);
|
||||
void* GetNativeFnc(uintptr_t fnc);
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ typedef struct onebridge_s {
|
||||
uint8_t S, C; // 'S' 'C', just a signature
|
||||
wrapper_t w; // wrapper
|
||||
uintptr_t f; // the function for the wrapper
|
||||
uint8_t C3; // C3 ret
|
||||
uint8_t C3; // C2 or C3 ret
|
||||
uint16_t N; // N in case of C2 ret
|
||||
} onebridge_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
+90
-8
@@ -16,8 +16,8 @@ typedef struct onecallback_s {
|
||||
x86emu_t *emu;
|
||||
uintptr_t fnc;
|
||||
int nb_args;
|
||||
void* arg[8];
|
||||
void* stack;
|
||||
void* arg[10];
|
||||
int shared;
|
||||
} onecallback_t;
|
||||
|
||||
KHASH_MAP_INIT_INT(callbacks, onecallback_t*)
|
||||
@@ -31,9 +31,12 @@ typedef struct callbacklist_s {
|
||||
x86emu_t* AddCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, void* arg2, void* arg3, void* arg4)
|
||||
{
|
||||
callbacklist_t *callbacks = emu->context->callbacks;
|
||||
int stsize = 1024*1024;
|
||||
int stsize = 2*1024*1024; // 2MB stack (1MB is not enough for Xenonauts)
|
||||
void* stack = malloc(stsize);
|
||||
x86emu_t * newemu = NewX86Emu(emu->context, fnc, (uintptr_t)stack, stsize);
|
||||
if(!stack) {
|
||||
printf_log(LOG_NONE, "BOX86: Error, cannot allocate 2MB Stack for callback\n");
|
||||
}
|
||||
x86emu_t * newemu = NewX86Emu(emu->context, fnc, (uintptr_t)stack, stsize, 1);
|
||||
SetupX86Emu(newemu, emu->shared_global, emu->globals);
|
||||
newemu->trace_start = emu->trace_start;
|
||||
newemu->trace_end = emu->trace_end;
|
||||
@@ -43,7 +46,6 @@ x86emu_t* AddCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, voi
|
||||
khint_t k = kh_put(callbacks, callbacks->list, (uintptr_t)newemu, &ret);
|
||||
cb = kh_value(callbacks->list, k) = (onecallback_t*)calloc(1, sizeof(onecallback_t));
|
||||
|
||||
cb->stack = stack;
|
||||
cb->emu = newemu;
|
||||
cb->fnc = fnc;
|
||||
cb->nb_args = nb_args;
|
||||
@@ -52,6 +54,61 @@ x86emu_t* AddCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, voi
|
||||
cb->arg[2] = arg3;
|
||||
cb->arg[3] = arg4;
|
||||
|
||||
cb->shared = 0;
|
||||
|
||||
return newemu;
|
||||
}
|
||||
|
||||
x86emu_t* AddSmallCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, void* arg2, void* arg3, void* arg4)
|
||||
{
|
||||
callbacklist_t *callbacks = emu->context->callbacks;
|
||||
int stsize = 64*1024; // 64KB stack
|
||||
void* stack = malloc(stsize);
|
||||
if(!stack) {
|
||||
printf_log(LOG_NONE, "BOX86: Error, cannot allocate 64KB Stack for small callback\n");
|
||||
}
|
||||
x86emu_t * newemu = NewX86Emu(emu->context, fnc, (uintptr_t)stack, stsize, 1);
|
||||
SetupX86Emu(newemu, emu->shared_global, emu->globals);
|
||||
newemu->trace_start = emu->trace_start;
|
||||
newemu->trace_end = emu->trace_end;
|
||||
|
||||
onecallback_t * cb;
|
||||
int ret;
|
||||
khint_t k = kh_put(callbacks, callbacks->list, (uintptr_t)newemu, &ret);
|
||||
cb = kh_value(callbacks->list, k) = (onecallback_t*)calloc(1, sizeof(onecallback_t));
|
||||
|
||||
cb->emu = newemu;
|
||||
cb->fnc = fnc;
|
||||
cb->nb_args = nb_args;
|
||||
cb->arg[0] = arg1;
|
||||
cb->arg[1] = arg2;
|
||||
cb->arg[2] = arg3;
|
||||
cb->arg[3] = arg4;
|
||||
|
||||
cb->shared = 0;
|
||||
|
||||
return newemu;
|
||||
}
|
||||
|
||||
x86emu_t* AddSharedCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, void* arg2, void* arg3, void* arg4) //__attribute__((alias("AddCallback")));
|
||||
{
|
||||
callbacklist_t *callbacks = emu->context->callbacks;
|
||||
x86emu_t * newemu = emu;
|
||||
|
||||
onecallback_t * cb;
|
||||
int ret;
|
||||
khint_t k = kh_put(callbacks, callbacks->list, (uintptr_t)newemu, &ret);
|
||||
cb = kh_value(callbacks->list, k) = (onecallback_t*)calloc(1, sizeof(onecallback_t));
|
||||
|
||||
cb->emu = newemu;
|
||||
cb->fnc = fnc;
|
||||
cb->nb_args = nb_args;
|
||||
cb->arg[0] = arg1;
|
||||
cb->arg[1] = arg2;
|
||||
cb->arg[2] = arg3;
|
||||
cb->arg[3] = arg4;
|
||||
cb->shared = 1;
|
||||
|
||||
return newemu;
|
||||
}
|
||||
|
||||
@@ -73,8 +130,8 @@ void FreeCallback(x86emu_t* emu)
|
||||
if(k==kh_end(callbacks->list))
|
||||
return;
|
||||
onecallback_t* cb = kh_value(callbacks->list, k);
|
||||
FreeX86Emu(&cb->emu);
|
||||
free(cb->stack);
|
||||
if(!cb->shared)
|
||||
FreeX86Emu(&cb->emu);
|
||||
free(cb);
|
||||
kh_del(callbacks, callbacks->list, k);
|
||||
}
|
||||
@@ -86,6 +143,7 @@ uint32_t RunCallback(x86emu_t* emu)
|
||||
for (int i=cb->nb_args-1; i>=0; --i) // reverse order
|
||||
Push(emu, (uint32_t)cb->arg[i]);
|
||||
EmuCall(emu, cb->fnc);
|
||||
R_ESP+=(cb->nb_args*4);
|
||||
return R_EAX;
|
||||
}
|
||||
printf_log(LOG_INFO, "Warning, Callback not found?!\n");
|
||||
@@ -108,6 +166,31 @@ void SetCallbackNArg(x86emu_t* emu, int narg)
|
||||
}
|
||||
}
|
||||
|
||||
void* GetCallbackArg(x86emu_t* emu, int arg)
|
||||
{
|
||||
onecallback_t *cb = FindCallback(emu);
|
||||
if(cb) {
|
||||
return cb->arg[arg];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SetCallbackAddress(x86emu_t* emu, uintptr_t address)
|
||||
{
|
||||
onecallback_t *cb = FindCallback(emu);
|
||||
if(cb) {
|
||||
cb->fnc = address;
|
||||
}
|
||||
}
|
||||
|
||||
uintptr_t GetCallbackAddress(x86emu_t* emu)
|
||||
{
|
||||
onecallback_t *cb = FindCallback(emu);
|
||||
if(cb) {
|
||||
return cb->fnc;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
callbacklist_t* NewCallbackList()
|
||||
{
|
||||
@@ -125,7 +208,6 @@ void FreeCallbackList(callbacklist_t** callbacks)
|
||||
onecallback_t* cb;
|
||||
kh_foreach_value((*callbacks)->list, cb,
|
||||
FreeX86Emu(&cb->emu);
|
||||
free(cb->stack);
|
||||
free(cb);
|
||||
);
|
||||
kh_destroy(callbacks, (*callbacks)->list);
|
||||
|
||||
@@ -10,9 +10,14 @@ callbacklist_t* NewCallbackList();
|
||||
void FreeCallbackList(callbacklist_t** callbacks);
|
||||
|
||||
x86emu_t* AddCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, void* arg2, void* arg3, void* arg4);
|
||||
x86emu_t* AddSmallCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, void* arg2, void* arg3, void* arg4);
|
||||
x86emu_t* AddSharedCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, void* arg2, void* arg3, void* arg4);
|
||||
void FreeCallback(x86emu_t* emu);
|
||||
uint32_t RunCallback(x86emu_t* emu);
|
||||
void SetCallbackArg(x86emu_t* emu, int arg, void* val);
|
||||
void* GetCallbackArg(x86emu_t* emu, int arg);
|
||||
void SetCallbackNArg(x86emu_t* emu, int narg);
|
||||
void SetCallbackAddress(x86emu_t* emu, uintptr_t address);
|
||||
uintptr_t GetCallbackAddress(x86emu_t* emu);
|
||||
|
||||
#endif //__CALLBACK_H__
|
||||
@@ -2,6 +2,7 @@
|
||||
#define __DEBUG_H_
|
||||
|
||||
extern int box86_log; // log level
|
||||
extern int dlsym_error; // log dlsym error
|
||||
extern int trace_xmm; // include XMM reg in trace?
|
||||
#define LOG_NONE 0
|
||||
#define LOG_INFO 1
|
||||
|
||||
+118
-23
@@ -16,6 +16,7 @@
|
||||
#include "box86context.h"
|
||||
#include "library.h"
|
||||
#include "x86emu.h"
|
||||
#include "stack.h"
|
||||
|
||||
void FreeElfHeader(elfheader_t** head)
|
||||
{
|
||||
@@ -145,12 +146,17 @@ int RelocateElfREL(lib_t *maplib, elfheader_t* head, int cnt, Elf32_Rel *rel)
|
||||
{
|
||||
for (int i=0; i<cnt; ++i) {
|
||||
Elf32_Sym *sym = &head->DynSym[ELF32_R_SYM(rel[i].r_info)];
|
||||
int type = ELF32_ST_TYPE(sym->st_info);
|
||||
int bind = ELF32_ST_BIND(sym->st_info);
|
||||
const char* symname = SymName(head, sym);
|
||||
uint32_t *p = (uint32_t*)(rel[i].r_offset + head->delta);
|
||||
uintptr_t offs = 0;
|
||||
uint32_t sz = 0;
|
||||
uintptr_t end = 0;
|
||||
GetGlobalSymbolStartEnd(maplib, symname, &offs, &end, 0);
|
||||
if(bind==STB_LOCAL)
|
||||
GetLocalSymbolStartEnd(maplib, symname, &offs, &end, head);
|
||||
else
|
||||
GetGlobalSymbolStartEnd(maplib, symname, &offs, &end);
|
||||
uintptr_t globoffs, globend;
|
||||
int t = ELF32_R_TYPE(rel[i].r_info);
|
||||
switch(t) {
|
||||
@@ -159,18 +165,22 @@ int RelocateElfREL(lib_t *maplib, elfheader_t* head, int cnt, Elf32_Rel *rel)
|
||||
printf_log(LOG_DEBUG, "Ignoring %s @%p (%p)\n", DumpRelType(t), p, (void*)(p?(*p):0));
|
||||
break;
|
||||
case R_386_PC32:
|
||||
offs = (*p) + (offs - (uintptr_t)p);
|
||||
if (!offs) {
|
||||
printf_log(LOG_NONE, "Error: Global Symbol %s not found, cannot apply R_386_PC32 @%p (%p)\n", symname, p, *(void**)p);
|
||||
}
|
||||
offs = (offs - (uintptr_t)p);
|
||||
if(!offs)
|
||||
printf_log(LOG_DEBUG, "Apply R_386_PC32 @%p with sym=%s (%p -> %p)\n", p, symname, *(void**)p, (void*)(*(uintptr_t*)p+offs));
|
||||
*p += offs;
|
||||
break;
|
||||
case R_386_GLOB_DAT:
|
||||
// Look for same symbol already loaded but not in self
|
||||
if (GetGlobalSymbolStartEnd(maplib, symname, &globoffs, &globend, 1)) {
|
||||
if (GetGlobalNoWeakSymbolStartEnd(maplib, symname, &globoffs, &globend)) {
|
||||
offs = globoffs;
|
||||
end = globend;
|
||||
}
|
||||
if (!offs) {
|
||||
printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_386_GLOB_DAT @%p (%p)\n", symname, p, *(void**)p);
|
||||
printf_log(LOG_NONE, "Error: Global Symbol %s not found, cannot apply R_386_GLOB_DAT @%p (%p)\n", symname, p, *(void**)p);
|
||||
// return -1;
|
||||
} else {
|
||||
printf_log(LOG_DEBUG, "Apply R_386_GLOB_DAT @%p (%p -> %p) on sym=%s\n", p, (void*)(p?(*p):0), (void*)offs, symname);
|
||||
@@ -190,16 +200,18 @@ int RelocateElfREL(lib_t *maplib, elfheader_t* head, int cnt, Elf32_Rel *rel)
|
||||
*p += offs;
|
||||
}
|
||||
break;
|
||||
//case R_386_TLS_DTPMOD32:
|
||||
// try to use _dl_next_tls_modid() ?
|
||||
case R_386_TLS_DTPMOD32:
|
||||
// try to use _dl_next_tls_modid() ?
|
||||
// keeping 0 there should work, as a "current module" information?
|
||||
break;
|
||||
case R_386_TLS_DTPOFF32:
|
||||
case R_386_JMP_SLOT:
|
||||
if (!offs) {
|
||||
printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_386_JMP_SLOT @%p (%p)\n", symname, p, *(void**)p);
|
||||
printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply %s @%p (%p)\n", symname, (t==R_386_JMP_SLOT)?"R_386_JMP_SLOT":"R_386_TLS_DTPOFF32", p, *(void**)p);
|
||||
// return -1;
|
||||
} else {
|
||||
if(p) {
|
||||
printf_log(LOG_DEBUG, "Apply R_386_JMP_SLOT @%p with sym=%s (%p -> %p)\n", p, symname, *(void**)p, (void*)offs);
|
||||
printf_log(LOG_DEBUG, "Apply %s @%p with sym=%s (%p -> %p)\n", (t==R_386_JMP_SLOT)?"R_386_JMP_SLOT":"R_386_TLS_DTPOFF32", p, symname, *(void**)p, (void*)offs);
|
||||
*p = offs;
|
||||
} else {
|
||||
printf_log(LOG_NONE, "Warning, Symbol %s found, but Jump Slot Offset is NULL \n", symname);
|
||||
@@ -208,7 +220,7 @@ int RelocateElfREL(lib_t *maplib, elfheader_t* head, int cnt, Elf32_Rel *rel)
|
||||
break;
|
||||
case R_386_COPY:
|
||||
if(offs) {
|
||||
GetGlobalSymbolStartEnd(maplib, symname, &offs, &end, 1); // get original copy if any
|
||||
GetNoSelfSymbolStartEnd(maplib, symname, &offs, &end, head); // get original copy if any
|
||||
printf_log(LOG_DEBUG, "Apply R_386_COPY @%p with sym=%s, @%p size=%d (", p, symname, (void*)offs, sym->st_size);
|
||||
memmove(p, (void*)offs, sym->st_size);
|
||||
if(LOG_DEBUG<=box86_log) {
|
||||
@@ -243,7 +255,7 @@ int RelocateElfRELA(lib_t *maplib, elfheader_t* head, int cnt, Elf32_Rela *rela)
|
||||
// can be ignored
|
||||
break;
|
||||
case R_386_COPY:
|
||||
GetGlobalSymbolStartEnd(maplib, symname, &offs, &end,1);
|
||||
GetNoSelfSymbolStartEnd(maplib, symname, &offs, &end, head);
|
||||
if(offs) {
|
||||
// add r_addend to p?
|
||||
printf_log(LOG_DEBUG, "Apply R_386_COPY @%p with sym=%s, @%p size=%d\n", p, symname, (void*)offs, sym->st_size);
|
||||
@@ -295,7 +307,7 @@ int RelocateElfPlt(box86context_t* context, lib_t *maplib, elfheader_t* head)
|
||||
}
|
||||
if(head->gotplt) {
|
||||
if(pltResolver==~0) {
|
||||
pltResolver = AddBridge(context->system, vFEpp, PltResolver); // should be vFEuu
|
||||
pltResolver = AddBridge(context->system, vFEpp, PltResolver, 0); // should be vFEuu
|
||||
}
|
||||
*(uintptr_t*)(head->gotplt+head->delta+8) = pltResolver;
|
||||
printf_log(LOG_DEBUG, "PLT Resolver injected at %p\n", (void*)(head->gotplt+head->delta+8));
|
||||
@@ -370,41 +382,67 @@ uintptr_t GetLastByte(elfheader_t* h)
|
||||
return (uintptr_t)h->memory + h->delta + h->memsz;
|
||||
}
|
||||
|
||||
void AddGlobalsSymbols(lib_t *maplib, kh_mapsymbols_t* mapsymbols, elfheader_t* h)
|
||||
void AddSymbols(lib_t *maplib, kh_mapsymbols_t* mapsymbols, kh_mapsymbols_t* weaksymbols, kh_mapsymbols_t* localsymbols, elfheader_t* h)
|
||||
{
|
||||
// info == 161 => OBJECT UNIQUE
|
||||
// info == 33 => OBJECT WEAK
|
||||
printf_log(LOG_DUMP, "Will look for Symbol to add in SymTable(%d)\n", h->numSymTab);
|
||||
for (int i=0; i<h->numSymTab; ++i) {
|
||||
const char * symname = h->StrTab+h->SymTab[i].st_name;
|
||||
int bind = ELF32_ST_BIND(h->SymTab[i].st_info);
|
||||
int type = ELF32_ST_TYPE(h->SymTab[i].st_info);
|
||||
#if 0
|
||||
if(((h->SymTab[i].st_info & 2) || (h->SymTab[i].st_info == 17)
|
||||
|| (h->SymTab[i].st_info == 161 && !FindGlobalSymbol(maplib, symname))
|
||||
|| (h->SymTab[i].st_info == 33)
|
||||
)
|
||||
&& (h->SymTab[i].st_other==0) && (h->SymTab[i].st_shndx!=0)) {
|
||||
if(!h->SymTab[i].st_value && FindGlobalSymbol(maplib, symname))
|
||||
break;
|
||||
continue;
|
||||
#else
|
||||
if((type==STT_OBJECT || type==STT_FUNC || type==STT_COMMON || type==STT_TLS)
|
||||
&& (h->SymTab[i].st_other==0) && (h->SymTab[i].st_shndx!=0)) {
|
||||
if(bind==10/*STB_GNU_UNIQUE*/ && FindGlobalSymbol(maplib, symname))
|
||||
continue;
|
||||
#endif
|
||||
uintptr_t offs = h->SymTab[i].st_value + h->delta;
|
||||
uint32_t sz = h->SymTab[i].st_size;
|
||||
printf_log(LOG_DUMP, "Adding Symbol \"%s\" with offset=%p sz=%d\n", symname, (void*)offs, sz);
|
||||
AddSymbol(mapsymbols, symname, offs, sz);
|
||||
printf_log(LOG_DUMP, "Adding Symbol(bind=%d) \"%s\" with offset=%p sz=%d\n", bind, symname, (void*)offs, sz);
|
||||
if(bind==STB_LOCAL)
|
||||
AddSymbol(localsymbols, symname, offs, sz);
|
||||
else if(bind==STB_WEAK)
|
||||
AddSymbol(weaksymbols, symname, offs, sz);
|
||||
else
|
||||
AddSymbol(mapsymbols, symname, offs, sz);
|
||||
}
|
||||
}
|
||||
|
||||
printf_log(LOG_DUMP, "Will look for Symbol to add in DynSym (%d)\n", h->numDynSym);
|
||||
for (int i=0; i<h->numDynSym; ++i) {
|
||||
const char * symname = h->DynStr+h->DynSym[i].st_name;
|
||||
int bind = ELF32_ST_BIND(h->DynSym[i].st_info);
|
||||
int type = ELF32_ST_TYPE(h->DynSym[i].st_info);
|
||||
#if 0
|
||||
if(((h->DynSym[i].st_info & 2) || (h->DynSym[i].st_info == 17)
|
||||
|| (h->DynSym[i].st_info == 161 && !FindGlobalSymbol(maplib, symname))
|
||||
|| (h->DynSym[i].st_info == 33)
|
||||
)
|
||||
&& (h->DynSym[i].st_other==0) && (h->DynSym[i].st_shndx!=0 && h->DynSym[i].st_shndx<62521)) {
|
||||
if(!h->DynSym[i].st_value && FindGlobalSymbol(maplib, symname))
|
||||
break;
|
||||
continue;
|
||||
#else
|
||||
if((type==STT_OBJECT || type==STT_FUNC || type==STT_COMMON || type==STT_TLS)
|
||||
&& (h->DynSym[i].st_other==0) && (h->DynSym[i].st_shndx!=0 && h->DynSym[i].st_shndx<62521)) {
|
||||
if(bind==10/*STB_GNU_UNIQUE*/ && FindGlobalSymbol(maplib, symname))
|
||||
continue;
|
||||
#endif
|
||||
uintptr_t offs = h->DynSym[i].st_value + h->delta;
|
||||
uint32_t sz = h->DynSym[i].st_size;
|
||||
printf_log(LOG_DUMP, "Adding Symbol \"%s\" with offset=%p sz=%d\n", symname, (void*)offs, sz);
|
||||
AddSymbol(mapsymbols, symname, offs, sz);
|
||||
printf_log(LOG_DUMP, "Adding Symbol(bind=%d) \"%s\" with offset=%p sz=%d\n", bind, symname, (void*)offs, sz);
|
||||
if(bind==STB_LOCAL)
|
||||
AddSymbol(localsymbols, symname, offs, sz);
|
||||
else if(bind==STB_WEAK)
|
||||
AddSymbol(weaksymbols, symname, offs, sz);
|
||||
else
|
||||
AddSymbol(mapsymbols, symname, offs, sz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,8 +465,7 @@ expansion, see “System Specific Shared Objects”
|
||||
int LoadNeededLib(elfheader_t* h, lib_t *maplib, box86context_t *box86, x86emu_t* emu)
|
||||
{
|
||||
DumpDynamicNeeded(h);
|
||||
// reverse order on needed libs
|
||||
for (int i=h->numDynamic-1; i>=0; --i)
|
||||
for (int i=0; i<h->numDynamic; ++i)
|
||||
if(h->Dynamic[i].d_tag==DT_NEEDED) {
|
||||
char *needed = h->DynStrTab+h->delta+h->Dynamic[i].d_un.d_val;
|
||||
// TODO: Add LD_LIBRARY_PATH and RPATH Handling
|
||||
@@ -455,7 +492,13 @@ void RunElfInit(elfheader_t* h, x86emu_t *emu)
|
||||
return;
|
||||
}
|
||||
printf_log(LOG_DEBUG, "Calling Init for %s @%p\n", ElfName(h), (void*)p);
|
||||
EmuCall(emu, p);
|
||||
EmuCall(emu, p); // should be sure that argc, argv and env are pushed to the stack!
|
||||
// and check init array now
|
||||
Elf32_Addr *addr = (Elf32_Addr*)(h->initarray + h->delta);
|
||||
for (int i=0; i<h->initarray_sz; ++i) {
|
||||
printf_log(LOG_DEBUG, "Calling Init[%d] for %s @%p\n", i, ElfName(h), (void*)addr[i]);
|
||||
EmuCall(emu, (uintptr_t)addr[i]);
|
||||
}
|
||||
h->init_done = 1;
|
||||
return;
|
||||
}
|
||||
@@ -479,7 +522,18 @@ void RunElfFini(elfheader_t* h, x86emu_t *emu)
|
||||
return;
|
||||
uintptr_t p = h->finientry + h->delta;
|
||||
printf_log(LOG_DEBUG, "Calling Fini for %s @%p\n", ElfName(h), (void*)p);
|
||||
uint32_t sESP = GetESP(emu);
|
||||
Push32(emu, (uintptr_t)GetEmuContext(emu)->envv);
|
||||
Push32(emu, (uintptr_t)GetEmuContext(emu)->argv);
|
||||
Push32(emu, GetEmuContext(emu)->argc);
|
||||
EmuCall(emu, p);
|
||||
// and check fini array now
|
||||
Elf32_Addr *addr = (Elf32_Addr*)(h->finiarray + h->delta);
|
||||
for (int i=0; i<h->finiarray_sz; ++i) {
|
||||
printf_log(LOG_DEBUG, "Calling Fini[%d] for %s @%p\n", i, ElfName(h), (void*)addr[i]);
|
||||
EmuCall(emu, (uintptr_t)addr[i]);
|
||||
}
|
||||
SetESP(emu, sESP);
|
||||
h->fini_done = 1;
|
||||
return;
|
||||
}
|
||||
@@ -492,3 +546,44 @@ uintptr_t GetElfFini(elfheader_t* h)
|
||||
{
|
||||
return h->finientry + h->delta;
|
||||
}
|
||||
|
||||
void* GetBaseAddress(elfheader_t* h)
|
||||
{
|
||||
return h->memory;
|
||||
}
|
||||
|
||||
uint32_t GetBaseSize(elfheader_t* h)
|
||||
{
|
||||
return h->memsz;
|
||||
}
|
||||
|
||||
const char* FindNearestSymbolName(elfheader_t* h, void* p, uintptr_t* start, uint32_t* sz)
|
||||
{
|
||||
uintptr_t addr = (uintptr_t)p;
|
||||
|
||||
uint32_t distance = 0x7fffffff;
|
||||
const char* ret = NULL;
|
||||
uintptr_t s = 0;
|
||||
uint32_t size = 0;
|
||||
|
||||
for (int i=0; i<h->numSymTab && distance!=0; ++i) {
|
||||
const char * symname = h->StrTab+h->SymTab[i].st_name;
|
||||
uintptr_t offs = h->SymTab[i].st_value + h->delta;
|
||||
|
||||
if(offs<addr) {
|
||||
if(distance>addr-offs) {
|
||||
distance = addr-offs;
|
||||
ret = symname;
|
||||
s = offs;
|
||||
size = h->SymTab[i].st_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(start)
|
||||
*start = s;
|
||||
if(sz)
|
||||
*sz = size;
|
||||
|
||||
return ret;
|
||||
}
|
||||
+4
-1
@@ -22,12 +22,15 @@ int RelocateElfPlt(box86context_t* context, lib_t *maplib, elfheader_t* head);
|
||||
void CalcStack(elfheader_t* h, uint32_t* stacksz, int* stackalign);
|
||||
uintptr_t GetEntryPoint(lib_t* maplib, elfheader_t* h);
|
||||
uintptr_t GetLastByte(elfheader_t* h);
|
||||
void AddGlobalsSymbols(lib_t *maplib, kh_mapsymbols_t* mapsymbols, elfheader_t* h);
|
||||
void AddSymbols(lib_t *maplib, kh_mapsymbols_t* mapsymbols, kh_mapsymbols_t* weaksymbols, kh_mapsymbols_t* localsymbols, elfheader_t* h);
|
||||
int LoadNeededLib(elfheader_t* h, lib_t *maplib, box86context_t* box86, x86emu_t* emu);
|
||||
uintptr_t GetElfInit(elfheader_t* h);
|
||||
uintptr_t GetElfFini(elfheader_t* h);
|
||||
void RunElfInit(elfheader_t* h, x86emu_t *emu);
|
||||
void RunElfFini(elfheader_t* h, x86emu_t *emu);
|
||||
void RunDeferedElfInit(x86emu_t *emu);
|
||||
void* GetBaseAddress(elfheader_t* h);
|
||||
uint32_t GetBaseSize(elfheader_t* h);
|
||||
const char* FindNearestSymbolName(elfheader_t* h, void* p, uintptr_t* start, uint32_t* sz);
|
||||
|
||||
#endif //__ELF_LOADER_H_
|
||||
@@ -25,7 +25,11 @@ struct elfheader_s {
|
||||
|
||||
uintptr_t entrypoint;
|
||||
uintptr_t initentry;
|
||||
uintptr_t initarray;
|
||||
int initarray_sz;
|
||||
uintptr_t finientry;
|
||||
uintptr_t finiarray;
|
||||
int finiarray_sz;
|
||||
|
||||
uintptr_t rel;
|
||||
int relsz;
|
||||
|
||||
@@ -256,12 +256,26 @@ void* LoadAndCheckElfHeader(FILE* f, const char* name, int exec)
|
||||
h->initentry = h->SHEntries[ii].sh_addr;
|
||||
printf_log(LOG_DEBUG, "The .init is at address %p\n", (void*)h->initentry);
|
||||
}
|
||||
// and .init_array
|
||||
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".init_array");
|
||||
if(ii) {
|
||||
h->initarray_sz = h->SHEntries[ii].sh_size / sizeof(Elf32_Addr);
|
||||
h->initarray = (uintptr_t)(h->SHEntries[ii].sh_addr);
|
||||
printf_log(LOG_DEBUG, "The .init_array is at address %p, and have %d elements\n", (void*)h->initarray, h->initarray_sz);
|
||||
}
|
||||
// look for .fini entry point
|
||||
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".fini");
|
||||
if(ii) {
|
||||
h->finientry = h->SHEntries[ii].sh_addr;
|
||||
printf_log(LOG_DEBUG, "The .fini is at address %p\n", (void*)h->finientry);
|
||||
}
|
||||
// and .fini_array
|
||||
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".fini_array");
|
||||
if(ii) {
|
||||
h->finiarray_sz = h->SHEntries[ii].sh_size / sizeof(Elf32_Addr);
|
||||
h->finiarray = (uintptr_t)(h->SHEntries[ii].sh_addr);
|
||||
printf_log(LOG_DEBUG, "The .fini_array is at address %p, and have %d elements\n", (void*)h->finiarray, h->finiarray_sz);
|
||||
}
|
||||
|
||||
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".dynstr", "DynSym Strings", SHT_STRTAB, (void**)&h->DynStr, NULL);
|
||||
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".dynsym", "DynSym", SHT_DYNSYM, (void**)&h->DynSym, &h->numDynSym);
|
||||
|
||||
+134
-9
@@ -8,18 +8,24 @@
|
||||
#include "librarian_private.h"
|
||||
#include "library.h"
|
||||
#include "x86emu.h"
|
||||
#include "box86context.h"
|
||||
#include "elfloader.h"
|
||||
|
||||
#include "bridge.h"
|
||||
|
||||
KHASH_MAP_IMPL_STR(mapsymbols, onesymbol_t);
|
||||
|
||||
lib_t *NewLibrarian()
|
||||
lib_t *NewLibrarian(box86context_t* context)
|
||||
{
|
||||
lib_t *maplib = (lib_t*)calloc(1, sizeof(lib_t));
|
||||
|
||||
maplib->mapsymbols = kh_init(mapsymbols);
|
||||
maplib->weaksymbols = kh_init(mapsymbols);
|
||||
maplib->localsymbols = kh_init(mapsymbols);
|
||||
maplib->bridge = NewBridge();
|
||||
|
||||
maplib->context = context;
|
||||
|
||||
return maplib;
|
||||
}
|
||||
void FreeLibrarian(lib_t **maplib)
|
||||
@@ -27,6 +33,12 @@ void FreeLibrarian(lib_t **maplib)
|
||||
if((*maplib)->mapsymbols) {
|
||||
kh_destroy(mapsymbols, (*maplib)->mapsymbols);
|
||||
}
|
||||
if((*maplib)->weaksymbols) {
|
||||
kh_destroy(mapsymbols, (*maplib)->weaksymbols);
|
||||
}
|
||||
if((*maplib)->localsymbols) {
|
||||
kh_destroy(mapsymbols, (*maplib)->localsymbols);
|
||||
}
|
||||
// should that be in reverse order?
|
||||
for (int i=0; i<(*maplib)->libsz; ++i) {
|
||||
FreeLibrary(&(*maplib)->libraries[i].lib);
|
||||
@@ -48,6 +60,16 @@ kh_mapsymbols_t* GetMapSymbol(lib_t* maplib)
|
||||
return maplib->mapsymbols;
|
||||
}
|
||||
|
||||
kh_mapsymbols_t* GetWeakSymbol(lib_t* maplib)
|
||||
{
|
||||
return maplib->weaksymbols;
|
||||
}
|
||||
|
||||
kh_mapsymbols_t* GetLocalSymbol(lib_t* maplib)
|
||||
{
|
||||
return maplib->localsymbols;
|
||||
}
|
||||
|
||||
library_t* getLib(lib_t* maplib, const char* path)
|
||||
{
|
||||
for(int i=0; i<maplib->libsz; ++i) {
|
||||
@@ -100,34 +122,93 @@ library_t* GetLib(lib_t* maplib, const char* name)
|
||||
uintptr_t FindGlobalSymbol(lib_t *maplib, const char* name)
|
||||
{
|
||||
uintptr_t start = 0, end = 0;
|
||||
if(GetGlobalSymbolStartEnd(maplib, name, &start, &end, 0))
|
||||
if(GetGlobalSymbolStartEnd(maplib, name, &start, &end))
|
||||
return start;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetGlobalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, int self)
|
||||
int GetNoSelfSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t* self)
|
||||
{
|
||||
//excude self if defined
|
||||
if(maplib->context->elfs[0]!=self) {
|
||||
if(GetSymbolStartEnd(maplib->mapsymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
if(GetSymbolStartEnd(maplib->weaksymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
}
|
||||
for(int i=0; i<maplib->libsz; ++i) {
|
||||
if(GetElfIndex(maplib->libraries[i].lib)==-1 || (maplib->context->elfs[GetElfIndex(maplib->libraries[i].lib)]!=self))
|
||||
if(GetLibSymbolStartEnd(maplib->libraries[i].lib, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
}
|
||||
// if self defined, give it another chance with self...
|
||||
if(self) {
|
||||
if(maplib->context->elfs[0]==self) {
|
||||
if(GetSymbolStartEnd(maplib->mapsymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
if(GetSymbolStartEnd(maplib->weaksymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
}
|
||||
for(int i=0; i<maplib->libsz; ++i) {
|
||||
if(GetElfIndex(maplib->libraries[i].lib)!=-1 && (maplib->context->elfs[GetElfIndex(maplib->libraries[i].lib)]==self))
|
||||
if(GetLibSymbolStartEnd(maplib->libraries[i].lib, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// nope, not found
|
||||
return 0;
|
||||
}
|
||||
int GetGlobalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end)
|
||||
{
|
||||
if(!self)
|
||||
if(GetSymbolStartEnd(maplib->mapsymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
if(GetSymbolStartEnd(maplib->weaksymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
for(int i=0; i<maplib->libsz; ++i) {
|
||||
if(GetLibSymbolStartEnd(maplib->libraries[i].lib, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
}
|
||||
if(self)
|
||||
if(GetSymbolStartEnd(maplib->mapsymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
// nope, not found
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetLocalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end)
|
||||
int GetGlobalNoWeakSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end)
|
||||
{
|
||||
//excude self if defined
|
||||
if(GetSymbolStartEnd(maplib->mapsymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
for(int i=0; i<maplib->libsz; ++i)
|
||||
if(GetLibNoWeakSymbolStartEnd(maplib->libraries[i].lib, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
// nope, not found
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetLocalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self)
|
||||
{
|
||||
if(maplib->context->elfs[0]==self) {
|
||||
if(GetSymbolStartEnd(maplib->localsymbols, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
} else {
|
||||
for(int i=0; i<maplib->libsz; ++i) {
|
||||
if(GetElfIndex(maplib->libraries[i].lib)!=-1 && (maplib->context->elfs[GetElfIndex(maplib->libraries[i].lib)]==self))
|
||||
if(GetLibLocalSymbolStartEnd(maplib->libraries[i].lib, name, start, end))
|
||||
if(*start)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -155,3 +236,47 @@ int GetSymbolStartEnd(kh_mapsymbols_t* mapsymbols, const char* name, uintptr_t*
|
||||
*end = *start + kh_val(mapsymbols, k).sz;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* GetSymbolName(kh_mapsymbols_t* mapsymbols, void* p, uintptr_t* start, uint32_t* sz)
|
||||
{
|
||||
uintptr_t addr = (uintptr_t)p;
|
||||
onesymbol_t *one;
|
||||
kh_foreach_value_ref(mapsymbols, one,
|
||||
if((one->offs >= addr) && (one->offs+one->sz<addr)) {
|
||||
*start = one->offs;
|
||||
*sz = one->sz;
|
||||
return kh_key(mapsymbols, __i);
|
||||
}
|
||||
);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* FindSymbolName(lib_t *maplib, void* p, void** start, uint32_t* sz, const char** libname, void** base)
|
||||
{
|
||||
// first, search in self...
|
||||
const char* ret = NULL;
|
||||
uintptr_t offs = 0;
|
||||
uint32_t size = 0;
|
||||
uintptr_t elf_start = 0;
|
||||
uintptr_t elf_end = 0;
|
||||
// loop the elfs...
|
||||
for(int i=0; i<maplib->context->elfsize && !ret; ++i) {
|
||||
elf_start = (uintptr_t)GetBaseAddress(maplib->context->elfs[i]);
|
||||
elf_end = elf_start + GetBaseSize(maplib->context->elfs[i]);
|
||||
if((uintptr_t)p>=elf_start && (uintptr_t)p<elf_end)
|
||||
ret = FindNearestSymbolName(maplib->context->elfs[i], p, &offs, &size);
|
||||
}
|
||||
if(ret) {
|
||||
if(start)
|
||||
*start = (void*)offs;
|
||||
if(sz)
|
||||
*sz = size;
|
||||
if(libname)
|
||||
*libname = maplib->context->fullpath;
|
||||
if(base)
|
||||
*base = (void*)elf_start;
|
||||
return ret;
|
||||
}
|
||||
// TODO: then search in the other libs...
|
||||
return NULL;
|
||||
}
|
||||
+12
-3
@@ -9,21 +9,30 @@ typedef struct kh_mapsymbols_s kh_mapsymbols_t;
|
||||
typedef struct dlprivate_s dlprivate_t;
|
||||
typedef struct box86context_s box86context_t;
|
||||
typedef struct x86emu_s x86emu_t;
|
||||
typedef struct elfheader_s elfheader_t;
|
||||
typedef struct box86context_s box86context_t;
|
||||
|
||||
lib_t *NewLibrarian();
|
||||
lib_t *NewLibrarian(box86context_t* context);
|
||||
void FreeLibrarian(lib_t **maplib);
|
||||
dlprivate_t *NewDLPrivate();
|
||||
void FreeDLPrivate(dlprivate_t **lib);
|
||||
|
||||
kh_mapsymbols_t* GetMapSymbol(lib_t* maplib);
|
||||
kh_mapsymbols_t* GetWeakSymbol(lib_t* maplib);
|
||||
kh_mapsymbols_t* GetLocalSymbol(lib_t* maplib);
|
||||
int AddNeededLib(lib_t* maplib, const char* path, box86context_t* box86, x86emu_t* emu); // 0=success, 1=error
|
||||
library_t* GetLib(lib_t* maplib, const char* name);
|
||||
uintptr_t FindGlobalSymbol(lib_t *maplib, const char* name);
|
||||
int GetGlobalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, int self);
|
||||
int GetLocalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end);
|
||||
int GetNoSelfSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t* self);
|
||||
int GetGlobalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end);
|
||||
int GetGlobalNoWeakSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end);
|
||||
int GetLocalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self);
|
||||
|
||||
void AddSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz);
|
||||
uintptr_t FindSymbol(kh_mapsymbols_t *mapsymbols, const char* name);
|
||||
int GetSymbolStartEnd(kh_mapsymbols_t* mapsymbols, const char* name, uintptr_t* start, uintptr_t* end);
|
||||
const char* GetSymbolName(kh_mapsymbols_t* mapsymbols, void* p, uintptr_t* offs, uint32_t* sz);
|
||||
|
||||
const char* FindSymbolName(lib_t *maplib, void* p, void** start, uint32_t* sz, const char** libname, void** base);
|
||||
|
||||
#endif //__LIBRARIAN_H_
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <stdint.h>
|
||||
#include "khash.h"
|
||||
|
||||
typedef struct box86context_s box86context_t;
|
||||
|
||||
typedef struct onesymbol_s {
|
||||
uintptr_t offs;
|
||||
uint32_t sz;
|
||||
@@ -19,11 +21,15 @@ KHASH_MAP_DECLARE_STR(mapsymbols, onesymbol_t)
|
||||
|
||||
typedef struct lib_s {
|
||||
khash_t(mapsymbols) *mapsymbols;
|
||||
khash_t(mapsymbols) *weaksymbols;
|
||||
khash_t(mapsymbols) *localsymbols;
|
||||
onelib_t *libraries;
|
||||
int libsz;
|
||||
int libcap;
|
||||
|
||||
box86context_t* context;
|
||||
|
||||
bridge_t *bridge; // all x86 -> arm bridge
|
||||
bridge_t *bridge; // all x86 -> arm bridge
|
||||
} lib_t;
|
||||
|
||||
#endif //__LIBRARIAN_PRIVATE_H_
|
||||
+164
-16
@@ -23,11 +23,12 @@
|
||||
// create the native lib list
|
||||
#define GO(P, N) int wrapped##N##_init(library_t* lib, box86context_t *box86); \
|
||||
void wrapped##N##_fini(library_t* lib);\
|
||||
int wrapped##N##_get(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz);
|
||||
int wrapped##N##_get(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz); \
|
||||
int wrapped##N##_getnoweak(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz);
|
||||
#include "library_list.h"
|
||||
#undef GO
|
||||
|
||||
#define GO(P, N) {P, wrapped##N##_init, wrapped##N##_fini, wrapped##N##_get},
|
||||
#define GO(P, N) {P, wrapped##N##_init, wrapped##N##_fini, wrapped##N##_get, wrapped##N##_getnoweak},
|
||||
wrappedlib_t wrappedlibs[] = {
|
||||
#include "library_list.h"
|
||||
};
|
||||
@@ -77,9 +78,26 @@ int NbDot(const char* name)
|
||||
void EmuLib_Fini(library_t* lib)
|
||||
{
|
||||
kh_destroy(mapsymbols, lib->priv.n.mapsymbols);
|
||||
kh_destroy(mapsymbols, lib->priv.n.localsymbols);
|
||||
}
|
||||
|
||||
int EmuLib_Get(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz)
|
||||
{
|
||||
khint_t k;
|
||||
k = kh_get(mapsymbols, lib->priv.n.mapsymbols, name);
|
||||
if(k==kh_end(lib->priv.n.mapsymbols)) {
|
||||
k = kh_get(mapsymbols, lib->priv.n.weaksymbols, name);
|
||||
if(k==kh_end(lib->priv.n.weaksymbols))
|
||||
return 0;
|
||||
*offs = kh_value(lib->priv.n.weaksymbols, k).offs;
|
||||
*sz = kh_value(lib->priv.n.weaksymbols, k).sz;
|
||||
return *offs;
|
||||
}
|
||||
*offs = kh_value(lib->priv.n.mapsymbols, k).offs;
|
||||
*sz = kh_value(lib->priv.n.mapsymbols, k).sz;
|
||||
return *offs;
|
||||
}
|
||||
int EmuLib_GetNoWeak(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz)
|
||||
{
|
||||
khint_t k;
|
||||
k = kh_get(mapsymbols, lib->priv.n.mapsymbols, name);
|
||||
@@ -89,6 +107,21 @@ int EmuLib_Get(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz)
|
||||
*sz = kh_value(lib->priv.n.mapsymbols, k).sz;
|
||||
return *offs;
|
||||
}
|
||||
int EmuLib_GetLocal(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz)
|
||||
{
|
||||
khint_t k;
|
||||
k = kh_get(mapsymbols, lib->priv.n.localsymbols, name);
|
||||
if(k==kh_end(lib->priv.n.localsymbols))
|
||||
return 0;
|
||||
*offs = kh_value(lib->priv.n.localsymbols, k).offs;
|
||||
*sz = kh_value(lib->priv.n.localsymbols, k).sz;
|
||||
return *offs;
|
||||
}
|
||||
|
||||
int NativeLib_GetLocal(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
library_t *NewLibrary(const char* path, box86context_t* context)
|
||||
{
|
||||
@@ -114,6 +147,8 @@ library_t *NewLibrary(const char* path, box86context_t* context)
|
||||
lib->context = context;
|
||||
lib->fini = wrappedlibs[i].fini;
|
||||
lib->get = wrappedlibs[i].get;
|
||||
lib->getnoweak = wrappedlibs[i].getnoweak;
|
||||
lib->getlocal = NativeLib_GetLocal;
|
||||
lib->type = 0;
|
||||
// Call librarian to load all dependant elf
|
||||
for(int i=0; i<lib->priv.w.needed; ++i)
|
||||
@@ -177,8 +212,12 @@ library_t *NewLibrary(const char* path, box86context_t* context)
|
||||
lib->context = context;
|
||||
lib->fini = EmuLib_Fini;
|
||||
lib->get = EmuLib_Get;
|
||||
lib->getnoweak = EmuLib_GetNoWeak;
|
||||
lib->getlocal = EmuLib_GetLocal;
|
||||
lib->priv.n.elf_index = mainelf;
|
||||
lib->priv.n.mapsymbols = kh_init(mapsymbols);
|
||||
lib->priv.n.weaksymbols = kh_init(mapsymbols);
|
||||
lib->priv.n.localsymbols = kh_init(mapsymbols);
|
||||
|
||||
printf_log(LOG_INFO, "Using emulated %s\n", libname);
|
||||
|
||||
@@ -200,7 +239,7 @@ int FinalizeLibrary(library_t* lib, x86emu_t* emu)
|
||||
if(lib->type==1) {
|
||||
elfheader_t *elf_header = lib->context->elfs[lib->priv.n.elf_index];
|
||||
// add symbols
|
||||
AddGlobalsSymbols(lib->context->maplib, lib->priv.n.mapsymbols, elf_header);
|
||||
AddSymbols(lib->context->maplib, lib->priv.n.mapsymbols, lib->priv.n.weaksymbols, lib->priv.n.localsymbols, elf_header);
|
||||
// Call librarian to load all dependant elf
|
||||
if(LoadNeededLib(elf_header, lib->context->maplib, lib->context, emu)) {
|
||||
printf_log(LOG_NONE, "Error: loading needed libs in elf %s\n", lib->name);
|
||||
@@ -212,6 +251,7 @@ int FinalizeLibrary(library_t* lib, x86emu_t* emu)
|
||||
return 1;
|
||||
}
|
||||
RelocateElfPlt(lib->context, lib->context->maplib, elf_header);
|
||||
// init (will use PltRelocator... because some other libs are not yet resolved)
|
||||
RunElfInit(elf_header, emu);
|
||||
}
|
||||
return 0;
|
||||
@@ -236,12 +276,18 @@ void FreeLibrary(library_t **lib)
|
||||
}
|
||||
if((*lib)->symbolmap)
|
||||
kh_destroy(symbolmap, (*lib)->symbolmap);
|
||||
if((*lib)->wsymbolmap)
|
||||
kh_destroy(symbolmap, (*lib)->wsymbolmap);
|
||||
if((*lib)->datamap)
|
||||
kh_destroy(datamap, (*lib)->datamap);
|
||||
if((*lib)->wdatamap)
|
||||
kh_destroy(datamap, (*lib)->wdatamap);
|
||||
if((*lib)->mydatamap)
|
||||
kh_destroy(datamap, (*lib)->mydatamap);
|
||||
if((*lib)->mysymbolmap)
|
||||
kh_destroy(symbolmap, (*lib)->mysymbolmap);
|
||||
if((*lib)->stsymbolmap)
|
||||
kh_destroy(symbolmap, (*lib)->stsymbolmap);
|
||||
if((*lib)->symbol2map)
|
||||
kh_destroy(symbol2map, (*lib)->symbol2map);
|
||||
|
||||
@@ -271,6 +317,8 @@ int IsSameLib(library_t* lib, const char* path)
|
||||
}
|
||||
int GetLibSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end)
|
||||
{
|
||||
if(!name[0])
|
||||
return 0;
|
||||
khint_t k;
|
||||
// check first if already in the map
|
||||
k = kh_get(bridgemap, lib->bridgemap, name);
|
||||
@@ -293,7 +341,58 @@ int GetLibSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uin
|
||||
// nope
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetLibNoWeakSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end)
|
||||
{
|
||||
if(!name[0])
|
||||
return 0;
|
||||
khint_t k;
|
||||
// get a new symbol
|
||||
if(lib->getnoweak(lib, name, start, end)) {
|
||||
*end += *start; // lib->get(...) gives size, not end
|
||||
// check if already in the map
|
||||
k = kh_get(bridgemap, lib->bridgemap, name);
|
||||
if(k!=kh_end(lib->bridgemap)) {
|
||||
*start = kh_value(lib->bridgemap, k).start;
|
||||
*end = kh_value(lib->bridgemap, k).end;
|
||||
return 1;
|
||||
}
|
||||
char* symbol = strdup(name);
|
||||
int ret;
|
||||
k = kh_put(bridgemap, lib->bridgemap, symbol, &ret);
|
||||
kh_value(lib->bridgemap, k).name = symbol;
|
||||
kh_value(lib->bridgemap, k).start = *start;
|
||||
kh_value(lib->bridgemap, k).end = *end;
|
||||
return 1;
|
||||
}
|
||||
// nope
|
||||
return 0;
|
||||
}
|
||||
int GetLibLocalSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end)
|
||||
{
|
||||
if(!name[0])
|
||||
return 0;
|
||||
khint_t k;
|
||||
// check first if already in the map
|
||||
k = kh_get(bridgemap, lib->bridgemap, name);
|
||||
if(k!=kh_end(lib->bridgemap)) {
|
||||
*start = kh_value(lib->bridgemap, k).start;
|
||||
*end = kh_value(lib->bridgemap, k).end;
|
||||
return 1;
|
||||
}
|
||||
// get a new symbol
|
||||
if(lib->getlocal(lib, name, start, end)) {
|
||||
*end += *start; // lib->get(...) gives size, not end
|
||||
char* symbol = strdup(name);
|
||||
int ret;
|
||||
k = kh_put(bridgemap, lib->bridgemap, symbol, &ret);
|
||||
kh_value(lib->bridgemap, k).name = symbol;
|
||||
kh_value(lib->bridgemap, k).start = *start;
|
||||
kh_value(lib->bridgemap, k).end = *end;
|
||||
return 1;
|
||||
}
|
||||
// nope
|
||||
return 0;
|
||||
}
|
||||
int GetElfIndex(library_t* lib)
|
||||
{
|
||||
if(!lib || lib->type!=1)
|
||||
@@ -301,7 +400,7 @@ int GetElfIndex(library_t* lib)
|
||||
return lib->priv.n.elf_index;
|
||||
}
|
||||
|
||||
int getSymbolInMaps(library_t*lib, const char* name, uintptr_t *addr, uint32_t *size)
|
||||
int getSymbolInMaps(library_t*lib, const char* name, int noweak, uintptr_t *addr, uint32_t *size)
|
||||
{
|
||||
khint_t k;
|
||||
int ret;
|
||||
@@ -317,6 +416,18 @@ int getSymbolInMaps(library_t*lib, const char* name, uintptr_t *addr, uint32_t *
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if(!noweak) {
|
||||
k = kh_get(datamap, lib->wdatamap, name);
|
||||
if (k!=kh_end(lib->wdatamap)) {
|
||||
symbol = dlsym(lib->priv.w.lib, kh_key(lib->wdatamap, k));
|
||||
if(symbol) {
|
||||
// found!
|
||||
*addr = (uintptr_t)symbol;
|
||||
*size = kh_value(lib->wdatamap, k);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check in mydatamap
|
||||
k = kh_get(datamap, lib->mydatamap, name);
|
||||
if (k!=kh_end(lib->mydatamap)) {
|
||||
@@ -348,7 +459,23 @@ int getSymbolInMaps(library_t*lib, const char* name, uintptr_t *addr, uint32_t *
|
||||
symbol = dlsym(lib->priv.w.box86lib, buff);
|
||||
if(!symbol)
|
||||
printf_log(LOG_NONE, "Warning, function %s not found\n", buff);
|
||||
*addr = AddBridge(lib->priv.w.bridge, kh_value(lib->mysymbolmap, k), symbol);
|
||||
*addr = AddBridge(lib->priv.w.bridge, kh_value(lib->mysymbolmap, k), symbol, 0);
|
||||
*size = sizeof(void*);
|
||||
return 1;
|
||||
}
|
||||
// check in stsymbolmap (return struct...)
|
||||
k = kh_get(symbolmap, lib->stsymbolmap, name);
|
||||
if (k!=kh_end(lib->stsymbolmap)) {
|
||||
char buff[200];
|
||||
if(lib->altmy)
|
||||
strcpy(buff, lib->altmy);
|
||||
else
|
||||
strcpy(buff, "my_");
|
||||
strcat(buff, name);
|
||||
symbol = dlsym(lib->priv.w.box86lib, buff);
|
||||
if(!symbol)
|
||||
printf_log(LOG_NONE, "Warning, function %s not found\n", buff);
|
||||
*addr = AddBridge(lib->priv.w.bridge, kh_value(lib->stsymbolmap, k), symbol, 4); // all of this for this little "4"
|
||||
*size = sizeof(void*);
|
||||
return 1;
|
||||
}
|
||||
@@ -366,22 +493,43 @@ int getSymbolInMaps(library_t*lib, const char* name, uintptr_t *addr, uint32_t *
|
||||
printf_log(LOG_INFO, "Warning, function %s not found in lib %s\n", name, lib->name);
|
||||
return 0;
|
||||
}
|
||||
*addr = AddBridge(lib->priv.w.bridge, kh_value(lib->symbolmap, k), symbol);
|
||||
*addr = AddBridge(lib->priv.w.bridge, kh_value(lib->symbolmap, k), symbol, 0);
|
||||
*size = sizeof(void*);
|
||||
return 1;
|
||||
}
|
||||
if(!noweak) {
|
||||
k = kh_get(symbolmap, lib->wsymbolmap, name);
|
||||
if (k!=kh_end(lib->wsymbolmap)) {
|
||||
symbol = dlsym(lib->priv.w.lib, name);
|
||||
if(!symbol && lib->priv.w.altprefix) {
|
||||
char newname[200];
|
||||
strcpy(newname, lib->priv.w.altprefix);
|
||||
strcat(newname, name);
|
||||
symbol = dlsym(lib->priv.w.lib, newname);
|
||||
}
|
||||
if(!symbol) {
|
||||
printf_log(LOG_INFO, "Warning, function %s not found in lib %s\n", name, lib->name);
|
||||
return 0;
|
||||
}
|
||||
*addr = AddBridge(lib->priv.w.bridge, kh_value(lib->wsymbolmap, k), symbol, 0);
|
||||
*size = sizeof(void*);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// check in symbol2map
|
||||
k = kh_get(symbol2map, lib->symbol2map, name);
|
||||
if (k!=kh_end(lib->symbol2map)) {
|
||||
symbol = dlsym(lib->priv.w.lib, kh_value(lib->symbol2map, k).name);
|
||||
if(!symbol) {
|
||||
printf_log(LOG_INFO, "Warning, function %s not found in lib %s\n", kh_value(lib->symbol2map, k).name, lib->name);
|
||||
return 0;
|
||||
if (k!=kh_end(lib->symbol2map))
|
||||
if(!noweak || !kh_value(lib->symbol2map, k).weak)
|
||||
{
|
||||
symbol = dlsym(lib->priv.w.lib, kh_value(lib->symbol2map, k).name);
|
||||
if(!symbol) {
|
||||
printf_log(LOG_INFO, "Warning, function %s not found in lib %s\n", kh_value(lib->symbol2map, k).name, lib->name);
|
||||
return 0;
|
||||
}
|
||||
*addr = AddBridge(lib->priv.w.bridge, kh_value(lib->symbol2map, k).w, symbol, 0);
|
||||
*size = sizeof(void*);
|
||||
return 1;
|
||||
}
|
||||
*addr = AddBridge(lib->priv.w.bridge, kh_value(lib->symbol2map, k).w, symbol);
|
||||
*size = sizeof(void*);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -14,6 +14,8 @@ void FreeLibrary(library_t **lib);
|
||||
char* GetNameLib(library_t *lib);
|
||||
int IsSameLib(library_t* lib, const char* path); // check if lib is same (path -> name)
|
||||
int GetLibSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end);
|
||||
int GetLibNoWeakSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end);
|
||||
int GetLibLocalSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end);
|
||||
kh_symbolmap_t * fillGLProcWrapper();
|
||||
void freeProcWrapper(kh_symbolmap_t** symbolmap);
|
||||
|
||||
|
||||
@@ -18,12 +18,29 @@ GO("libSDL_mixer-1.2.so.0", sdl1mixer)
|
||||
GO("libSDL_image-1.2.so.0", sdl1image)
|
||||
GO("libsmpeg2-2.0.so.0", smpeg2)
|
||||
GO("libvorbisfile.so.3", vorbisfile)
|
||||
GO("libvorbis.so.0", libvorbis)
|
||||
GO("libogg.so.0", libogg)
|
||||
GO("libpng16.so.16", png16)
|
||||
GO("libXxf86vm.so.1", libxxf86vm)
|
||||
GO("libXinerama.so.1", xinerama)
|
||||
GO("libXrandr.so.2", libxrandr)
|
||||
GO("libXext.so.6", libxext)
|
||||
GO("libXfixes.so.3", libxfixes)
|
||||
GO("libXcursor.so.1", libxcursor)
|
||||
GO("libXrender.so.1", libxrender)
|
||||
GO("libXi.so.6", libxi)
|
||||
GO("libXss.so.1", libxss)
|
||||
GO("libX11-xcb.so.1", libx11xcb)
|
||||
GO("libxcb.so.1", libxcb)
|
||||
GO("libz.so.1", libz)
|
||||
GO("libopenal.so.1", openal)
|
||||
GO("libopenal.so.0", openal)
|
||||
GO("libalut.so.0", alut)
|
||||
GO("libjpeg.so.8", libjpeg)
|
||||
GO("libcurl.so.4", curl)
|
||||
GO("libudev.so.0", udev0)
|
||||
GO("libdbus-1.so.3", dbus)
|
||||
GO("libiconv.so.2", iconv)
|
||||
|
||||
GO("ld-linux.so.2", ldlinux)
|
||||
|
||||
|
||||
+10
-2
@@ -15,6 +15,7 @@ typedef void (*wrapper_t)(x86emu_t* emu, uintptr_t fnc);
|
||||
typedef struct symbol2_s {
|
||||
wrapper_t w;
|
||||
const char* name;
|
||||
int weak;
|
||||
} symbol2_t;
|
||||
|
||||
KHASH_MAP_DECLARE_STR(symbolmap, wrapper_t)
|
||||
@@ -40,6 +41,8 @@ typedef struct wlib_s {
|
||||
typedef struct nlib_s {
|
||||
int elf_index;
|
||||
kh_mapsymbols_t *mapsymbols;
|
||||
kh_mapsymbols_t *weaksymbols;
|
||||
kh_mapsymbols_t *localsymbols;
|
||||
} nlib_t;
|
||||
|
||||
typedef struct library_s {
|
||||
@@ -47,7 +50,9 @@ typedef struct library_s {
|
||||
int nbdot; // nombre of "." after .so
|
||||
int type; // 0: native(wrapped) 1: emulated(elf) -1: undetermined
|
||||
wrappedlib_fini_t fini;
|
||||
wrappedlib_get_t get;
|
||||
wrappedlib_get_t get; // get weak and no weak
|
||||
wrappedlib_get_t getnoweak; // get only global symbol
|
||||
wrappedlib_get_t getlocal;
|
||||
union {
|
||||
wlib_t w;
|
||||
nlib_t n;
|
||||
@@ -56,9 +61,12 @@ typedef struct library_s {
|
||||
bridge_t *brige;
|
||||
kh_bridgemap_t *bridgemap;
|
||||
kh_symbolmap_t *symbolmap;
|
||||
kh_symbolmap_t *wsymbolmap;
|
||||
kh_symbolmap_t *mysymbolmap;
|
||||
kh_symbolmap_t *stsymbolmap;
|
||||
kh_symbol2map_t *symbol2map;
|
||||
kh_datamap_t *datamap;
|
||||
kh_datamap_t *wdatamap;
|
||||
kh_datamap_t *mydatamap;
|
||||
char *altmy; // to avoid duplicate symbol, like with SDL1/SDL2
|
||||
} library_t;
|
||||
@@ -87,6 +95,6 @@ typedef struct map_onedata_s {
|
||||
int weak;
|
||||
} map_onedata_t;
|
||||
|
||||
int getSymbolInMaps(library_t*lib, const char* name, uintptr_t *addr, uint32_t *size); // Add bridges to functions
|
||||
int getSymbolInMaps(library_t*lib, const char* name, int noweak, uintptr_t *addr, uint32_t *size); // Add bridges to functions
|
||||
|
||||
#endif //__LIBRARY_PRIVATE_H_
|
||||
+57
-10
@@ -17,7 +17,11 @@
|
||||
#include "librarian.h"
|
||||
|
||||
int box86_log = LOG_INFO;//LOG_NONE;
|
||||
int dlsym_error = 0;
|
||||
int trace_xmm = 0;
|
||||
#ifdef HAVE_TRACE
|
||||
uint64_t start_cnt = 0;
|
||||
#endif
|
||||
|
||||
FILE* ftrace = NULL;
|
||||
|
||||
@@ -48,6 +52,13 @@ void LoadLogEnv()
|
||||
trace_xmm = p[0]-'0';
|
||||
}
|
||||
}
|
||||
p = getenv("BOX86_TRACE_START");
|
||||
if(p) {
|
||||
char* p2;
|
||||
start_cnt = strtoll(p, &p2, 10);
|
||||
printf_log(LOG_INFO, "Will start trace only after %llu instructions\n", start_cnt);
|
||||
}
|
||||
#endif
|
||||
p = getenv("BOX86_TRACE_FILE");
|
||||
if(p) {
|
||||
ftrace = fopen(p, "w");
|
||||
@@ -58,7 +69,13 @@ void LoadLogEnv()
|
||||
printf("BOX86 Trace redirected to \"%s\"\n", p);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
p = getenv("BOX86_DLSYM_ERROR");
|
||||
if(p) {
|
||||
if(strlen(p)==1) {
|
||||
if(p[0]>='0' && p[1]<='0'+1)
|
||||
dlsym_error = p[0]-'0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadEnvPath(path_collection_t *col, const char* defpath, const char* env)
|
||||
@@ -141,14 +158,27 @@ void PrintHelp() {
|
||||
printf(" BOX86_LOG with 0/1/2/3 or NONE/INFO/DEBUG/DUMP to set printed debug info\n");
|
||||
#ifdef HAVE_TRACE
|
||||
printf(" BOX86_TRACE with 1 to enable x86 execution trace\n");
|
||||
printf(" or with XXXXXX-YYYYYY to enable x86 execution trace only between address\n");
|
||||
printf(" or with FunctionName to enable x86 execution trace only in one specific function\n");
|
||||
printf(" use BOX86_TRACE_INIT instead of BOX_TRACE to start trace before init of Libs and main program\n\t (function name will probably not work then)\n");
|
||||
printf(" BOX86_TRACE_XMM with 1 to enable dump of SSE/SSE2 register along with regular registers\n");
|
||||
printf(" BOX86_TRACE_START with N to enable trace after N instructions\n");
|
||||
#endif
|
||||
printf(" BOX86_TRACE_FILE with FileName to redirect logs in a file");
|
||||
printf(" BOX86_DLSYM_ERROR with 1 to log dlsym errors\n");
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv, const char **env) {
|
||||
|
||||
// trying to open and load 1st arg
|
||||
if(argc==1) {
|
||||
printf("Box86 v%d.%d.%d\n", BOX86_MAJOR, BOX86_MINOR, BOX86_REVISION);
|
||||
printf("Box86%s v%d.%d.%d\n",
|
||||
#ifdef USE_FLOAT
|
||||
" (float only)",
|
||||
#else
|
||||
"",
|
||||
#endif
|
||||
BOX86_MAJOR, BOX86_MINOR, BOX86_REVISION);
|
||||
PrintHelp();
|
||||
return 1;
|
||||
}
|
||||
@@ -167,6 +197,18 @@ int main(int argc, const char **argv, const char **env) {
|
||||
const char* prog = argv[1];
|
||||
// check BOX86_LD_LIBRARY_PATH and load it
|
||||
LoadEnvPath(&context->box86_ld_lib, ".:lib", "BOX86_LD_LIBRARY_PATH");
|
||||
#ifdef PANDORA
|
||||
if(FileExist("/mnt/utmp/codeblocks/usr/lib/i386-linux-gnu", 0))
|
||||
AddPath("/mnt/utmp/codeblocks/usr/lib/i386-linux-gnu", &context->box86_ld_lib);
|
||||
if(FileExist("/mnt/utmp/box86/lib/i386-linux-gnu", 0))
|
||||
AddPath("/mnt/utmp/box86/lib/i386-linux-gnu", &context->box86_ld_lib);
|
||||
//TODO: add relative path to box86 location
|
||||
#else
|
||||
if(FileExist("/lib/i386-linux-gnu", 0))
|
||||
AddPath("/lib/i386-linux-gnu", &context->box86_ld_lib);
|
||||
if(FileExist("/usr/lib/i386-linux-gnu", 0))
|
||||
AddPath("/usr/lib/i386-linux-gnu", &context->box86_ld_lib);
|
||||
#endif
|
||||
// check BOX86_PATH and load it
|
||||
LoadEnvPath(&context->box86_path, ".:bin", "BOX86_PATH");
|
||||
// prepare all other env. var
|
||||
@@ -184,7 +226,7 @@ int main(int argc, const char **argv, const char **env) {
|
||||
if (strcmp(p, "0"))
|
||||
context->x86trace = 1;
|
||||
}
|
||||
p = getenv("BOX86_TRACE_NOINIT");
|
||||
p = getenv("BOX86_TRACE_INIT");
|
||||
if(p) {
|
||||
if (strcmp(p, "0"))
|
||||
context->x86trace = 1;
|
||||
@@ -264,7 +306,7 @@ int main(int argc, const char **argv, const char **env) {
|
||||
return -1;
|
||||
}
|
||||
// init x86 emu
|
||||
context->emu = NewX86Emu(context, context->ep, (uintptr_t)context->stack, context->stacksz);
|
||||
context->emu = NewX86Emu(context, context->ep, (uintptr_t)context->stack, context->stacksz, 0);
|
||||
// stack setup is much more complicated then just that!
|
||||
SetupInitialStack(context);
|
||||
// this is probably useless
|
||||
@@ -272,7 +314,7 @@ int main(int argc, const char **argv, const char **env) {
|
||||
SetEAX(context->emu, context->argc);
|
||||
SetEBX(context->emu, (uint32_t)context->argv);
|
||||
#ifdef HAVE_TRACE
|
||||
p = getenv("BOX86_TRACE");
|
||||
p = getenv("BOX86_TRACE_INIT");
|
||||
if(p) {
|
||||
setbuf(stdout, NULL);
|
||||
uintptr_t trace_start=0, trace_end=0;
|
||||
@@ -294,18 +336,23 @@ int main(int argc, const char **argv, const char **env) {
|
||||
SetTraceEmu(context->emu, 0, 100); // disabling trace, mostly
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p = getenv("BOX86_TRACE");
|
||||
if(p)
|
||||
if (strcmp(p, "0"))
|
||||
SetTraceEmu(context->emu, 0, 1);
|
||||
}
|
||||
#endif
|
||||
// export symbols
|
||||
AddGlobalsSymbols(context->maplib, GetMapSymbol(context->maplib), elf_header);
|
||||
AddSymbols(context->maplib, GetMapSymbol(context->maplib), GetWeakSymbol(context->maplib), GetLocalSymbol(context->maplib), elf_header);
|
||||
// Call librarian to load all dependant elf
|
||||
if(LoadNeededLib(elf_header, context->maplib, context, context->emu)) {
|
||||
printf_log(LOG_NONE, "Error: loading needed libs in elf %s\n", context->argv[0]);
|
||||
FreeBox86Context(&context);
|
||||
return -1;
|
||||
}
|
||||
printf_log(LOG_DEBUG, "And now export symbols / relocation for %s...\n", ElfName(elf_header));
|
||||
// reloc...
|
||||
printf_log(LOG_DEBUG, "And now export symbols / relocation for %s...\n", ElfName(elf_header));
|
||||
if(RelocateElf(context->maplib, elf_header)) {
|
||||
printf_log(LOG_NONE, "Error: relocating symbols in elf %s\n", context->argv[0]);
|
||||
FreeBox86Context(&context);
|
||||
@@ -316,9 +363,9 @@ int main(int argc, const char **argv, const char **env) {
|
||||
// defered init
|
||||
RunDeferedElfInit(context->emu);
|
||||
// init...
|
||||
RunElfInit(elf_header, context->emu);
|
||||
// RunElfInit(elf_header, context->emu); //=> this seems to be done in the startup code itself
|
||||
#ifdef HAVE_TRACE
|
||||
p = getenv("BOX86_TRACE_NOINIT");
|
||||
p = getenv("BOX86_TRACE");
|
||||
if(p) {
|
||||
setbuf(stdout, NULL);
|
||||
uintptr_t trace_start=0, trace_end=0;
|
||||
@@ -332,7 +379,7 @@ int main(int argc, const char **argv, const char **env) {
|
||||
if(trace_start)
|
||||
SetTraceEmu(context->emu, trace_start, trace_end);
|
||||
} else {
|
||||
if (GetSymbolStartEnd(GetMapSymbol(context->maplib), p, &trace_start, &trace_end)) {
|
||||
if (GetGlobalSymbolStartEnd(context->maplib, p, &trace_start, &trace_end)) {
|
||||
SetTraceEmu(context->emu, trace_start, trace_end);
|
||||
printf_log(LOG_INFO, "TRACE on %s only (%p-%p)\n", p, (void*)trace_start, (void*)trace_end);
|
||||
} else {
|
||||
|
||||
+242
-5
@@ -66,8 +66,8 @@ void myStackAlign(const char* fmt, uint32_t* st, uint32_t* mystack)
|
||||
case 'p':
|
||||
case 'S':
|
||||
case 's': state = 30; break; // pointers
|
||||
case '$':
|
||||
case '*': ++p; break; // should issue a warning, it's not handled...
|
||||
case '$': ++p; break; // should issue a warning, it's not handled...
|
||||
case '*': *(mystack++) = *(st++); ++p; break; // fetch an int in the stack....
|
||||
case ' ': state=0; ++p; break;
|
||||
default:
|
||||
state=20; // other stuff, put an int...
|
||||
@@ -175,8 +175,8 @@ void myStackAlignW(const char* fmt, uint32_t* st, uint32_t* mystack)
|
||||
case 'p':
|
||||
case 'S':
|
||||
case 's': state = 30; break; // pointers
|
||||
case '$':
|
||||
case '*': ++p; break; // should issue a warning, it's not handled...
|
||||
case '$': ++p; break; // should issue a warning, it's not handled...
|
||||
case '*': *(mystack++) = *(st++); ++p; break; //fetch an int in the stack
|
||||
case ' ': state=0; ++p; break;
|
||||
default:
|
||||
state=20; // other stuff, put an int...
|
||||
@@ -273,4 +273,241 @@ void UnalignStat64(void* source, void* dest)
|
||||
i386st->st_ctime = st->st_ctime;
|
||||
i386st->st_ctime_nsec = st->st_ctime_nsec;
|
||||
i386st->st_ino = st->st_ino;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
unsigned char *body_data;
|
||||
long body_storage;
|
||||
long body_fill;
|
||||
long body_returned;
|
||||
|
||||
|
||||
int *lacing_vals;
|
||||
int64_t *granule_vals;
|
||||
long lacing_storage;
|
||||
long lacing_fill;
|
||||
long lacing_packet;
|
||||
long lacing_returned;
|
||||
|
||||
unsigned char header[282];
|
||||
unsigned char dummy_align[2]; // not in the actual structure....
|
||||
int header_fill;
|
||||
|
||||
int e_o_s;
|
||||
int b_o_s;
|
||||
long serialno;
|
||||
long pageno;
|
||||
int64_t packetno;
|
||||
int64_t granulepos;
|
||||
|
||||
} ogg_stream_state_x86;
|
||||
|
||||
typedef struct __attribute__((packed)) vorbis_dsp_state_x86 {
|
||||
int analysisp;
|
||||
void *vi; //vorbis_info
|
||||
|
||||
float **pcm;
|
||||
float **pcmret;
|
||||
int pcm_storage;
|
||||
int pcm_current;
|
||||
int pcm_returned;
|
||||
|
||||
int preextrapolate;
|
||||
int eofflag;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
long centerW;
|
||||
|
||||
int64_t granulepos;
|
||||
int64_t sequence;
|
||||
|
||||
int64_t glue_bits;
|
||||
int64_t time_bits;
|
||||
int64_t floor_bits;
|
||||
int64_t res_bits;
|
||||
|
||||
void *backend_state;
|
||||
} vorbis_dsp_state_x86;
|
||||
|
||||
typedef struct {
|
||||
long endbyte;
|
||||
int endbit;
|
||||
|
||||
unsigned char *buffer;
|
||||
unsigned char *ptr;
|
||||
long storage;
|
||||
} oggpack_buffer_x86;
|
||||
|
||||
typedef struct __attribute__((packed)) vorbis_block_x86 {
|
||||
|
||||
float **pcm;
|
||||
oggpack_buffer_x86 opb;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
int pcmend;
|
||||
int mode;
|
||||
|
||||
int eofflag;
|
||||
int64_t granulepos;
|
||||
int64_t sequence;
|
||||
void *vd;
|
||||
|
||||
void *localstore;
|
||||
long localtop;
|
||||
long localalloc;
|
||||
long totaluse;
|
||||
void *reap;
|
||||
|
||||
long glue_bits;
|
||||
long time_bits;
|
||||
long floor_bits;
|
||||
long res_bits;
|
||||
|
||||
void *internal;
|
||||
|
||||
} vorbis_block_x86;
|
||||
|
||||
typedef struct __attribute__((packed)) OggVorbis_x86 {
|
||||
void *datasource; /* Pointer to a FILE *, etc. */
|
||||
int seekable;
|
||||
int64_t offset;
|
||||
int64_t end;
|
||||
ogg_sync_state oy;
|
||||
|
||||
/* If the FILE handle isn't seekable (eg, a pipe), only the current
|
||||
stream appears */
|
||||
int links;
|
||||
int64_t *offsets;
|
||||
int64_t *dataoffsets;
|
||||
long *serialnos;
|
||||
int64_t *pcmlengths; /* overloaded to maintain binary
|
||||
compatibility; x2 size, stores both
|
||||
beginning and end values */
|
||||
void *vi; //vorbis_info
|
||||
void *vc; //vorbis_comment
|
||||
|
||||
/* Decoding working state local storage */
|
||||
int64_t pcm_offset;
|
||||
int ready_state;
|
||||
long current_serialno;
|
||||
int current_link;
|
||||
|
||||
double bittrack;
|
||||
double samptrack;
|
||||
|
||||
ogg_stream_state_x86 os; /* take physical pages, weld into a logical
|
||||
stream of packets */
|
||||
vorbis_dsp_state_x86 vd; /* central working state for the packet->PCM decoder */
|
||||
vorbis_block_x86 vb; /* local working space for packet->PCM decode */
|
||||
|
||||
ov_callbacks callbacks;
|
||||
|
||||
} OggVorbis_x86;
|
||||
|
||||
#define TRANSFERT \
|
||||
GO(datasource) \
|
||||
GO(seekable) \
|
||||
GO(offset) \
|
||||
GO(end) \
|
||||
GO(oy) \
|
||||
GO(links) \
|
||||
GO(offsets) \
|
||||
GO(dataoffsets) \
|
||||
GO(serialnos) \
|
||||
GO(pcmlengths) \
|
||||
GO(vi) \
|
||||
GO(vc) \
|
||||
GO(pcm_offset) \
|
||||
GO(ready_state) \
|
||||
GO(current_serialno) \
|
||||
GO(current_link) \
|
||||
GOM(bittrack, 16) \
|
||||
GO(os.body_data) \
|
||||
GO(os.body_storage) \
|
||||
GO(os.body_fill) \
|
||||
GO(os.body_returned) \
|
||||
GO(os.lacing_vals) \
|
||||
GO(os.granule_vals) \
|
||||
GO(os.lacing_storage) \
|
||||
GO(os.lacing_fill) \
|
||||
GO(os.lacing_packet) \
|
||||
GO(os.lacing_returned) \
|
||||
GOM(os.header, 282) \
|
||||
GO(os.header_fill) \
|
||||
GO(os.e_o_s) \
|
||||
GO(os.b_o_s) \
|
||||
GO(os.serialno) \
|
||||
GO(os.pageno) \
|
||||
GO(os.packetno) \
|
||||
GO(os.granulepos) \
|
||||
GO(vd.analysisp) \
|
||||
GO(vd.vi) \
|
||||
GO(vd.pcm) \
|
||||
GO(vd.pcmret) \
|
||||
GO(vd.pcm_storage) \
|
||||
GO(vd.pcm_current) \
|
||||
GO(vd.pcm_returned) \
|
||||
GO(vd.preextrapolate) \
|
||||
GO(vd.eofflag) \
|
||||
GO(vd.lW) \
|
||||
GO(vd.W) \
|
||||
GO(vd.nW) \
|
||||
GO(vd.centerW) \
|
||||
GO(vd.granulepos) \
|
||||
GO(vd.sequence) \
|
||||
GO(vd.glue_bits) \
|
||||
GO(vd.time_bits) \
|
||||
GO(vd.floor_bits) \
|
||||
GO(vd.res_bits) \
|
||||
GO(vd.backend_state) \
|
||||
GO(vb.pcm) \
|
||||
GO(vb.opb.endbyte) \
|
||||
GO(vb.opb.endbit) \
|
||||
GO(vb.opb.buffer) \
|
||||
GO(vb.opb.ptr) \
|
||||
GO(vb.opb.storage) \
|
||||
GO(vb.lW) \
|
||||
GO(vb.W) \
|
||||
GO(vb.nW) \
|
||||
GO(vb.pcmend) \
|
||||
GO(vb.mode) \
|
||||
GO(vb.eofflag) \
|
||||
GO(vb.granulepos) \
|
||||
GO(vb.sequence) \
|
||||
GO(vb.vd) \
|
||||
GO(vb.localstore) \
|
||||
GO(vb.localtop) \
|
||||
GO(vb.localalloc) \
|
||||
GO(vb.totaluse) \
|
||||
GO(vb.reap) \
|
||||
GO(vb.glue_bits) \
|
||||
GO(vb.time_bits) \
|
||||
GO(vb.floor_bits) \
|
||||
GO(vb.res_bits) \
|
||||
GO(vb.internal) \
|
||||
GO(callbacks)
|
||||
|
||||
void AlignOggVorbis(void* dest, void* source)
|
||||
{
|
||||
// Arm -> x86
|
||||
#define GO(A) ((OggVorbis*)dest)->A = ((OggVorbis_x86*)source)->A;
|
||||
#define GOM(A, S) memcpy(&((OggVorbis*)dest)->A, &((OggVorbis_x86*)source)->A, S);
|
||||
TRANSFERT
|
||||
#undef GO
|
||||
#undef GOM
|
||||
}
|
||||
void UnalignOggVorbis(void* dest, void* source)
|
||||
{
|
||||
// x86 -> Arm
|
||||
#define GO(A) ((OggVorbis_x86*)dest)->A = ((OggVorbis*)source)->A;
|
||||
#define GOM(A, S) memcpy(&((OggVorbis_x86*)dest)->A, &((OggVorbis*)source)->A, S);
|
||||
TRANSFERT
|
||||
#undef GO
|
||||
#undef GOM
|
||||
}
|
||||
#undef TRANSFERT
|
||||
+164
@@ -4,3 +4,167 @@ void myStackAlign(const char* fmt, uint32_t* st, uint32_t* mystack);
|
||||
void myStackAlignW(const char* fmt, uint32_t* st, uint32_t* mystack);
|
||||
|
||||
void UnalignStat64(void* source, void* dest);
|
||||
|
||||
void UnalignOggVorbis(void* dest, void* source); // Arm -> x86
|
||||
void AlignOggVorbis(void* dest, void* source); // x86 -> Arm
|
||||
|
||||
typedef struct {
|
||||
unsigned char *data;
|
||||
int storage;
|
||||
int fill;
|
||||
int returned;
|
||||
|
||||
int unsynced;
|
||||
int headerbytes;
|
||||
int bodybytes;
|
||||
} ogg_sync_state;
|
||||
|
||||
typedef struct {
|
||||
unsigned char *body_data; /* bytes from packet bodies */
|
||||
long body_storage; /* storage elements allocated */
|
||||
long body_fill; /* elements stored; fill mark */
|
||||
long body_returned; /* elements of fill returned */
|
||||
|
||||
|
||||
int *lacing_vals; /* The values that will go to the segment table */
|
||||
int64_t *granule_vals; /* granulepos values for headers. Not compact
|
||||
this way, but it is simple coupled to the
|
||||
lacing fifo */
|
||||
long lacing_storage;
|
||||
long lacing_fill;
|
||||
long lacing_packet;
|
||||
long lacing_returned;
|
||||
|
||||
unsigned char header[282]; /* working space for header encode */
|
||||
int header_fill;
|
||||
|
||||
int e_o_s; /* set when we have buffered the last packet in the
|
||||
logical bitstream */
|
||||
int b_o_s; /* set after we've written the initial page
|
||||
of a logical bitstream */
|
||||
long serialno;
|
||||
long pageno;
|
||||
int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a separate abstraction
|
||||
layer) also knows about the gap */
|
||||
int64_t granulepos;
|
||||
|
||||
} ogg_stream_state;
|
||||
|
||||
typedef struct vorbis_dsp_state {
|
||||
int analysisp;
|
||||
void *vi; //vorbis_info
|
||||
|
||||
float **pcm;
|
||||
float **pcmret;
|
||||
int pcm_storage;
|
||||
int pcm_current;
|
||||
int pcm_returned;
|
||||
|
||||
int preextrapolate;
|
||||
int eofflag;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
long centerW;
|
||||
|
||||
int64_t granulepos;
|
||||
int64_t sequence;
|
||||
|
||||
int64_t glue_bits;
|
||||
int64_t time_bits;
|
||||
int64_t floor_bits;
|
||||
int64_t res_bits;
|
||||
|
||||
void *backend_state;
|
||||
} vorbis_dsp_state;
|
||||
|
||||
typedef struct {
|
||||
long endbyte;
|
||||
int endbit;
|
||||
|
||||
unsigned char *buffer;
|
||||
unsigned char *ptr;
|
||||
long storage;
|
||||
} oggpack_buffer;
|
||||
|
||||
typedef struct vorbis_block {
|
||||
/* necessary stream state for linking to the framing abstraction */
|
||||
float **pcm; /* this is a pointer into local storage */
|
||||
oggpack_buffer opb;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
int pcmend;
|
||||
int mode;
|
||||
|
||||
int eofflag;
|
||||
int64_t granulepos;
|
||||
int64_t sequence;
|
||||
vorbis_dsp_state *vd; /* For read-only access of configuration */
|
||||
|
||||
/* local storage to avoid remallocing; it's up to the mapping to
|
||||
structure it */
|
||||
void *localstore;
|
||||
long localtop;
|
||||
long localalloc;
|
||||
long totaluse;
|
||||
struct alloc_chain *reap;
|
||||
|
||||
/* bitmetrics for the frame */
|
||||
long glue_bits;
|
||||
long time_bits;
|
||||
long floor_bits;
|
||||
long res_bits;
|
||||
|
||||
void *internal;
|
||||
|
||||
} vorbis_block;
|
||||
|
||||
typedef struct {
|
||||
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
|
||||
int (*seek_func) (void *datasource, int64_t offset, int whence);
|
||||
int (*close_func) (void *datasource);
|
||||
long (*tell_func) (void *datasource);
|
||||
} ov_callbacks;
|
||||
|
||||
typedef struct OggVorbis {
|
||||
void *datasource; /* Pointer to a FILE *, etc. */
|
||||
int seekable;
|
||||
int64_t offset;
|
||||
int64_t end;
|
||||
ogg_sync_state oy;
|
||||
|
||||
/* If the FILE handle isn't seekable (eg, a pipe), only the current
|
||||
stream appears */
|
||||
int links;
|
||||
int64_t *offsets;
|
||||
int64_t *dataoffsets;
|
||||
long *serialnos;
|
||||
int64_t *pcmlengths; /* overloaded to maintain binary
|
||||
compatibility; x2 size, stores both
|
||||
beginning and end values */
|
||||
void *vi; //vorbis_info
|
||||
void *vc; //vorbis_comment
|
||||
|
||||
/* Decoding working state local storage */
|
||||
int64_t pcm_offset;
|
||||
int ready_state;
|
||||
long current_serialno;
|
||||
int current_link;
|
||||
|
||||
double bittrack;
|
||||
double samptrack;
|
||||
|
||||
ogg_stream_state os; /* take physical pages, weld into a logical
|
||||
stream of packets */
|
||||
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
||||
vorbis_block vb; /* local working space for packet->PCM decode */
|
||||
|
||||
ov_callbacks callbacks;
|
||||
|
||||
} OggVorbis;
|
||||
@@ -75,4 +75,21 @@ void CopyCollection(path_collection_t* to, path_collection_t* from)
|
||||
to->size = from->size;
|
||||
for (int i=0; i<to->size; ++i)
|
||||
to->paths[i] = strdup(from->paths[i]);
|
||||
}
|
||||
|
||||
void AddPath(const char* path, path_collection_t* collection)
|
||||
{
|
||||
char tmp[MAX_PATH];
|
||||
strcpy(tmp, path);
|
||||
int l = strlen(tmp);
|
||||
// skip empty strings
|
||||
if(l) {
|
||||
if(tmp[l-1]!='/')
|
||||
strcat(tmp, "/");
|
||||
if(collection->size==collection->cap) {
|
||||
collection->cap += 4;
|
||||
collection->paths = (char**)realloc(collection->paths, collection->cap*sizeof(char*));
|
||||
}
|
||||
collection->paths[collection->size++]=strdup(tmp);
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,6 @@ typedef struct path_collection_t
|
||||
void ParseList(const char* List, path_collection_t* collection);
|
||||
void FreeCollection(path_collection_t* collection);
|
||||
void CopyCollection(path_collection_t* to, path_collection_t* from);
|
||||
void AddPath(const char* path, path_collection_t* collection);
|
||||
|
||||
#endif //__PATHCOLL_H_
|
||||
+11
-2
@@ -1,8 +1,6 @@
|
||||
#ifndef __REGS_H_
|
||||
#define __REGS_H_
|
||||
|
||||
enum SegNames { es=0,cs,ss,ds,fs,gs};
|
||||
|
||||
enum {
|
||||
_AX, _CX, _DX, _BX,
|
||||
_SP, _BP, _SI, _DI
|
||||
@@ -52,9 +50,15 @@ typedef enum {
|
||||
d_inc8,
|
||||
d_inc16,
|
||||
d_inc32,
|
||||
d_imul8,
|
||||
d_imul16,
|
||||
d_imul32,
|
||||
d_or8,
|
||||
d_or16,
|
||||
d_or32,
|
||||
d_mul8,
|
||||
d_mul16,
|
||||
d_mul32,
|
||||
d_neg8,
|
||||
d_neg16,
|
||||
d_neg32,
|
||||
@@ -78,6 +82,10 @@ typedef enum {
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef union {
|
||||
#ifdef USE_FLOAT
|
||||
float f;
|
||||
uint32_t ll; // same, to avoid more #ifdef...
|
||||
#else
|
||||
double d;
|
||||
struct {
|
||||
uint32_t lower;
|
||||
@@ -88,6 +96,7 @@ typedef union {
|
||||
float upper;
|
||||
} f;
|
||||
int64_t ll;
|
||||
#endif
|
||||
} fpu_reg_t;
|
||||
|
||||
typedef union {
|
||||
|
||||
+33
-2
@@ -75,13 +75,34 @@
|
||||
NEXT;
|
||||
|
||||
_0f_0x2C: /* CVTTPS2PI Gm, Ex */
|
||||
_0f_0x2D: /* CVTPS2PI Gm, Ex */
|
||||
// rounding should be done; and indefinite integer should also be assigned if overflow or NaN/Inf
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
GM.sd[1] = EX->f[1];
|
||||
GM.sd[0] = EX->f[0];
|
||||
NEXT;
|
||||
_0f_0x2D: /* CVTPS2PI Gm, Ex */
|
||||
// rounding should be done; and indefinite integer should also be assigned if overflow or NaN/Inf
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
GM.sd[1] = floorf(EX->f[1]+0.5f);
|
||||
GM.sd[0] = floorf(EX->f[0]+0.5f);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
GM.sd[1] = floorf(EX->f[1]);
|
||||
GM.sd[0] = floorf(EX->f[0]);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
GM.sd[1] = ceilf(EX->f[1]);
|
||||
GM.sd[0] = ceilf(EX->f[0]);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
GM.sd[1] = EX->f[1];
|
||||
GM.sd[0] = EX->f[0];
|
||||
break;
|
||||
}
|
||||
NEXT;
|
||||
_0f_0x2E: /* UCOMISS Gx, Ex */
|
||||
// same for now
|
||||
_0f_0x2F: /* COMISS Gx, Ex */
|
||||
@@ -97,6 +118,7 @@
|
||||
} else {
|
||||
SET_FLAG(F_ZF); CLEAR_FLAG(F_PF); CLEAR_FLAG(F_CF);
|
||||
}
|
||||
CLEAR_FLAG(F_OF); CLEAR_FLAG(F_AF); CLEAR_FLAG(F_SF);
|
||||
NEXT;
|
||||
|
||||
#define GOCOND(BASE, PREFIX, CONDITIONAL) \
|
||||
@@ -359,6 +381,15 @@
|
||||
| 1<<13 // cx16 (cmpxchg16)
|
||||
; // also 1<<0 is SSE3 and 1<<9 is SSSE3
|
||||
break;
|
||||
case 0x2: // TLB and Cache info. Sending 1st gen P4 info...
|
||||
R_EAX = 0x665B5001;
|
||||
R_EBX = 0x00000000;
|
||||
R_ECX = 0x00000000;
|
||||
R_EDX = 0x007A7000;
|
||||
break;
|
||||
|
||||
case 0x80000000: // max extended
|
||||
break; // no extended, so return same value as beeing the max value!
|
||||
default:
|
||||
printf_log(LOG_INFO, "Warning, CPUID command %X unsupported\n", tmp32u);
|
||||
R_EAX = 0;
|
||||
|
||||
+33
-3
@@ -66,6 +66,28 @@
|
||||
tmp8u = opcode&7;
|
||||
emu->regs[tmp8u].word[0] = dec16(emu, emu->regs[tmp8u].word[0]);
|
||||
NEXT;
|
||||
_66_0x50:
|
||||
_66_0x51:
|
||||
_66_0x52:
|
||||
_66_0x53:
|
||||
_66_0x54:
|
||||
_66_0x55:
|
||||
_66_0x56:
|
||||
_66_0x57: /* PUSH Reg */
|
||||
tmp8u = opcode&7;
|
||||
Push16(emu, emu->regs[tmp8u].word[0]);
|
||||
NEXT;
|
||||
_66_0x58:
|
||||
_66_0x59:
|
||||
_66_0x5A:
|
||||
_66_0x5B:
|
||||
_66_0x5C:
|
||||
_66_0x5D:
|
||||
_66_0x5E:
|
||||
_66_0x5F: /* POP Reg */
|
||||
tmp8u = opcode&7;
|
||||
emu->regs[tmp8u].word[0] = Pop16(emu);
|
||||
NEXT;
|
||||
|
||||
_66_0x66:
|
||||
goto _0x66; // 0x66 0x66 => can remove one 0x66
|
||||
@@ -76,7 +98,10 @@
|
||||
tmp16u = F16;
|
||||
GW.word[0] = imul16(emu, EW->word[0], tmp16u);
|
||||
NEXT;
|
||||
|
||||
_66_0x6A: /* PUSH Ib (as signed word) */
|
||||
tmp16s = F8S;
|
||||
Push16(emu, (uint16_t)tmp16s);
|
||||
NEXT;
|
||||
_66_0x6B: /* IMUL Gw,Ew,Ib */
|
||||
nextop = F8;
|
||||
GET_EW;
|
||||
@@ -135,7 +160,7 @@
|
||||
_66_0x8F: /* POP Ew */
|
||||
nextop = F8;
|
||||
GET_EW;
|
||||
EW->dword[0] = Pop16(emu);
|
||||
EW->word[0] = Pop16(emu);
|
||||
NEXT;
|
||||
_66_0x90: /* NOP */
|
||||
NEXT;
|
||||
@@ -150,7 +175,7 @@
|
||||
emu->regs[_AX].sword[0] = emu->regs[_AX].sbyte[0];
|
||||
NEXT;
|
||||
_66_0x99: /* CWD */
|
||||
R_DX=(R_AX & 0x8000)?0xFFFF:0x0000;
|
||||
R_DX=((R_AX & 0x8000)?0xFFFF:0x0000);
|
||||
NEXT;
|
||||
|
||||
_66_0xA1: /* MOV AX,Ow */
|
||||
@@ -174,6 +199,11 @@
|
||||
R_ESI += tmp8s;
|
||||
cmp16(emu, tmp16u2, tmp16u);
|
||||
NEXT;
|
||||
|
||||
_66_0xA9: /* TEST AX,Iw */
|
||||
test16(emu, R_AX, F16);
|
||||
NEXT;
|
||||
|
||||
_66_0xAB: /* STOSW */
|
||||
tmp8s = ACCESS_FLAG(F_DF)?-2:+2;
|
||||
*(uint16_t*)R_EDI = R_AX;
|
||||
|
||||
+41
-2
@@ -101,7 +101,16 @@
|
||||
GET_EX;
|
||||
memcpy(EX, &GX, 16); // unaligned...
|
||||
NEXT;
|
||||
|
||||
_6f_0x12: /* MOVLPD Gx, Eq */
|
||||
nextop = F8;
|
||||
GET_ED;
|
||||
GX.q[0] = *(uint64_t*)ED;
|
||||
NEXT;
|
||||
_6f_0x13: /* MOVLPD Eq, Gx */
|
||||
nextop = F8;
|
||||
GET_ED;
|
||||
*(uint64_t*)ED = GX.q[0];
|
||||
NEXT;
|
||||
_6f_0x14: /* UNPCKLPD Gx, Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
@@ -150,12 +159,33 @@
|
||||
|
||||
|
||||
_6f_0x2C: /* CVTTPD2PI Gm, Ex */
|
||||
_6f_0x2D: /* CVTPD2PI Gm, Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
GM.sd[0] = EX->d[0];
|
||||
GM.sd[1] = EX->d[1];
|
||||
NEXT;
|
||||
_6f_0x2D: /* CVTPD2PI Gm, Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
GM.sd[0] = floor(EX->d[0]+0.5);
|
||||
GM.sd[1] = floor(EX->d[1]+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
GM.sd[0] = floor(EX->d[0]);
|
||||
GM.sd[1] = floor(EX->d[1]);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
GM.sd[0] = ceil(EX->d[0]);
|
||||
GM.sd[1] = ceil(EX->d[1]);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
GM.sd[0] = EX->d[0];
|
||||
GM.sd[1] = EX->d[1];
|
||||
break;
|
||||
}
|
||||
NEXT;
|
||||
_6f_0x2E: /* UCOMISD Gx, Ex */
|
||||
// no special check...
|
||||
_6f_0x2F: /* COMISD Gx, Ex */
|
||||
@@ -171,6 +201,7 @@
|
||||
} else {
|
||||
SET_FLAG(F_ZF); CLEAR_FLAG(F_PF); CLEAR_FLAG(F_CF);
|
||||
}
|
||||
CLEAR_FLAG(F_OF); CLEAR_FLAG(F_AF); CLEAR_FLAG(F_SF);
|
||||
NEXT;
|
||||
|
||||
_6f_0x50: /* MOVMSKPD Gd, Ex */
|
||||
@@ -713,6 +744,14 @@
|
||||
if((nextop&0xC0)==0xC0)
|
||||
EX->q[1] = 0;
|
||||
NEXT;
|
||||
_6f_0xD7: /* PMOVMSKB Gd,Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
GD.dword[0] = 0;
|
||||
for (int i=0; i<16; ++i)
|
||||
if(EX->ub[i]&0x80)
|
||||
GD.dword[0] |= (1<<i);
|
||||
NEXT;
|
||||
|
||||
_6f_0xDB: /* PAND Gx,Ex */
|
||||
nextop = F8;
|
||||
|
||||
+80
@@ -8,7 +8,11 @@
|
||||
case 0xC5:
|
||||
case 0xC6:
|
||||
case 0xC7: /* FADD */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f += ST(nextop&7).f;
|
||||
#else
|
||||
ST0.d += ST(nextop&7).d;
|
||||
#endif
|
||||
break;
|
||||
case 0xC8:
|
||||
case 0xC9:
|
||||
@@ -18,7 +22,11 @@
|
||||
case 0xCD:
|
||||
case 0xCE:
|
||||
case 0xCF: /* FMUL */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f *= ST(nextop&7).f;
|
||||
#else
|
||||
ST0.d *= ST(nextop&7).d;
|
||||
#endif
|
||||
break;
|
||||
case 0xD0:
|
||||
case 0xD1:
|
||||
@@ -28,7 +36,11 @@
|
||||
case 0xD5:
|
||||
case 0xD6:
|
||||
case 0xD7: /* FCOM */
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcom(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcom(emu, ST(nextop&7).d);
|
||||
#endif
|
||||
break;
|
||||
case 0xD8:
|
||||
case 0xD9:
|
||||
@@ -38,7 +50,11 @@
|
||||
case 0xDD:
|
||||
case 0xDE:
|
||||
case 0xDF: /* FCOMP */
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcom(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcom(emu, ST(nextop&7).d);
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xE0:
|
||||
@@ -49,7 +65,11 @@
|
||||
case 0xE5:
|
||||
case 0xE6:
|
||||
case 0xE7: /* FSUB */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f -= ST(nextop&7).f;
|
||||
#else
|
||||
ST0.d -= ST(nextop&7).d;
|
||||
#endif
|
||||
break;
|
||||
case 0xE8:
|
||||
case 0xE9:
|
||||
@@ -59,7 +79,11 @@
|
||||
case 0xED:
|
||||
case 0xEE:
|
||||
case 0xEF: /* FSUBR */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = ST(nextop&7).f - ST0.f;
|
||||
#else
|
||||
ST0.d = ST(nextop&7).d - ST0.d;
|
||||
#endif
|
||||
break;
|
||||
case 0xF0:
|
||||
case 0xF1:
|
||||
@@ -69,7 +93,11 @@
|
||||
case 0xF5:
|
||||
case 0xF6:
|
||||
case 0xF7: /* FDIV */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f /= ST(nextop&7).f;
|
||||
#else
|
||||
ST0.d /= ST(nextop&7).d;
|
||||
#endif
|
||||
break;
|
||||
case 0xF8:
|
||||
case 0xF9:
|
||||
@@ -79,26 +107,46 @@
|
||||
case 0xFD:
|
||||
case 0xFE:
|
||||
case 0xFF: /* FDIVR */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = ST(nextop&7).f / ST0.f;
|
||||
#else
|
||||
ST0.d = ST(nextop&7).d / ST0.d;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
switch((nextop>>3)&7) {
|
||||
case 0: /* FADD ST0, float */
|
||||
GET_ED;
|
||||
if(!(((uintptr_t)ED)&3))
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f += *(float*)ED;
|
||||
#else
|
||||
ST0.d += *(float*)ED;
|
||||
#endif
|
||||
else {
|
||||
*(uint32_t*)&f = ED->dword[0];
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f += f;
|
||||
#else
|
||||
ST0.d += f;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 1: /* FMUL ST0, float */
|
||||
GET_ED;
|
||||
if(!(((uintptr_t)ED)&3))
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f *= *(float*)ED;
|
||||
#else
|
||||
ST0.d *= *(float*)ED;
|
||||
#endif
|
||||
else {
|
||||
*(uint32_t*)&f = ED->dword[0];
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f *= f;
|
||||
#else
|
||||
ST0.d *= f;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 2: /* FCOM ST0, float */
|
||||
@@ -123,37 +171,69 @@
|
||||
case 4: /* FSUB ST0, float */
|
||||
GET_ED;
|
||||
if(!(((uintptr_t)ED)&3))
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f -= *(float*)ED;
|
||||
#else
|
||||
ST0.d -= *(float*)ED;
|
||||
#endif
|
||||
else {
|
||||
*(uint32_t*)&f = ED->dword[0];
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f -= f;
|
||||
#else
|
||||
ST0.d -= f;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 5: /* FSUBR ST0, float */
|
||||
GET_ED;
|
||||
if(!(((uintptr_t)ED)&3))
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = *(float*)ED - ST0.f;
|
||||
#else
|
||||
ST0.d = *(float*)ED - ST0.d;
|
||||
#endif
|
||||
else {
|
||||
*(uint32_t*)&f = ED->dword[0];
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = f - ST0.f;
|
||||
#else
|
||||
ST0.d = f - ST0.d;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 6: /* FDIV ST0, float */
|
||||
GET_ED;
|
||||
if(!(((uintptr_t)ED)&3))
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f /= *(float*)ED;
|
||||
#else
|
||||
ST0.d /= *(float*)ED;
|
||||
#endif
|
||||
else {
|
||||
*(uint32_t*)&f = ED->dword[0];
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f /= f;
|
||||
#else
|
||||
ST0.d /= f;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 7: /* FDIVR ST0, float */
|
||||
GET_ED;
|
||||
if(!(((uintptr_t)ED)&3))
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = *(float*)ED / ST0.f;
|
||||
#else
|
||||
ST0.d = *(float*)ED / ST0.d;
|
||||
#endif
|
||||
else {
|
||||
*(uint32_t*)&f = ED->dword[0];
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = f / ST0.f;
|
||||
#else
|
||||
ST0.d = f / ST0.d;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
+117
-5
@@ -29,58 +29,135 @@
|
||||
break;
|
||||
|
||||
case 0xE0: /* FCHS */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = -ST0.f;
|
||||
#else
|
||||
ST0.d = -ST0.d;
|
||||
#endif
|
||||
break;
|
||||
case 0xE1: /* FABS */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = fabsf(ST0.f);
|
||||
#else
|
||||
ST0.d = fabs(ST0.d);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xE4: /* FTST */
|
||||
fpu_ftst(emu);
|
||||
break;
|
||||
case 0xE5: /* FXAM */
|
||||
fpu_fxam(emu);
|
||||
break;
|
||||
|
||||
case 0xE8: /* FLD1 */
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = 1.0f;
|
||||
#else
|
||||
ST0.d = 1.0;
|
||||
#endif
|
||||
break;
|
||||
case 0xE9: /* FLDL2T */
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = L2T;
|
||||
#else
|
||||
ST0.d = L2T;
|
||||
#endif
|
||||
break;
|
||||
case 0xEA: /* FLDL2E */
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = L2E;
|
||||
#else
|
||||
ST0.d = L2E;
|
||||
#endif
|
||||
break;
|
||||
case 0xEB: /* FLDPI */
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = PI;
|
||||
#else
|
||||
ST0.d = PI;
|
||||
#endif
|
||||
break;
|
||||
case 0xEC: /* FLDLG2 */
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = LG2;
|
||||
#else
|
||||
ST0.d = LG2;
|
||||
#endif
|
||||
break;
|
||||
case 0xED: /* FLDLN2 */
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = LN2;
|
||||
#else
|
||||
ST0.d = LN2;
|
||||
#endif
|
||||
break;
|
||||
case 0xEE: /* FLDZ */
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = 0.0f;
|
||||
#else
|
||||
ST0.d = 0.0;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xF0: /* F2XM1 */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = exp2f(ST0.f) - 1.0f;
|
||||
#else
|
||||
ST0.d = exp2(ST0.d) - 1.0;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xF2: /* FTAN */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = tanf(ST0.f);
|
||||
fpu_do_push(emu);
|
||||
ST0.f = 1.0f;
|
||||
#else
|
||||
ST0.d = tan(ST0.d);
|
||||
fpu_do_push(emu);
|
||||
ST0.d = 1.0;
|
||||
#endif
|
||||
break;
|
||||
case 0xF3: /* FPATAN */
|
||||
#ifdef USE_FLOAT
|
||||
ST1.f = atan2f(ST1.f, ST0.f);
|
||||
#else
|
||||
ST1.d = atan2(ST1.d, ST0.d);
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xF4: /* FXTRACT */
|
||||
#ifdef USE_FLOAT
|
||||
tmp32s = (ST0.ll&0x7f700000)>>23;
|
||||
tmp32s -= 127;
|
||||
ST0.f /= exp2f(tmp32s);
|
||||
fpu_do_push(emu);
|
||||
ST0.f = tmp32s;
|
||||
#else
|
||||
tmp32s = (ST0.ll&0x7ff0000000000000LL)>>52;
|
||||
tmp32s -= 1023;
|
||||
ST0.d /= exp2(tmp32s);
|
||||
fpu_do_push(emu);
|
||||
ST0.d = tmp32s;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xF8: /* FPREM */
|
||||
#ifdef USE_FLOAT
|
||||
tmp32s = ST0.f / ST1.f;
|
||||
ST0.f -= ST1.f * tmp32s;
|
||||
#else
|
||||
tmp32s = ST0.d / ST1.d;
|
||||
ST0.d -= ST1.d * tmp32s;
|
||||
#endif
|
||||
emu->sw.f.F87_C2 = 0;
|
||||
emu->sw.f.F87_C0 = (tmp32s&1);
|
||||
emu->sw.f.F87_C3 = ((tmp32s>>1)&1);
|
||||
@@ -88,21 +165,48 @@
|
||||
break;
|
||||
|
||||
case 0xFA: /* FSQRT */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = sqrtf(ST0.f);
|
||||
#else
|
||||
ST0.d = sqrt(ST0.d);
|
||||
#endif
|
||||
break;
|
||||
case 0xFB: /* FSINCOS */
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
sincosf(ST1.f, &ST1.f, &ST0.f);
|
||||
#else
|
||||
sincos(ST1.d, &ST1.d, &ST0.d);
|
||||
#endif
|
||||
break;
|
||||
case 0xFC: /* FRNDINT */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = fpu_round(emu, ST0.f);
|
||||
#else
|
||||
ST0.d = fpu_round(emu, ST0.d);
|
||||
#endif
|
||||
break;
|
||||
case 0xFD: /* FSCALE */
|
||||
// this could probably be done by just altering the exponant part of the float...
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f *= exp2f(truncf(ST1.f));
|
||||
#else
|
||||
ST0.d *= exp2(trunc(ST1.d));
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xFE: /* FSIN */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = sinf(ST0.f);
|
||||
#else
|
||||
ST0.d = sin(ST0.d);
|
||||
#endif
|
||||
break;
|
||||
case 0xFF: /* FCOS */
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = cosf(ST0.f);
|
||||
#else
|
||||
ST0.d = cos(ST0.d);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
@@ -121,33 +225,41 @@
|
||||
case 0xDF:
|
||||
case 0xE2:
|
||||
case 0xE3:
|
||||
case 0xE4:
|
||||
case 0xE6:
|
||||
case 0xE7:
|
||||
case 0xEF:
|
||||
case 0xF0:
|
||||
case 0xF1:
|
||||
case 0xF4:
|
||||
case 0xF5:
|
||||
case 0xF6:
|
||||
case 0xF7:
|
||||
case 0xF9:
|
||||
case 0xFD:
|
||||
goto _default;
|
||||
default:
|
||||
switch((nextop>>3)&7) {
|
||||
case 0: /* FLD ST0, Ed float */
|
||||
GET_ED;
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = *(float*)ED;
|
||||
#else
|
||||
ST0.d = *(float*)ED;
|
||||
#endif
|
||||
break;
|
||||
case 2: /* FST Ed, ST0 */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
*(float*)ED = ST0.f;
|
||||
#else
|
||||
*(float*)ED = ST0.d;
|
||||
#endif
|
||||
break;
|
||||
case 3: /* FSTP Ed, ST0 */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
*(float*)ED = ST0.f;
|
||||
#else
|
||||
*(float*)ED = ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 4: /* FLDENV m */
|
||||
|
||||
+32
@@ -51,7 +51,11 @@
|
||||
break;
|
||||
|
||||
case 0xE9: /* FUCOMPP */
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcom(emu, ST1.f);
|
||||
#else
|
||||
fpu_fcom(emu, ST1.d); // bad, should handle QNaN and IA interrupt
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
@@ -72,23 +76,51 @@
|
||||
switch((nextop>>3)&7) {
|
||||
case 0: /* FIADD ST0, Ed int */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f += ED->sdword[0];
|
||||
#else
|
||||
ST0.d += ED->sdword[0];
|
||||
#endif
|
||||
break;
|
||||
case 1: /* FIMUL ST0, Ed int */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f *= ED->sdword[0];
|
||||
#else
|
||||
ST0.d *= ED->sdword[0];
|
||||
#endif
|
||||
break;
|
||||
case 4: /* FISUB ST0, Ed int */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f -= ED->sdword[0];
|
||||
#else
|
||||
ST0.d -= ED->sdword[0];
|
||||
#endif
|
||||
break;
|
||||
case 5: /* FISUBR ST0, Ed int */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = ED->sdword[0] - ST0.f;
|
||||
#else
|
||||
ST0.d = ED->sdword[0] - ST0.d;
|
||||
#endif
|
||||
break;
|
||||
case 6: /* FIDIV ST0, Ed int */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f /= ED->sdword[0];
|
||||
#else
|
||||
ST0.d /= ED->sdword[0];
|
||||
#endif
|
||||
break;
|
||||
case 7: /* FIDIVR ST0, Ed int */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = ED->sdword[0] / ST0.f;
|
||||
#else
|
||||
ST0.d = ED->sdword[0] / ST0.d;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
goto _default;
|
||||
|
||||
+113
-8
@@ -73,7 +73,11 @@
|
||||
case 0xED:
|
||||
case 0xEE:
|
||||
case 0xEF:
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcomi(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcomi(emu, ST(nextop&7).d); // bad, should handle QNaN and IA interrupt
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xF0: /* FCOMI ST0, STx */
|
||||
@@ -84,7 +88,11 @@
|
||||
case 0xF5:
|
||||
case 0xF6:
|
||||
case 0xF7:
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcomi(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcomi(emu, ST(nextop&7).d);
|
||||
#endif
|
||||
break;
|
||||
case 0xE0:
|
||||
case 0xE1:
|
||||
@@ -98,34 +106,131 @@
|
||||
case 0: /* FILD ST0, Gd */
|
||||
GET_ED;
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = ED->sdword[0];
|
||||
#else
|
||||
ST0.d = ED->sdword[0];
|
||||
#endif
|
||||
break;
|
||||
case 1: /* FISTTP Ed, ST0 */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
tmp32s = ST0.f; // TODO: Handling of FPU Exception
|
||||
if(tmp32s==0x7fffffff && isgreater(ST0.f, (float)(int32_t)0x7fffffff))
|
||||
tmp32s = 0x80000000;
|
||||
#else
|
||||
tmp32s = ST0.d; // TODO: Handling of FPU Exception
|
||||
if(tmp32s==0x7fffffff && isgreater(ST0.d, (double)(int32_t)0x7fffffff))
|
||||
tmp32s = 0x80000000;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
ED->sdword[0] = tmp32s;
|
||||
break;
|
||||
case 2: /* FIST Ed, ST0 */
|
||||
GET_ED;
|
||||
tmp32s = ST0.d; // TODO: Handling of FPU Exception and rounding
|
||||
if(tmp32s==0x7fffffff && isgreater(ST0.d, (double)(int32_t)0x7fffffff))
|
||||
tmp32s = 0x80000000;
|
||||
ED->sdword[0] = tmp32s;
|
||||
#ifdef USE_FLOAT
|
||||
if(isgreater(ST0.f, (float)(int32_t)0x7fffffff) || isless(ST0.f, -(float)(int32_t)0x7fffffff))
|
||||
ED->sdword[0] = 0x80000000;
|
||||
else {
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
ED->sdword[0] = floorf(ST0.f+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
ED->sdword[0] = floorf(ST0.f);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
ED->sdword[0] = ceilf(ST0.f);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
ED->sdword[0] = ST0.f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, -(double)(int32_t)0x7fffffff))
|
||||
ED->sdword[0] = 0x80000000;
|
||||
else {
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
ED->sdword[0] = floor(ST0.d+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
ED->sdword[0] = floor(ST0.d);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
ED->sdword[0] = ceil(ST0.d);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
ED->sdword[0] = ST0.d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 3: /* FISTP Ed, ST0 */
|
||||
GET_ED;
|
||||
tmp32s = ST0.d; // TODO: Handling of FPU Exception and rounding
|
||||
if(tmp32s==0x7fffffff && isgreater(ST0.d, (double)(int32_t)0x7fffffff))
|
||||
tmp32s = 0x80000000;
|
||||
#ifdef USE_FLOAT
|
||||
if(isgreater(ST0.f, (float)(int32_t)0x7fffffff) || isless(ST0.f, -(float)(int32_t)0x7fffffff))
|
||||
ED->sdword[0] = 0x80000000;
|
||||
else {
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
ED->sdword[0] = floorf(ST0.f+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
ED->sdword[0] = floorf(ST0.f);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
ED->sdword[0] = ceilf(ST0.f);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
ED->sdword[0] = ST0.f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, -(double)(int32_t)0x7fffffff))
|
||||
ED->sdword[0] = 0x80000000;
|
||||
else {
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
ED->sdword[0] = floor(ST0.d+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
ED->sdword[0] = floor(ST0.d);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
ED->sdword[0] = ceil(ST0.d);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
ED->sdword[0] = ST0.d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
ED->sdword[0] = tmp32s;
|
||||
break;
|
||||
case 5: /* FLD ST0, Gt */
|
||||
GET_ED;
|
||||
fpu_do_push(emu);
|
||||
memcpy(&STld(0).ld, ED, 10);
|
||||
#ifdef USE_FLOAT
|
||||
LD2D(&STld(0), &d);
|
||||
ST0.f = d;
|
||||
#else
|
||||
LD2D(&STld(0), &ST(0).d);
|
||||
#endif
|
||||
STld(0).ref = ST0.ll;
|
||||
break;
|
||||
case 7: /* FSTP tbyte */
|
||||
GET_ED;
|
||||
if(ST0.ll!=STld(0).ref)
|
||||
#ifdef USE_FLOAT
|
||||
{d = ST0.f; D2LD(&d, ED);}
|
||||
#else
|
||||
D2LD(&ST0.d, ED);
|
||||
#endif
|
||||
else
|
||||
memcpy(ED, &STld(0).ld, 10);
|
||||
fpu_do_pop(emu);
|
||||
|
||||
+87
-1
@@ -8,7 +8,11 @@
|
||||
case 0xC5:
|
||||
case 0xC6:
|
||||
case 0xC7: /* FADD */
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f += ST0.f;
|
||||
#else
|
||||
ST(nextop&7).d += ST0.d;
|
||||
#endif
|
||||
break;
|
||||
case 0xC8:
|
||||
case 0xC9:
|
||||
@@ -18,7 +22,11 @@
|
||||
case 0xCD:
|
||||
case 0xCE:
|
||||
case 0xCF: /* FMUL */
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f *= ST0.f;
|
||||
#else
|
||||
ST(nextop&7).d *= ST0.d;
|
||||
#endif
|
||||
break;
|
||||
case 0xD0:
|
||||
case 0xD1:
|
||||
@@ -28,7 +36,11 @@
|
||||
case 0xD5:
|
||||
case 0xD6:
|
||||
case 0xD7: /* FCOM */
|
||||
fpu_fcom(emu, ST(nextop&7).d); // TODO: is this ok?
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcom(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcom(emu, ST(nextop&7).d);
|
||||
#endif
|
||||
break;
|
||||
case 0xD8:
|
||||
case 0xD9:
|
||||
@@ -38,7 +50,11 @@
|
||||
case 0xDD:
|
||||
case 0xDE:
|
||||
case 0xDF: /* FCOMP */
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcom(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcom(emu, ST(nextop&7).d); // TODO: is this ok?
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xE0:
|
||||
@@ -49,7 +65,11 @@
|
||||
case 0xE5:
|
||||
case 0xE6:
|
||||
case 0xE7: /* FSUBR */
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f = ST0.f -ST(nextop&7).f;
|
||||
#else
|
||||
ST(nextop&7).d = ST0.d -ST(nextop&7).d;
|
||||
#endif
|
||||
break;
|
||||
case 0xE8:
|
||||
case 0xE9:
|
||||
@@ -59,7 +79,11 @@
|
||||
case 0xED:
|
||||
case 0xEE:
|
||||
case 0xEF: /* FSUB */
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f -= ST0.f;
|
||||
#else
|
||||
ST(nextop&7).d -= ST0.d;
|
||||
#endif
|
||||
break;
|
||||
case 0xF0:
|
||||
case 0xF1:
|
||||
@@ -69,7 +93,11 @@
|
||||
case 0xF5:
|
||||
case 0xF6:
|
||||
case 0xF7: /* FDIVR */
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f = ST0.f / ST(nextop&7).f;
|
||||
#else
|
||||
ST(nextop&7).d = ST0.d / ST(nextop&7).d;
|
||||
#endif
|
||||
break;
|
||||
case 0xF8:
|
||||
case 0xF9:
|
||||
@@ -79,26 +107,48 @@
|
||||
case 0xFD:
|
||||
case 0xFE:
|
||||
case 0xFF: /* FDIV */
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f /= ST0.f;
|
||||
#else
|
||||
ST(nextop&7).d /= ST0.d;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
GET_ED;
|
||||
switch((nextop>>3)&7) {
|
||||
case 0: /* FADD ST0, double */
|
||||
#ifdef USE_FLOAT
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.f += *(double*)ED;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.f += d;
|
||||
}
|
||||
#else
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.d += *(double*)ED;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.d += d;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1: /* FMUL ST0, double */
|
||||
#ifdef USE_FLOAT
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.f *= *(double*)ED;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.f *= d;
|
||||
}
|
||||
#else
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.d *= *(double*)ED;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.d *= d;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 2: /* FCOM ST0, double */
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
@@ -118,36 +168,72 @@
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 4: /* FSUB ST0, double */
|
||||
#ifdef USE_FLOAT
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.f -= *(double*)ED;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.f -= d;
|
||||
}
|
||||
#else
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.d -= *(double*)ED;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.d -= d;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 5: /* FSUBR ST0, double */
|
||||
#ifdef USE_FLOAT
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.f = *(double*)ED - ST0.f;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.f = d - ST0.f;
|
||||
}
|
||||
#else
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.d = *(double*)ED - ST0.d;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.d = d - ST0.d;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 6: /* FDIV ST0, double */
|
||||
#ifdef USE_FLOAT
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.f /= *(double*)ED;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.f /= d;
|
||||
}
|
||||
#else
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.d /= *(double*)ED;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.d /= d;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 7: /* FDIVR ST0, double */
|
||||
#ifdef USE_FLOAT
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.f = *(double*)ED / ST0.f;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.f = d / ST0.f;
|
||||
}
|
||||
#else
|
||||
if(!(((uintptr_t)ED)&7))
|
||||
ST0.d = *(double*)ED / ST0.d;
|
||||
else {
|
||||
*(uint64_t*)&d = *(uint64_t*)ED;
|
||||
ST0.d = d / ST0.d;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
goto _default;
|
||||
|
||||
+42
@@ -40,7 +40,11 @@
|
||||
case 0xE5:
|
||||
case 0xE6:
|
||||
case 0xE7:
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcom(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcom(emu, ST(nextop&7).d); // bad, should handle QNaN and IA interrupt
|
||||
#endif
|
||||
break;
|
||||
case 0xE8: /* FUCOMP ST0, STx */
|
||||
case 0xE9:
|
||||
@@ -50,7 +54,11 @@
|
||||
case 0xED:
|
||||
case 0xEE:
|
||||
case 0xEF:
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcom(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcom(emu, ST(nextop&7).d); // bad, should handle QNaN and IA interrupt
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
|
||||
@@ -85,15 +93,39 @@
|
||||
case 0: /* FLD double */
|
||||
GET_ED;
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
*(uint64_t*)&d = *(int64_t*)ED;
|
||||
ST0.f = d;
|
||||
#else
|
||||
ST0.ll = *(int64_t*)ED;
|
||||
#endif
|
||||
break;
|
||||
case 1: /* FISTTP ED qword */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
*(int64_t*)ED = ST0.f;
|
||||
#else
|
||||
*(int64_t*)ED = ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 2: /* FST double */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
d = ST0.f;
|
||||
*(int64_t*)ED = *(uint64_t*)&d;
|
||||
#else
|
||||
*(int64_t*)ED = ST0.ll;
|
||||
#endif
|
||||
break;
|
||||
case 3: /* FSTP double */
|
||||
GET_ED;
|
||||
#ifdef USE_FLOAT
|
||||
d = ST0.f;
|
||||
*(int64_t*)ED = *(uint64_t*)&d;
|
||||
#else
|
||||
*(int64_t*)ED = ST0.ll;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 4: /* FRSTOR m108byte */
|
||||
@@ -104,7 +136,12 @@
|
||||
char* p =(char*)ED;
|
||||
p += 28;
|
||||
for (int i=0; i<8; ++i) {
|
||||
#ifdef USE_FLOAT
|
||||
d = ST(i).f;
|
||||
LD2D(p, &d);
|
||||
#else
|
||||
LD2D(p, &ST(i).d);
|
||||
#endif
|
||||
p+=10;
|
||||
}
|
||||
}
|
||||
@@ -119,7 +156,12 @@
|
||||
char* p =(char*)ED;
|
||||
p += 28;
|
||||
for (int i=0; i<8; ++i) {
|
||||
#ifdef USE_FLOAT
|
||||
D2LD(&d, p);
|
||||
ST(i).f = d;
|
||||
#else
|
||||
D2LD(&ST(i).d, p);
|
||||
#endif
|
||||
p+=10;
|
||||
}
|
||||
}
|
||||
|
||||
+68
-7
@@ -1,7 +1,11 @@
|
||||
nextop = F8;
|
||||
switch (nextop) {
|
||||
case 0xC1: /* FADDP ST1, ST0 */
|
||||
#ifdef USE_FLOAT
|
||||
ST(1).f += ST0.f;
|
||||
#else
|
||||
ST(1).d += ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xC0: /* FADDP STx, ST0 */
|
||||
@@ -11,11 +15,19 @@
|
||||
case 0xC5:
|
||||
case 0xC6:
|
||||
case 0xC7:
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f += ST0.f;
|
||||
#else
|
||||
ST(nextop&7).d += ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xC9: /* FMULP ST1, ST0 */
|
||||
#ifdef USE_FLOAT
|
||||
ST1.f *= ST0.f;
|
||||
#else
|
||||
ST1.d *= ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xC8: /* FMULP STx, ST0 */
|
||||
@@ -25,11 +37,19 @@
|
||||
case 0xCD:
|
||||
case 0xCE:
|
||||
case 0xCF:
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f *= ST0.f;
|
||||
#else
|
||||
ST(nextop&7).d *= ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xD9: /* FCOMPP */
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcom(emu, ST1.f);
|
||||
#else
|
||||
fpu_fcom(emu, ST1.d);
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
@@ -45,11 +65,19 @@
|
||||
case 0xE5:
|
||||
case 0xE6:
|
||||
case 0xE7:
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f = ST0.f - ST(nextop&7).f;
|
||||
#else
|
||||
ST(nextop&7).d = ST0.d - ST(nextop&7).d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xE9: /* FSUBP ST1, ST0 */
|
||||
#ifdef USE_FLOAT
|
||||
ST1.f -= ST0.f;
|
||||
#else
|
||||
ST1.d -= ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 0xE8: /* FSUBP STx, ST0 */
|
||||
@@ -59,12 +87,13 @@
|
||||
case 0xED:
|
||||
case 0xEE:
|
||||
case 0xEF:
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f -= ST0.f;
|
||||
#else
|
||||
ST(nextop&7).d -= ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
/*ST(1).d = ST0.d / ST(1).d;
|
||||
fpu_do_pop(emu);
|
||||
break;*/
|
||||
case 0xF0: /* FDIVRP STx, ST0 */
|
||||
case 0xF1: /* FDIVRP ST1, ST0 */
|
||||
case 0xF2:
|
||||
@@ -73,13 +102,13 @@
|
||||
case 0xF5:
|
||||
case 0xF6:
|
||||
case 0xF7:
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f = ST0.f / ST(nextop&7).f;
|
||||
#else
|
||||
ST(nextop&7).d = ST0.d / ST(nextop&7).d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
/*d = ST0.d;
|
||||
fpu_do_pop(emu);
|
||||
ST0.d /= d;
|
||||
break;*/
|
||||
case 0xF8: /* FDIVP STx, ST0 */
|
||||
case 0xF9: /* FDIVP ST1, ST0 */
|
||||
case 0xFA:
|
||||
@@ -88,7 +117,11 @@
|
||||
case 0xFD:
|
||||
case 0xFE:
|
||||
case 0xFF:
|
||||
#ifdef USE_FLOAT
|
||||
ST(nextop&7).f /= ST0.f;
|
||||
#else
|
||||
ST(nextop&7).d /= ST0.d;
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
|
||||
@@ -113,23 +146,51 @@
|
||||
switch((nextop>>3)&7) {
|
||||
case 0: /* FIADD ST0, Ew int */
|
||||
GET_EW;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f += EW->sword[0];
|
||||
#else
|
||||
ST0.d += EW->sword[0];
|
||||
#endif
|
||||
break;
|
||||
case 1: /* FIMUL ST0, Ew int */
|
||||
GET_EW;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f *= EW->sword[0];
|
||||
#else
|
||||
ST0.d *= EW->sword[0];
|
||||
#endif
|
||||
break;
|
||||
case 4: /* FISUB ST0, Ew int */
|
||||
GET_EW;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f -= EW->sword[0];
|
||||
#else
|
||||
ST0.d -= EW->sword[0];
|
||||
#endif
|
||||
break;
|
||||
case 5: /* FISUBR ST0, Ew int */
|
||||
GET_EW;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = EW->sword[0] - ST0.f;
|
||||
#else
|
||||
ST0.d = EW->sword[0] - ST0.d;
|
||||
#endif
|
||||
break;
|
||||
case 6: /* FIDIV ST0, Ew int */
|
||||
GET_EW;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f /= EW->sword[0];
|
||||
#else
|
||||
ST0.d /= EW->sword[0];
|
||||
#endif
|
||||
break;
|
||||
case 7: /* FIDIVR ST0, Ew int */
|
||||
GET_EW;
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = EW->sword[0] / ST0.f;
|
||||
#else
|
||||
ST0.d = EW->sword[0] / ST0.d;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
goto _default;
|
||||
|
||||
+105
-12
@@ -13,7 +13,11 @@
|
||||
case 0xED:
|
||||
case 0xEE:
|
||||
case 0xEF:
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcomi(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcomi(emu, ST(nextop&7).d); // bad, should handle QNaN and IA interrupt
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
|
||||
@@ -25,7 +29,11 @@
|
||||
case 0xF5:
|
||||
case 0xF6:
|
||||
case 0xF7:
|
||||
#ifdef USE_FLOAT
|
||||
fpu_fcomi(emu, ST(nextop&7).f);
|
||||
#else
|
||||
fpu_fcomi(emu, ST(nextop&7).d);
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
|
||||
@@ -84,31 +92,105 @@
|
||||
GET_EW;
|
||||
tmp16s = EW->sword[0];
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = tmp16s;
|
||||
#else
|
||||
ST0.d = tmp16s;
|
||||
#endif
|
||||
break;
|
||||
case 1: /* FISTTP Ew, ST0 */
|
||||
GET_EW;
|
||||
#ifdef USE_FLOAT
|
||||
tmp16s = ST0.f;
|
||||
#else
|
||||
tmp16s = ST0.d;
|
||||
#endif
|
||||
EW->sword[0] = tmp16s;
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 2: /* FIST Ew, ST0 */
|
||||
GET_EW;
|
||||
tmp32s = ST0.d;
|
||||
if((tmp32s<-32768) || (tmp32s>32767))
|
||||
tmp16s=0x8000;
|
||||
else
|
||||
tmp16s = tmp32s;
|
||||
EW->sword[0] = tmp16s;
|
||||
#ifdef USE_FLOAT
|
||||
if(isgreater(ST0.f, (float)(int32_t)0x7fff) || isless(ST0.f, -(float)(int32_t)0x7fff))
|
||||
EW->sword[0] = 0x8000;
|
||||
else {
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
EW->sword[0] = floorf(ST0.f+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
EW->sword[0] = floorf(ST0.f);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
EW->sword[0] = ceilf(ST0.f);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
EW->sword[0] = ST0.f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(isgreater(ST0.d, (double)(int32_t)0x7fff) || isless(ST0.d, -(double)(int32_t)0x7fff))
|
||||
EW->sword[0] = 0x8000;
|
||||
else {
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
EW->sword[0] = floor(ST0.d+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
EW->sword[0] = floor(ST0.d);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
EW->sword[0] = ceil(ST0.d);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
EW->sword[0] = ST0.d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 3: /* FISTP Ew, ST0 */
|
||||
GET_EW;
|
||||
tmp32s = ST0.d;
|
||||
if((tmp32s<-32768) || (tmp32s>32767))
|
||||
tmp16s=0x8000;
|
||||
else
|
||||
tmp16s = tmp32s;
|
||||
EW->sword[0] = tmp16s;
|
||||
#ifdef USE_FLOAT
|
||||
if(isgreater(ST0.f, (float)(int32_t)0x7fff) || isless(ST0.f, -(float)(int32_t)0x7fff))
|
||||
EW->sword[0] = 0x8000;
|
||||
else {
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
EW->sword[0] = floorf(ST0.f+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
EW->sword[0] = floorf(ST0.f);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
EW->sword[0] = ceilf(ST0.f);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
EW->sword[0] = ST0.f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(isgreater(ST0.d, (double)(int32_t)0x7fff) || isless(ST0.d, -(double)(int32_t)0x7fff))
|
||||
EW->sword[0] = 0x8000;
|
||||
else {
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
EW->sword[0] = floor(ST0.d+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
EW->sword[0] = floor(ST0.d);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
EW->sword[0] = ceil(ST0.d);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
EW->sword[0] = ST0.d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
case 4: /* FBLD ST0, tbytes */
|
||||
@@ -120,7 +202,11 @@
|
||||
GET_ED;
|
||||
tmp64s = *(int64_t*)ED;
|
||||
fpu_do_push(emu);
|
||||
#ifdef USE_FLOAT
|
||||
ST0.f = tmp64s;
|
||||
#else
|
||||
ST0.d = tmp64s;
|
||||
#endif
|
||||
STll(0).ll = tmp64s;
|
||||
STll(0).ref = ST0.ll;
|
||||
break;
|
||||
@@ -134,10 +220,17 @@
|
||||
if(STll(0).ref==ST(0).ll) {
|
||||
*(int64_t*)ED = STll(0).ll;
|
||||
} else {
|
||||
#ifdef USE_FLOAT
|
||||
if(isgreater(ST0.f, (float)(int64_t)0x7fffffffffffffffLL) || isless(ST0.f, (float)(int64_t)0x8000000000000000LL))
|
||||
*(int64_t*)ED = 0x8000000000000000LL;
|
||||
else
|
||||
*(int64_t*)ED = (int64_t)ST0.f;
|
||||
#else
|
||||
if(isgreater(ST0.d, (double)(int64_t)0x7fffffffffffffffLL) || isless(ST0.d, (double)(int64_t)0x8000000000000000LL))
|
||||
*(int64_t*)ED = 0x8000000000000000LL;
|
||||
else
|
||||
*(int64_t*)ED = (int64_t)ST0.d;
|
||||
#endif
|
||||
}
|
||||
fpu_do_pop(emu);
|
||||
break;
|
||||
|
||||
+18
-2
@@ -23,12 +23,28 @@
|
||||
break;
|
||||
|
||||
case 0x2C: /* CVTTSD2SI Gd, Ex */
|
||||
case 0x2D: /* CVTSD2SI Gd, Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
GD.sdword[0] = EX->d[0];
|
||||
break;
|
||||
|
||||
case 0x2D: /* CVTSD2SI Gd, Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
GD.sdword[0] = floor(EX->d[0]+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
GD.sdword[0] = floor(EX->d[0]);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
GD.sdword[0] = ceil(EX->d[0]);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
GD.sdword[0] = EX->d[0];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x51: /* SQRTSD Gx, Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
|
||||
+37
-1
@@ -23,11 +23,28 @@
|
||||
break;
|
||||
|
||||
case 0x2C: /* CVTTSS2SI Gd, Ex */
|
||||
case 0x2D: /* CVTSS2SI Gd, Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
GD.sdword[0] = EX->f[0];
|
||||
break;
|
||||
case 0x2D: /* CVTSS2SI Gd, Ex */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
switch(emu->round) {
|
||||
case ROUND_Nearest:
|
||||
GD.sdword[0] = floor(EX->f[0]+0.5);
|
||||
break;
|
||||
case ROUND_Down:
|
||||
GD.sdword[0] = floor(EX->f[0]);
|
||||
break;
|
||||
case ROUND_Up:
|
||||
GD.sdword[0] = ceil(EX->f[0]);
|
||||
break;
|
||||
case ROUND_Chop:
|
||||
GD.sdword[0] = EX->f[0];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x51: /* SQRTSS Gx, Ex */
|
||||
nextop = F8;
|
||||
@@ -114,6 +131,25 @@
|
||||
memcpy(EX, &GX, 16); // unaligned...
|
||||
break;
|
||||
|
||||
case 0xBC: /* TZCNT Ew,Gw */
|
||||
CHECK_FLAGS(emu);
|
||||
nextop = F8;
|
||||
GET_ED;
|
||||
tmp32u = ED->dword[0];
|
||||
if(tmp32u) {
|
||||
CLEAR_FLAG(F_ZF);
|
||||
tmp8u = 0;
|
||||
while(!(tmp32u&(1<<tmp8u))) ++tmp8u;
|
||||
GD.dword[0] = tmp8u;
|
||||
CONDITIONAL_SET_FLAG(tmp8u, F_ZF);
|
||||
CLEAR_FLAG(F_CF);
|
||||
} else {
|
||||
CLEAR_FLAG(F_ZF);
|
||||
SET_FLAG(F_CF);
|
||||
GD.dword[0] = 32;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xC2: /* CMPSS Gx, Ex, Ib */
|
||||
nextop = F8;
|
||||
GET_EX;
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ void AddNativeRW(x86emu_t* emu, SDL1_RWops_t* ops)
|
||||
// get or create wrapper, add it to map and change to the emulated one if rw
|
||||
#define GO(A, W) \
|
||||
fnc = CheckBridged(system, ops->A); \
|
||||
if(!fnc) fnc = AddBridge(system, W, ops->A); \
|
||||
if(!fnc) fnc = AddBridge(system, W, ops->A, 0); \
|
||||
ops->A = (sdl1_##A)fnc;
|
||||
|
||||
GO(seek, iFpii)
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ void AddNativeRW2(x86emu_t* emu, SDL2_RWops_t* ops)
|
||||
// get or create wrapper, add it to map and change to the emulated one if rw
|
||||
#define GO(A, W) \
|
||||
fnc = CheckBridged(system, ops->A); \
|
||||
if(!fnc) fnc = AddBridge(system, W, ops->A); \
|
||||
if(!fnc) fnc = AddBridge(system, W, ops->A, 0); \
|
||||
ops->A = (sdl2_##A)fnc;
|
||||
|
||||
GO(size, IFp)
|
||||
|
||||
+12
@@ -38,6 +38,18 @@ void Push16(x86emu_t *emu, uint16_t v)
|
||||
R_ESP -= 2;
|
||||
*((uint16_t*)R_ESP) = v;
|
||||
}
|
||||
uint32_t Pop32(x86emu_t *emu)
|
||||
{
|
||||
uint32_t* st = ((uint32_t*)(R_ESP));
|
||||
R_ESP += 4;
|
||||
return *st;
|
||||
}
|
||||
|
||||
void Push32(x86emu_t *emu, uint32_t v)
|
||||
{
|
||||
R_ESP -= 4;
|
||||
*((uint32_t*)R_ESP) = v;
|
||||
}
|
||||
|
||||
void PushString(x86emu_t *emu, const char* s)
|
||||
{
|
||||
|
||||
@@ -11,5 +11,7 @@ void SetupInitialStack(box86context_t *context);
|
||||
|
||||
uint16_t Pop16(x86emu_t *emu);
|
||||
void Push16(x86emu_t *emu, uint16_t v);
|
||||
uint32_t Pop32(x86emu_t *emu);
|
||||
void Push32(x86emu_t *emu, uint32_t v);
|
||||
|
||||
#endif //__STACK_H_
|
||||
+143
-73
@@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "box86context.h"
|
||||
@@ -18,19 +19,11 @@
|
||||
// memory handling to be perfected...
|
||||
// keep a hash thread_t -> emu to set emu->quit to 1 on pthread_cancel
|
||||
|
||||
typedef struct emuthread_s {
|
||||
x86emu_t *emu;
|
||||
int stacksize;
|
||||
void *stack;
|
||||
} emuthread_t;
|
||||
|
||||
static void pthread_clean_routine(void* p)
|
||||
{
|
||||
emuthread_t *et = (emuthread_t*)p;
|
||||
x86emu_t *emu = (x86emu_t*)p;
|
||||
|
||||
FreeX86Emu(&et->emu);
|
||||
free(et->stack);
|
||||
free(et);
|
||||
FreeX86Emu(&emu);
|
||||
}
|
||||
|
||||
static void* pthread_routine(void* p)
|
||||
@@ -38,9 +31,9 @@ static void* pthread_routine(void* p)
|
||||
void* r = NULL;
|
||||
|
||||
pthread_cleanup_push(pthread_clean_routine, p);
|
||||
emuthread_t *et = (emuthread_t*)p;
|
||||
Run(et->emu);
|
||||
r = (void*)GetEAX(et->emu);
|
||||
x86emu_t *emu = (x86emu_t*)p;
|
||||
Run(emu);
|
||||
r = (void*)GetEAX(emu);
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
return r;
|
||||
@@ -48,52 +41,40 @@ static void* pthread_routine(void* p)
|
||||
|
||||
int EXPORT my_pthread_create(x86emu_t *emu, void* t, void* attr, void* start_routine, void* arg)
|
||||
{
|
||||
emuthread_t *emuthread = (emuthread_t*)calloc(1, sizeof(emuthread_t));
|
||||
|
||||
emuthread->stacksize = 2*1024*1024; //default stack size is 2Mo
|
||||
int stacksize = 2*1024*1024; //default stack size is 2Mo
|
||||
// TODO: get stack size inside attr
|
||||
emuthread->stack = calloc(1, emuthread->stacksize);
|
||||
emuthread->emu = NewX86Emu(emu->context, (uintptr_t)start_routine, (uintptr_t)emuthread->stack,
|
||||
emuthread->stacksize);
|
||||
SetupX86Emu(emuthread->emu, emu->shared_global, emu->globals);
|
||||
emuthread->emu->trace_start = emu->trace_start;
|
||||
emuthread->emu->trace_end = emu->trace_end;
|
||||
Push(emuthread->emu, (uintptr_t)arg);
|
||||
PushExit(emuthread->emu);
|
||||
|
||||
void* stack = calloc(1, stacksize);
|
||||
x86emu_t *emuthread = NewX86Emu(emu->context, (uintptr_t)start_routine, (uintptr_t)stack,
|
||||
stacksize, 1);
|
||||
SetupX86Emu(emuthread, emu->shared_global, emu->globals);
|
||||
emuthread->trace_start = emu->trace_start;
|
||||
emuthread->trace_end = emu->trace_end;
|
||||
Push(emuthread, (uintptr_t)arg);
|
||||
PushExit(emuthread);
|
||||
// create thread
|
||||
return pthread_create((pthread_t*)t, (const pthread_attr_t *)attr,
|
||||
pthread_routine, emuthread);
|
||||
}
|
||||
|
||||
int EXPORT my_pthread_key_create(x86emu_t* emu, void* key, void* dtor)
|
||||
{
|
||||
if(!dtor)
|
||||
return pthread_key_create((pthread_key_t*)key, NULL);
|
||||
printf_log(LOG_NONE, "Error: pthread_key_create with destructor not implemented\n");
|
||||
emu->quit = 1;
|
||||
return -1;
|
||||
}
|
||||
EXPORT int my___pthread_key_create(x86emu_t* emu, void* key, void* dtor) __attribute__((alias("my_pthread_key_create")));
|
||||
|
||||
|
||||
|
||||
KHASH_MAP_INIT_INT(once, int)
|
||||
|
||||
#define nb_once 16
|
||||
typedef void(*thread_once)(void);
|
||||
static x86emu_t *once_emu[nb_once] = {0};
|
||||
static void thread_once_callback(int n)
|
||||
#define nb_dtor 16
|
||||
typedef void(*key_dtor)(void*);
|
||||
static x86emu_t *dtor_emu[nb_dtor] = {0};
|
||||
static void key_dtor_callback(int n, void* a)
|
||||
{
|
||||
if(once_emu[n]) {
|
||||
RunCallback(once_emu[n]);
|
||||
FreeCallback(once_emu[n]);
|
||||
once_emu[n] = NULL;
|
||||
if(dtor_emu[n]) {
|
||||
SetCallbackArg(dtor_emu[n], 0, a);
|
||||
RunCallback(dtor_emu[n]);
|
||||
}
|
||||
}
|
||||
#define GO(N) \
|
||||
void thread_once_callback_##N() \
|
||||
void key_dtor_callback_##N(void* a) \
|
||||
{ \
|
||||
thread_once_callback(N); \
|
||||
key_dtor_callback(N, a); \
|
||||
}
|
||||
GO(0)
|
||||
GO(1)
|
||||
@@ -112,39 +93,128 @@ GO(13)
|
||||
GO(14)
|
||||
GO(15)
|
||||
#undef GO
|
||||
thread_once once_cb[nb_once] = {
|
||||
thread_once_callback_0, thread_once_callback_1, thread_once_callback_2, thread_once_callback_3
|
||||
,thread_once_callback_4, thread_once_callback_5, thread_once_callback_6, thread_once_callback_7
|
||||
,thread_once_callback_8, thread_once_callback_9, thread_once_callback_10,thread_once_callback_11
|
||||
,thread_once_callback_12,thread_once_callback_13,thread_once_callback_14,thread_once_callback_15
|
||||
static const key_dtor dtor_cb[nb_dtor] = {
|
||||
key_dtor_callback_0, key_dtor_callback_1, key_dtor_callback_2, key_dtor_callback_3
|
||||
,key_dtor_callback_4, key_dtor_callback_5, key_dtor_callback_6, key_dtor_callback_7
|
||||
,key_dtor_callback_8, key_dtor_callback_9, key_dtor_callback_10,key_dtor_callback_11
|
||||
,key_dtor_callback_12,key_dtor_callback_13,key_dtor_callback_14,key_dtor_callback_15
|
||||
};
|
||||
kh_once_t *once_map = NULL;
|
||||
// TODO: put all this in libpthread private stuff...
|
||||
static x86emu_t *once_emu = NULL;
|
||||
static uintptr_t once_fnc = 0;
|
||||
static void my_thread_once_callback()
|
||||
{
|
||||
if(!once_emu)
|
||||
return;
|
||||
EmuCall(once_emu, once_fnc);
|
||||
}
|
||||
static x86emu_t *once2_emu = NULL;
|
||||
static uintptr_t once2_fnc = 0;
|
||||
static void my_thread_once2_callback()
|
||||
{
|
||||
if(!once2_emu)
|
||||
return;
|
||||
EmuCall(once2_emu, once2_fnc);
|
||||
}
|
||||
|
||||
int EXPORT my_pthread_once(x86emu_t* emu, void* once, void* cb)
|
||||
{
|
||||
// look if that once already is in map
|
||||
pthread_mutex_lock(&emu->context->mutex_once);
|
||||
if(!once_map) {
|
||||
once_map = kh_init(once);
|
||||
if(pthread_mutex_trylock(&emu->context->mutex_once)==EBUSY)
|
||||
{
|
||||
// 2nd level...
|
||||
pthread_mutex_lock(&emu->context->mutex_once2);
|
||||
once2_emu = emu;
|
||||
once2_fnc = (uintptr_t)cb;
|
||||
int ret = pthread_once(once, my_thread_once2_callback);
|
||||
once_emu = NULL;
|
||||
pthread_mutex_unlock(&emu->context->mutex_once2);
|
||||
return ret;
|
||||
} else {
|
||||
once_emu = emu;
|
||||
once_fnc = (uintptr_t)cb;
|
||||
int ret = pthread_once(once, my_thread_once_callback);
|
||||
once_emu = NULL;
|
||||
|
||||
pthread_mutex_unlock(&emu->context->mutex_once);
|
||||
return ret;
|
||||
}
|
||||
khint_t k;
|
||||
k = kh_get(once, once_map, (uintptr_t)once);
|
||||
if(k!=kh_end(once_map)) {
|
||||
pthread_mutex_unlock(&emu->context->mutex_once);
|
||||
return pthread_once(once, once_cb[kh_value(once_map, k)]);
|
||||
}
|
||||
// look for a free slot
|
||||
for(int i=0; i<nb_once; ++i)
|
||||
if(!once_emu[i]) {
|
||||
once_emu[i] = AddCallback(emu, (uintptr_t)cb, 0, NULL, NULL, NULL, NULL);
|
||||
int ret;
|
||||
k = kh_put(once, once_map, (uintptr_t)once, &ret); // add to map
|
||||
kh_value(once_map, k) = i;
|
||||
pthread_mutex_unlock(&emu->context->mutex_once);
|
||||
return pthread_once(once, once_cb[i]);
|
||||
}
|
||||
|
||||
EXPORT int my_pthread_key_create(x86emu_t* emu, void* key, void* dtor)
|
||||
{
|
||||
if(!dtor)
|
||||
return pthread_key_create((pthread_key_t*)key, NULL);
|
||||
int n = 0;
|
||||
while (n<nb_dtor) {
|
||||
if(!dtor_emu[n] || GetCallbackAddress(dtor_emu[n])==((uintptr_t)dtor)) {
|
||||
if(!dtor_emu[n])
|
||||
dtor_emu[n] = AddSmallCallback(emu, (uintptr_t)dtor, 1, NULL, NULL, NULL, NULL);
|
||||
return pthread_key_create((pthread_key_t*)key, dtor_cb[n]);
|
||||
}
|
||||
printf_log(LOG_NONE, "Warning, no more slot on pthread_once");
|
||||
pthread_mutex_unlock(&emu->context->mutex_once);
|
||||
return 0;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
printf_log(LOG_NONE, "Error: pthread_key_create with destructor: no more slot!\n");
|
||||
emu->quit = 1;
|
||||
return -1;
|
||||
}
|
||||
EXPORT int my___pthread_key_create(x86emu_t* emu, void* key, void* dtor) __attribute__((alias("my_pthread_key_create")));
|
||||
|
||||
// phtread_cond_init with null attr seems to only write 1 (NULL) dword on x86, while it 48 bytes on ARM.
|
||||
// Not sure why as sizeof(pthread_cond_init) is 48 on both platform... But Neverwinter Night init seems to rely on that
|
||||
// What about cond that are statically initialized?
|
||||
#define COND_SIGN 0x513248F8 // random stuff...
|
||||
typedef struct wrapped_cond_s {
|
||||
uint32_t sign;
|
||||
pthread_cond_t *cond;
|
||||
} wrapped_cond_t;
|
||||
|
||||
static pthread_cond_t* get_cond(void* cond)
|
||||
{
|
||||
wrapped_cond_t *wcond = (wrapped_cond_t*)cond;
|
||||
if(wcond->sign != COND_SIGN) {
|
||||
// else, lets consider this is a statically initialized condition, so lets create a wrapped one
|
||||
wcond->cond = (pthread_cond_t *)calloc(1, sizeof(pthread_cond_t)); // yep, that will leak...
|
||||
wcond->sign = COND_SIGN;
|
||||
pthread_cond_init(wcond->cond, NULL);
|
||||
}
|
||||
return wcond->cond;
|
||||
}
|
||||
|
||||
EXPORT int my_pthread_cond_broadcast(x86emu_t* emu, void* cond)
|
||||
{
|
||||
pthread_cond_t * c = get_cond(cond);
|
||||
return pthread_cond_broadcast(c);
|
||||
}
|
||||
EXPORT int my_pthread_cond_destroy(x86emu_t* emu, void* cond)
|
||||
{
|
||||
pthread_cond_t * c = get_cond(cond);
|
||||
int ret = pthread_cond_destroy(c);
|
||||
wrapped_cond_t* wcond = (wrapped_cond_t*)cond;
|
||||
if(wcond->sign == COND_SIGN) {
|
||||
free(wcond->cond);
|
||||
wcond->sign = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT int my_pthread_cond_init(x86emu_t* emu, void* cond, void* attr)
|
||||
{
|
||||
wrapped_cond_t* wcond = (wrapped_cond_t *)cond;
|
||||
wcond->cond = (pthread_cond_t *)calloc(1, sizeof(pthread_cond_t));
|
||||
wcond->sign = COND_SIGN;
|
||||
return pthread_cond_init(wcond->cond, (const pthread_condattr_t*)attr);
|
||||
}
|
||||
EXPORT int my_pthread_cond_signal(x86emu_t* emu, void* cond)
|
||||
{
|
||||
pthread_cond_t * c = get_cond(cond);
|
||||
return pthread_cond_signal(c);
|
||||
}
|
||||
EXPORT int my_pthread_cond_timedwait(x86emu_t* emu, void* cond, void* mutex, void* abstime)
|
||||
{
|
||||
pthread_cond_t * c = get_cond(cond);
|
||||
return pthread_cond_timedwait(c, (pthread_mutex_t*)mutex, (const struct timespec*)abstime);
|
||||
}
|
||||
EXPORT int my_pthread_cond_wait(x86emu_t* emu, void* cond, void* mutex)
|
||||
{
|
||||
pthread_cond_t * c = get_cond(cond);
|
||||
return pthread_cond_wait(c, (pthread_mutex_t*)mutex);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
#include "debug.h"
|
||||
|
||||
const char* curlName = "libcurl.so.4";
|
||||
#define LIBNAME curl
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
GO(curl_easy_cleanup, vFp)
|
||||
//GO(curl_easy_duphandle,
|
||||
//GO(curl_easy_escape,
|
||||
GO(curl_easy_getinfo, uFpppppp) //vararg
|
||||
GO(curl_easy_init, pFv)
|
||||
//GO(curl_easy_pause,
|
||||
//GO(curl_easy_perform,
|
||||
//GO(curl_easy_recv,
|
||||
//GO(curl_easy_reset,
|
||||
//GO(curl_easy_send,
|
||||
//GOM(curl_easy_setopt, uFEpup) // can set many callbacks!
|
||||
//GO(curl_easy_strerror,
|
||||
//GO(curl_easy_unescape,
|
||||
//GO(curl_escape,
|
||||
//GO(curl_formadd,
|
||||
//GO(curl_formfree,
|
||||
//GO(curl_formget,
|
||||
//GO(curl_free,
|
||||
//GO(curl_getdate,
|
||||
//GO(curl_getenv,
|
||||
GO(curl_global_cleanup, vFv)
|
||||
GO(curl_global_init, uFu)
|
||||
//GO(curl_global_init_mem,
|
||||
//GO(curl_global_sslset,
|
||||
//GO(curl_maprintf,
|
||||
//GO(curl_mfprintf,
|
||||
//GO(curl_mime_addpart,
|
||||
//GO(curl_mime_data,
|
||||
//GO(curl_mime_data_cb,
|
||||
//GO(curl_mime_encoder,
|
||||
//GO(curl_mime_filedata,
|
||||
//GO(curl_mime_filename,
|
||||
//GO(curl_mime_free,
|
||||
//GO(curl_mime_headers,
|
||||
//GO(curl_mime_init,
|
||||
//GO(curl_mime_name,
|
||||
//GO(curl_mime_subparts,
|
||||
//GO(curl_mime_type,
|
||||
//GO(curl_mprintf,
|
||||
//GO(curl_msnprintf,
|
||||
//GO(curl_msprintf,
|
||||
GO(curl_multi_add_handle, uFpp)
|
||||
//GO(curl_multi_assign,
|
||||
GO(curl_multi_cleanup, uFp)
|
||||
//GO(curl_multi_fdset,
|
||||
//GO(curl_multi_info_read,
|
||||
GO(curl_multi_init, pFv)
|
||||
GO(curl_multi_perform, uFpp)
|
||||
GO(curl_multi_remove_handle, uFpp)
|
||||
//GO(curl_multi_setopt,
|
||||
//GO(curl_multi_socket,
|
||||
//GO(curl_multi_socket_action,
|
||||
//GO(curl_multi_socket_all,
|
||||
//GO(curl_multi_strerror,
|
||||
//GO(curl_multi_timeout,
|
||||
//GO(curl_multi_wait,
|
||||
//GO(curl_mvaprintf,
|
||||
//GO(curl_mvfprintf,
|
||||
//GO(curl_mvprintf,
|
||||
//GO(curl_mvsnprintf,
|
||||
//GO(curl_mvsprintf,
|
||||
//GO(curl_pushheader_byname,
|
||||
//GO(curl_pushheader_bynum,
|
||||
//GO(curl_share_cleanup,
|
||||
//GO(curl_share_init,
|
||||
//GO(curl_share_setopt,
|
||||
//GO(curl_share_strerror,
|
||||
GO(curl_slist_append, pFpp)
|
||||
GO(curl_slist_free_all, vFp)
|
||||
//GO(curl_strequal,
|
||||
//GO(curl_strnequal,
|
||||
//GO(curl_unescape,
|
||||
//GO(curl_version,
|
||||
//GO(curl_version_info,
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* dbusName = "libdbus-1.so.3";
|
||||
#define LIBNAME dbus
|
||||
|
||||
|
||||
typedef int32_t(* DBusHandleMessageFunction) (void* connection, void* message, void* user_data);
|
||||
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+223
@@ -0,0 +1,223 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
GO(dbus_address_entries_free, vFp)
|
||||
GO(dbus_address_entry_get_method, pFp)
|
||||
GO(dbus_address_entry_get_value, pFpp)
|
||||
GO(dbus_address_escape_value, pFp)
|
||||
GO(dbus_address_unescape_value, pFpp)
|
||||
GO(dbus_bus_add_match, vFpp)
|
||||
GO(dbus_bus_get, pFip)
|
||||
GO(dbus_bus_get_id, pFpp)
|
||||
GO(dbus_bus_get_private, pFip)
|
||||
GO(dbus_bus_get_unique_name, pFp)
|
||||
GO(dbus_bus_get_unix_user, uFppp)
|
||||
GO(dbus_bus_name_has_owner, iFppp)
|
||||
GO(dbus_bus_register, iFpp)
|
||||
GO(dbus_bus_release_name, iFppp)
|
||||
GO(dbus_bus_remove_match, vFppp)
|
||||
GO(dbus_bus_request_name, iFppup)
|
||||
GO(dbus_bus_set_unique_name, iFpp)
|
||||
GO(dbus_bus_start_service_by_name, iFppupp)
|
||||
//GO(dbus_connection_add_filter,
|
||||
//GO(dbus_connection_allocate_data_slot,
|
||||
//GO(dbus_connection_borrow_message,
|
||||
GO(dbus_connection_close, vFp)
|
||||
//GO(dbus_connection_dispatch,
|
||||
//GO(dbus_connection_flush,
|
||||
//GO(dbus_connection_free_data_slot,
|
||||
//GO(dbus_connection_free_preallocated_send,
|
||||
//GO(dbus_connection_get_adt_audit_session_data,
|
||||
//GO(dbus_connection_get_data,
|
||||
//GO(dbus_connection_get_dispatch_status,
|
||||
//GO(dbus_connection_get_is_anonymous,
|
||||
//GO(dbus_connection_get_is_authenticated,
|
||||
GO(dbus_connection_get_is_connected, iFp)
|
||||
//GO(dbus_connection_get_max_message_size,
|
||||
//GO(dbus_connection_get_max_received_size,
|
||||
//GO(dbus_connection_get_object_path_data,
|
||||
//GO(dbus_connection_get_outgoing_size,
|
||||
//GO(dbus_connection_get_server_id,
|
||||
//GO(dbus_connection_get_socket,
|
||||
//GO(dbus_connection_get_unix_fd,
|
||||
//GO(dbus_connection_get_unix_process_id,
|
||||
//GO(dbus_connection_get_unix_user,
|
||||
//GO(dbus_connection_get_windows_user,
|
||||
//GO(dbus_connection_has_messages_to_send,
|
||||
//GO(dbus_connection_list_registered,
|
||||
//GO(dbus_connection_open,
|
||||
GO(dbus_connection_open_private, pFpp)
|
||||
//GO(dbus_connection_pop_message,
|
||||
//GO(dbus_connection_preallocate_send,
|
||||
//GO(dbus_connection_read_write,
|
||||
//GO(dbus_connection_read_write_dispatch,
|
||||
//GO(dbus_connection_ref,
|
||||
//GO(dbus_connection_register_fallback,
|
||||
//GO(dbus_connection_register_object_path,
|
||||
//GO(dbus_connection_remove_filter,
|
||||
//GO(dbus_connection_return_message,
|
||||
//GO(dbus_connection_send,
|
||||
//GO(dbus_connection_send_preallocated,
|
||||
//GO(dbus_connection_send_with_reply,
|
||||
//GO(dbus_connection_send_with_reply_and_block,
|
||||
//GO(dbus_connection_set_allow_anonymous,
|
||||
//GO(dbus_connection_set_change_sigpipe,
|
||||
//GO(dbus_connection_set_data,
|
||||
//GO(dbus_connection_set_dispatch_status_function,
|
||||
GO(dbus_connection_set_exit_on_disconnect, vFpi)
|
||||
//GO(dbus_connection_set_max_message_size,
|
||||
//GO(dbus_connection_set_max_received_size,
|
||||
//GO(dbus_connection_set_route_peer_messages,
|
||||
//GO(dbus_connection_set_timeout_functions,
|
||||
//GO(dbus_connection_set_unix_user_function,
|
||||
//GO(dbus_connection_set_wakeup_main_function,
|
||||
//GO(dbus_connection_set_watch_functions,
|
||||
//GO(dbus_connection_set_windows_user_function,
|
||||
//GO(dbus_connection_steal_borrowed_message,
|
||||
//GO(dbus_connection_try_register_fallback,
|
||||
//GO(dbus_connection_try_register_object_path,
|
||||
//GO(dbus_connection_unref,
|
||||
//GO(dbus_connection_unregister_object_path,
|
||||
//GO(dbus_error_free,
|
||||
//GO(dbus_error_has_name,
|
||||
//GO(dbus_error_init,
|
||||
//GO(dbus_error_is_set,
|
||||
//GO(dbus_free,
|
||||
//GO(dbus_free_string_array,
|
||||
//GO(dbus_get_local_machine_id,
|
||||
//GO(dbus_get_version,
|
||||
//GO(dbus_internal_do_not_use_create_uuid,
|
||||
//GO(dbus_internal_do_not_use_get_uuid,
|
||||
//GO(dbus_malloc,
|
||||
//GO(dbus_malloc0,
|
||||
//GO(dbus_message_allocate_data_slot,
|
||||
//GO(dbus_message_append_args,
|
||||
//GO(dbus_message_append_args_valist,
|
||||
//GO(dbus_message_copy,
|
||||
//GO(dbus_message_demarshal,
|
||||
//GO(dbus_message_demarshal_bytes_needed,
|
||||
//GO(dbus_message_free_data_slot,
|
||||
//GO(dbus_message_get_args,
|
||||
//GO(dbus_message_get_args_valist,
|
||||
//GO(dbus_message_get_auto_start,
|
||||
//GO(dbus_message_get_data,
|
||||
//GO(dbus_message_get_destination,
|
||||
//GO(dbus_message_get_error_name,
|
||||
//GO(dbus_message_get_interface,
|
||||
//GO(dbus_message_get_member,
|
||||
//GO(dbus_message_get_no_reply,
|
||||
//GO(dbus_message_get_path,
|
||||
//GO(dbus_message_get_path_decomposed,
|
||||
//GO(dbus_message_get_reply_serial,
|
||||
//GO(dbus_message_get_sender,
|
||||
//GO(dbus_message_get_serial,
|
||||
//GO(dbus_message_get_signature,
|
||||
//GO(dbus_message_get_type,
|
||||
//GO(dbus_message_has_destination,
|
||||
//GO(dbus_message_has_interface,
|
||||
//GO(dbus_message_has_member,
|
||||
//GO(dbus_message_has_path,
|
||||
//GO(dbus_message_has_sender,
|
||||
//GO(dbus_message_has_signature,
|
||||
//GO(dbus_message_is_error,
|
||||
//GO(dbus_message_is_method_call,
|
||||
//GO(dbus_message_is_signal,
|
||||
//GO(dbus_message_iter_abandon_container,
|
||||
//GO(dbus_message_iter_append_basic,
|
||||
//GO(dbus_message_iter_append_fixed_array,
|
||||
//GO(dbus_message_iter_close_container,
|
||||
//GO(dbus_message_iter_get_arg_type,
|
||||
//GO(dbus_message_iter_get_array_len,
|
||||
//GO(dbus_message_iter_get_basic,
|
||||
//GO(dbus_message_iter_get_element_type,
|
||||
//GO(dbus_message_iter_get_fixed_array,
|
||||
//GO(dbus_message_iter_get_signature,
|
||||
//GO(dbus_message_iter_has_next,
|
||||
GO(dbus_message_iter_init, iFpp)
|
||||
//GO(dbus_message_iter_init_append,
|
||||
//GO(dbus_message_iter_next,
|
||||
//GO(dbus_message_iter_open_container,
|
||||
//GO(dbus_message_iter_recurse,
|
||||
//GO(dbus_message_lock,
|
||||
//GO(dbus_message_marshal,
|
||||
//GO(dbus_message_new,
|
||||
//GO(dbus_message_new_error,
|
||||
//GO(dbus_message_new_error_printf,
|
||||
//GO(dbus_message_new_method_call,
|
||||
//GO(dbus_message_new_method_return,
|
||||
//GO(dbus_message_new_signal,
|
||||
//GO(dbus_message_ref,
|
||||
//GO(dbus_message_set_auto_start,
|
||||
//GO(dbus_message_set_data,
|
||||
//GO(dbus_message_set_destination,
|
||||
//GO(dbus_message_set_error_name,
|
||||
//GO(dbus_message_set_interface,
|
||||
//GO(dbus_message_set_member,
|
||||
//GO(dbus_message_set_no_reply,
|
||||
//GO(dbus_message_set_path,
|
||||
//GO(dbus_message_set_reply_serial,
|
||||
//GO(dbus_message_set_sender,
|
||||
//GO(dbus_message_set_serial,
|
||||
//GO(dbus_message_type_from_string,
|
||||
//GO(dbus_message_type_to_string,
|
||||
//GO(dbus_message_unref,
|
||||
//GO(dbus_move_error,
|
||||
GO(dbus_parse_address, iFpppp)
|
||||
//GO(dbus_pending_call_allocate_data_slot,
|
||||
//GO(dbus_pending_call_block,
|
||||
//GO(dbus_pending_call_cancel,
|
||||
//GO(dbus_pending_call_free_data_slot,
|
||||
//GO(dbus_pending_call_get_completed,
|
||||
//GO(dbus_pending_call_get_data,
|
||||
//GO(dbus_pending_call_ref,
|
||||
//GO(dbus_pending_call_set_data,
|
||||
//GO(dbus_pending_call_set_notify,
|
||||
//GO(dbus_pending_call_steal_reply,
|
||||
//GO(dbus_pending_call_unref,
|
||||
//GO(dbus_realloc,
|
||||
//GO(dbus_server_allocate_data_slot,
|
||||
//GO(dbus_server_disconnect,
|
||||
//GO(dbus_server_free_data_slot,
|
||||
//GO(dbus_server_get_address,
|
||||
//GO(dbus_server_get_data,
|
||||
//GO(dbus_server_get_id,
|
||||
//GO(dbus_server_get_is_connected,
|
||||
//GO(dbus_server_listen,
|
||||
//GO(dbus_server_ref,
|
||||
//GO(dbus_server_set_auth_mechanisms,
|
||||
//GO(dbus_server_set_data,
|
||||
//GO(dbus_server_set_new_connection_function,
|
||||
//GO(dbus_server_set_timeout_functions,
|
||||
//GO(dbus_server_set_watch_functions,
|
||||
//GO(dbus_server_unref,
|
||||
//GO(dbus_set_error,
|
||||
//GO(dbus_set_error_const,
|
||||
//GO(dbus_set_error_from_message,
|
||||
//GO(dbus_shutdown,
|
||||
//GO(dbus_signature_iter_get_current_type,
|
||||
//GO(dbus_signature_iter_get_element_type,
|
||||
//GO(dbus_signature_iter_get_signature,
|
||||
//GO(dbus_signature_iter_init,
|
||||
//GO(dbus_signature_iter_next,
|
||||
//GO(dbus_signature_iter_recurse,
|
||||
//GO(dbus_signature_validate,
|
||||
//GO(dbus_signature_validate_single,
|
||||
//GO(dbus_threads_init,
|
||||
//GO(dbus_threads_init_default,
|
||||
//GO(dbus_timeout_get_data,
|
||||
//GO(dbus_timeout_get_enabled,
|
||||
//GO(dbus_timeout_get_interval,
|
||||
//GO(dbus_timeout_handle,
|
||||
//GO(dbus_timeout_set_data,
|
||||
//GO(dbus_type_is_basic,
|
||||
//GO(dbus_type_is_container,
|
||||
//GO(dbus_type_is_fixed,
|
||||
//GO(dbus_watch_get_data,
|
||||
//GO(dbus_watch_get_enabled,
|
||||
//GO(dbus_watch_get_fd,
|
||||
//GO(dbus_watch_get_flags,
|
||||
//GO(dbus_watch_get_socket,
|
||||
//GO(dbus_watch_get_unix_fd,
|
||||
//GO(dbus_watch_handle,
|
||||
//GO(dbus_watch_set_data,
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* iconvName = "libiconv.so.2";
|
||||
#define LIBNAME iconv
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
GO(iconv_canonicalize, pFp)
|
||||
GO(libiconv, uFppppp)
|
||||
GO(libiconv_close, iFp)
|
||||
GO(libiconv_open, pFpp)
|
||||
GO(libiconv_open_into, iFppp)
|
||||
GO(libiconv_set_relocation_prefix, vFpp)
|
||||
GO(libiconvctl, iFpip)
|
||||
//GO(libiconvlist, vFpp) // this one have callbacks
|
||||
+58
-7
@@ -15,6 +15,7 @@
|
||||
#define GO(N, W)
|
||||
#define GOW(N, W)
|
||||
#define GOM(N, W)
|
||||
#define GOS(N, W)
|
||||
#define GO2(N, W, O)
|
||||
#define DATA(N, S)
|
||||
#define DATAV(N, S)
|
||||
@@ -23,15 +24,18 @@
|
||||
|
||||
// #define the 4 maps first
|
||||
#undef GO
|
||||
#undef GOW
|
||||
#define GO(N, W) {#N, W, 0},
|
||||
#define GOW(N, W) {#N, W, 1},
|
||||
static const map_onesymbol_t MAPNAME(symbolmap)[] = {
|
||||
#include PRIVATE(LIBNAME)
|
||||
};
|
||||
#undef GO
|
||||
#undef GOW
|
||||
#define GO(N, W)
|
||||
#undef GOW
|
||||
#define GOW(N, W) {#N, W, 1},
|
||||
static const map_onesymbol_t MAPNAME(wsymbolmap)[] = {
|
||||
#include PRIVATE(LIBNAME)
|
||||
};
|
||||
#undef GOW
|
||||
#define GOW(N, W)
|
||||
#undef GOM
|
||||
#define GOM(N, W) {#N, W, 0},
|
||||
@@ -40,6 +44,13 @@ static const map_onesymbol_t MAPNAME(mysymbolmap)[] = {
|
||||
};
|
||||
#undef GOM
|
||||
#define GOM(N, W)
|
||||
#undef GOS
|
||||
#define GOS(N, W) {#N, W, 0},
|
||||
static const map_onesymbol2_t MAPNAME(stsymbolmap)[] = {
|
||||
#include PRIVATE(LIBNAME)
|
||||
};
|
||||
#undef GOS
|
||||
#define GOS(N, W)
|
||||
#undef GO2
|
||||
#define GO2(N, W, O) {#N, W, 0, #O},
|
||||
static const map_onesymbol2_t MAPNAME(symbol2map)[] = {
|
||||
@@ -85,9 +96,12 @@ int FUNC(_init)(library_t* lib, box86context_t* box86)
|
||||
lib->priv.w.bridge = NewBridge();
|
||||
// Create maps
|
||||
lib->symbolmap = kh_init(symbolmap);
|
||||
lib->wsymbolmap = kh_init(symbolmap);
|
||||
lib->mysymbolmap = kh_init(symbolmap);
|
||||
lib->stsymbolmap = kh_init(symbolmap);
|
||||
lib->symbol2map = kh_init(symbol2map);
|
||||
lib->datamap = kh_init(datamap);
|
||||
lib->wdatamap = kh_init(datamap);
|
||||
lib->mydatamap = kh_init(datamap);
|
||||
|
||||
khint_t k;
|
||||
@@ -100,25 +114,41 @@ int FUNC(_init)(library_t* lib, box86context_t* box86)
|
||||
k = kh_put(symbolmap, lib->symbolmap, MAPNAME(symbolmap)[i].name, &ret);
|
||||
kh_value(lib->symbolmap, k) = MAPNAME(symbolmap)[i].w;
|
||||
}
|
||||
cnt = sizeof(MAPNAME(wsymbolmap))/sizeof(map_onesymbol_t);
|
||||
for (int i=0; i<cnt; ++i) {
|
||||
k = kh_put(symbolmap, lib->wsymbolmap, MAPNAME(wsymbolmap)[i].name, &ret);
|
||||
kh_value(lib->wsymbolmap, k) = MAPNAME(wsymbolmap)[i].w;
|
||||
}
|
||||
cnt = sizeof(MAPNAME(mysymbolmap))/sizeof(map_onesymbol_t);
|
||||
for (int i=0; i<cnt; ++i) {
|
||||
k = kh_put(symbolmap, lib->mysymbolmap, MAPNAME(mysymbolmap)[i].name, &ret);
|
||||
kh_value(lib->mysymbolmap, k) = MAPNAME(mysymbolmap)[i].w;
|
||||
}
|
||||
cnt = sizeof(MAPNAME(stsymbolmap))/sizeof(map_onesymbol_t);
|
||||
for (int i=0; i<cnt; ++i) {
|
||||
k = kh_put(symbolmap, lib->stsymbolmap, MAPNAME(stsymbolmap)[i].name, &ret);
|
||||
kh_value(lib->stsymbolmap, k) = MAPNAME(stsymbolmap)[i].w;
|
||||
}
|
||||
cnt = sizeof(MAPNAME(symbol2map))/sizeof(map_onesymbol2_t);
|
||||
for (int i=0; i<cnt; ++i) {
|
||||
k = kh_put(symbol2map, lib->symbol2map, MAPNAME(symbol2map)[i].name, &ret);
|
||||
kh_value(lib->symbol2map, k).name = MAPNAME(symbol2map)[i].name2;
|
||||
kh_value(lib->symbol2map, k).w = MAPNAME(symbol2map)[i].w;
|
||||
kh_value(lib->symbol2map, k).weak = MAPNAME(symbol2map)[i].weak;
|
||||
}
|
||||
cnt = sizeof(MAPNAME(datamap))/sizeof(map_onedata_t);
|
||||
for (int i=0; i<cnt; ++i) {
|
||||
k = kh_put(datamap, lib->datamap, MAPNAME(datamap)[i].name, &ret);
|
||||
kh_value(lib->datamap, k) = MAPNAME(datamap)[i].sz;
|
||||
if(MAPNAME(datamap)[i].weak) {
|
||||
k = kh_put(datamap, lib->wdatamap, MAPNAME(datamap)[i].name, &ret);
|
||||
kh_value(lib->wdatamap, k) = MAPNAME(datamap)[i].sz;
|
||||
} else {
|
||||
k = kh_put(datamap, lib->wdatamap, MAPNAME(datamap)[i].name, &ret);
|
||||
kh_value(lib->wdatamap, k) = MAPNAME(datamap)[i].sz;
|
||||
}
|
||||
}
|
||||
cnt = sizeof(MAPNAME(mydatamap))/sizeof(map_onedata_t);
|
||||
for (int i=0; i<cnt; ++i) {
|
||||
k = kh_put(datamap, lib->mydatamap, MAPNAME(datamap)[i].name, &ret);
|
||||
k = kh_put(datamap, lib->mydatamap, MAPNAME(mydatamap)[i].name, &ret);
|
||||
kh_value(lib->mydatamap, k) = MAPNAME(mydatamap)[i].sz;
|
||||
}
|
||||
#ifdef CUSTOM_INIT
|
||||
@@ -153,7 +183,28 @@ int FUNC(_get)(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz)
|
||||
uint32_t size = 0;
|
||||
void* symbol = NULL;
|
||||
//PRE
|
||||
if (!getSymbolInMaps(lib, name, &addr, &size)) {
|
||||
if (!getSymbolInMaps(lib, name, 0, &addr, &size)) {
|
||||
#ifdef CUSTOM_FAIL
|
||||
CUSTOM_FAIL
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
//POST
|
||||
if(!addr)
|
||||
return 0;
|
||||
*offs = addr;
|
||||
*sz = size;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int FUNC(_getnoweak)(library_t* lib, const char* name, uintptr_t *offs, uint32_t *sz)
|
||||
{
|
||||
uintptr_t addr = 0;
|
||||
uint32_t size = 0;
|
||||
void* symbol = NULL;
|
||||
//PRE
|
||||
if (!getSymbolInMaps(lib, name, 1, &addr, &size)) {
|
||||
#ifdef CUSTOM_FAIL
|
||||
CUSTOM_FAIL
|
||||
#else
|
||||
|
||||
@@ -57,10 +57,10 @@ DATAB(__snd_timer_hw_open_dlsym_timer_001, 4)
|
||||
DATAB(__snd_timer_query_hw_open_dlsym_timer_query_001, 4)
|
||||
|
||||
GO(snd_asoundlib_version, pFv)
|
||||
GO(snd_dlopen, pFpi)
|
||||
GO(snd_dlsym, pFppp)
|
||||
GO(snd_dlclose, iFp)
|
||||
GO(snd_async_add_handler, iFEpipp)
|
||||
//GO(snd_dlopen, pFpi)
|
||||
//GO(snd_dlsym, pFppp)
|
||||
//GO(snd_dlclose, iFp)
|
||||
GOM(snd_async_add_handler, iFEpipp)
|
||||
//GO(snd_async_del_handler, iFp)
|
||||
//GO(snd_async_handler_get_fd, iFp)
|
||||
//GO(snd_async_handler_get_signo, iFp)
|
||||
@@ -404,17 +404,17 @@ GO(snd_pcm_reset, iFp)
|
||||
GO(snd_pcm_resume, iFp)
|
||||
GO(snd_pcm_rewind, iFpu)
|
||||
GO(snd_pcm_samples_to_bytes, uFpi)
|
||||
//GO(snd_pcm_scope_get_callback_private, pFp)
|
||||
//GOM(snd_pcm_scope_get_callback_private, pFEp)
|
||||
GO(snd_pcm_scope_get_name, pFp)
|
||||
GO(snd_pcm_scope_malloc, iFp)
|
||||
GO(snd_pcm_scope_s16_get_channel_buffer, pFpu)
|
||||
GO(snd_pcm_scope_s16_open, iFppp)
|
||||
//GO(snd_pcm_scope_set_callback_private, vFpp)
|
||||
//GOM(snd_pcm_scope_set_callback_private, vFEpp)
|
||||
GO(snd_pcm_hw_params_sizeof, uFv)
|
||||
GO(snd_pcm_sw_params_sizeof, uFv)
|
||||
GO(snd_pcm_hw_params_is_monotonic, iFp)
|
||||
GO(snd_pcm_scope_set_name, vFpp)
|
||||
GO(snd_pcm_scope_set_ops, vFpp)
|
||||
//GOM(snd_pcm_scope_set_ops, vFEpp)
|
||||
GO(snd_pcm_set_params, iFpiiuuiu)
|
||||
GO(snd_pcm_start, iFp)
|
||||
GO(snd_pcm_start_mode_name, pFi)
|
||||
@@ -887,7 +887,7 @@ GO(snd_mixer_open, iFpi)
|
||||
GO(snd_mixer_close, iFp)
|
||||
GO(snd_mixer_first_elem, pFp)
|
||||
GO(snd_mixer_last_elem, pFp)
|
||||
//GO(snd_mixer_handle_events, iFp)
|
||||
GO(snd_mixer_handle_events, iFp)
|
||||
GO(snd_mixer_attach, iFpp)
|
||||
GO(snd_mixer_attach_hctl, iFpp)
|
||||
GO(snd_mixer_detach, iFpp)
|
||||
|
||||
+269
-13
@@ -9,11 +9,15 @@
|
||||
#include <signal.h>
|
||||
typedef void (*sighandler_t)(int);
|
||||
#include <errno.h>
|
||||
#include <err.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/select.h>
|
||||
#include <unistd.h>
|
||||
#include <glob.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
@@ -30,7 +34,12 @@ typedef void (*sighandler_t)(int);
|
||||
#include "myalign.h"
|
||||
|
||||
|
||||
#define LIBNAME libc
|
||||
const char* libcName = "libc.so.6";
|
||||
|
||||
typedef void (*vFipp_t)(int32_t, void*, void*);
|
||||
typedef int32_t (*iFpup_t)(void*, uint32_t, void*);
|
||||
typedef int32_t (*iFpuu_t)(void*, uint32_t, uint32_t);
|
||||
|
||||
typedef struct libc_my_s {
|
||||
iFpup_t _ITM_addUserCommitAction;
|
||||
@@ -65,7 +74,11 @@ uint32_t my_syscall(x86emu_t *emu); // implemented in x86syscall.c
|
||||
void EXPORT my___stack_chk_fail(x86emu_t* emu)
|
||||
{
|
||||
char buff[200];
|
||||
sprintf(buff, "%p: Stack is corrupted, abborting\n", (void*)emu->old_ip);
|
||||
#ifdef HAVE_TRACE
|
||||
sprintf(buff, "%p: Stack is corrupted, aborting (prev IP=%p->%p)\n", (void*)emu->old_ip, (void*)emu->prev2_ip, (void*)emu->prev_ip);
|
||||
#else
|
||||
sprintf(buff, "%p: Stack is corrupted, aborting\n", (void*)emu->old_ip);
|
||||
#endif
|
||||
StopEmu(emu, buff);
|
||||
}
|
||||
void EXPORT my___gmon_start__(x86emu_t *emu)
|
||||
@@ -117,6 +130,17 @@ pid_t EXPORT my_fork(x86emu_t* emu)
|
||||
#endif
|
||||
}
|
||||
pid_t EXPORT my___fork(x86emu_t* emu) __attribute__((alias("my_fork")));
|
||||
pid_t EXPORT my_vfork(x86emu_t* emu)
|
||||
{
|
||||
#if 1
|
||||
emu->quit = 1;
|
||||
emu->fork = 1; // use regular fork...
|
||||
return 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
EXPORT void* my__ZGTtnaX (size_t a) { printf("warning _ZGTtnaX called\n"); return NULL; }
|
||||
EXPORT void my__ZGTtdlPv (void* a) { printf("warning _ZGTtdlPv called\n"); }
|
||||
@@ -238,8 +262,7 @@ EXPORT int my_vsprintf(x86emu_t* emu, void* buff, void * fmt, void * b, va_list
|
||||
int r = ((iFppp_t)f)(buff, fmt, emu->scratch);
|
||||
return r;
|
||||
#else
|
||||
void* f = vsprintf;
|
||||
int r = ((iFppp_t)f)(buff, fmt, *(uint32_t**)b);
|
||||
return vsprintf(buff, fmt, V);
|
||||
#endif
|
||||
}
|
||||
EXPORT int my___vsprintf_chk(x86emu_t* emu, void* buff, void * fmt, void * b, va_list V) __attribute__((alias("my_vsprintf")));
|
||||
@@ -252,14 +275,41 @@ EXPORT int my_vsnprintf(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void
|
||||
int r = ((iFpupp_t)f)(buff, s, fmt, emu->scratch);
|
||||
return r;
|
||||
#else
|
||||
void* f = vsnprintf;
|
||||
int r = ((iFpupp_t)f)(buff, s, fmt, *(uint32_t**)b);
|
||||
return r;
|
||||
return vsnprintf(buff, s, fmt, V);
|
||||
#endif
|
||||
}
|
||||
EXPORT int my___vsnprintf(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) __attribute__((alias("my_vsnprintf")));
|
||||
EXPORT int my___vsnprintf_chk(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) __attribute__((alias("my_vsnprintf")));
|
||||
|
||||
EXPORT int my_vasprintf(x86emu_t* emu, void* strp, void* fmt, void* b, va_list V)
|
||||
{
|
||||
#ifndef NOALIGN
|
||||
// need to align on arm
|
||||
myStackAlign((const char*)fmt, *(uint32_t**)b, emu->scratch);
|
||||
void* f = vasprintf;
|
||||
int r = ((iFppp_t)f)(strp, fmt, emu->scratch);
|
||||
return r;
|
||||
#else
|
||||
void* f = vasprintf;
|
||||
int r = ((iFppp_t)f)(strp, fmt, *(uint32_t**)b);
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
EXPORT int my___vasprintf_chk(x86emu_t* emu, void* strp, int flags, void* fmt, void* b, va_list V)
|
||||
{
|
||||
#ifndef NOALIGN
|
||||
// need to align on arm
|
||||
myStackAlign((const char*)fmt, *(uint32_t**)b, emu->scratch);
|
||||
void* f = vasprintf;
|
||||
int r = ((iFppp_t)f)(strp, fmt, emu->scratch);
|
||||
return r;
|
||||
#else
|
||||
void* f = vasprintf;
|
||||
int r = ((iFppp_t)f)(strp, fmt, *(uint32_t**)b);
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT int my_vswprintf(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) {
|
||||
#ifndef NOALIGN
|
||||
// need to align on arm
|
||||
@@ -276,6 +326,31 @@ EXPORT int my_vswprintf(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void
|
||||
EXPORT int my___vswprintf(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) __attribute__((alias("my_vswprintf")));
|
||||
EXPORT int my___vswprintf_chk(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) __attribute__((alias("my_vswprintf")));
|
||||
|
||||
EXPORT void my_verr(x86emu_t* emu, int eval, void* fmt, void* b) {
|
||||
#ifndef NOALIGN
|
||||
// need to align on arm
|
||||
myStackAlignW((const char*)fmt, *(uint32_t**)b, emu->scratch);
|
||||
void* f = verr;
|
||||
((vFipp_t)f)(eval, fmt, emu->scratch);
|
||||
#else
|
||||
void* f = verr;
|
||||
((vFipp_t)f)(eval, fmt, *(uint32_t**)b);
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT int my___swprintf_chk(x86emu_t* emu, void* s, uint32_t n, int32_t flag, uint32_t slen, void* fmt, void * b)
|
||||
{
|
||||
#ifndef NOALIGN
|
||||
// need to align on arm
|
||||
myStackAlignW((const char*)fmt, b, emu->scratch);
|
||||
void* f = vswprintf;
|
||||
int r = ((iFpupp_t)f)(s, n, fmt, emu->scratch);
|
||||
#else
|
||||
void* f = vswprintf;
|
||||
((iFpupp_t)f)(s, n, fmt, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT void my__ITM_addUserCommitAction(x86emu_t* emu, void* cb, uint32_t b, void* c)
|
||||
{
|
||||
// disabled for now... Are all this _ITM_ stuff really mendatory?
|
||||
@@ -329,24 +404,174 @@ static int qsort_cmp(const void* a, const void* b, void* e)
|
||||
EXPORT void my_qsort(x86emu_t* emu, void* base, size_t nmemb, size_t size, void* fnc)
|
||||
{
|
||||
// use a temporary callback
|
||||
x86emu_t *cbemu = AddCallback(emu, (uintptr_t)fnc, 3, NULL, NULL, NULL, NULL);
|
||||
x86emu_t *cbemu = AddSharedCallback(emu, (uintptr_t)fnc, 2, NULL, NULL, NULL, NULL);
|
||||
qsort_r(base, nmemb, size, qsort_cmp, cbemu);
|
||||
FreeCallback(cbemu);
|
||||
}
|
||||
EXPORT void my_qsort_r(x86emu_t* emu, void* base, size_t nmemb, size_t size, void* fnc, void* arg)
|
||||
{
|
||||
// use a temporary callback
|
||||
x86emu_t *cbemu = AddCallback(emu, (uintptr_t)fnc, 3, NULL, NULL, arg, NULL);
|
||||
x86emu_t *cbemu = AddSharedCallback(emu, (uintptr_t)fnc, 3, NULL, NULL, arg, NULL);
|
||||
qsort_r(base, nmemb, size, qsort_cmp, cbemu);
|
||||
FreeCallback(cbemu);
|
||||
}
|
||||
|
||||
static x86emu_t *bsearch_emu = NULL;
|
||||
static int bsearch_cmp(const void* a, const void* b)
|
||||
{
|
||||
SetCallbackArg(bsearch_emu, 0, (void*)a);
|
||||
SetCallbackArg(bsearch_emu, 1, (void*)b);
|
||||
return (int)RunCallback(bsearch_emu);
|
||||
}
|
||||
|
||||
EXPORT void* my_bsearch(x86emu_t* emu, void* key, void* base, size_t nmemb, size_t size, void* fnc)
|
||||
{
|
||||
// use a temporary callback, but global because there is no bsearch_r...
|
||||
bsearch_emu = AddSharedCallback(emu, (uintptr_t)fnc, 2, NULL, NULL, NULL, NULL);
|
||||
void* ret = bsearch(key, base, nmemb, size, bsearch_cmp);
|
||||
FreeCallback(bsearch_emu);
|
||||
bsearch_emu = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT int32_t my_readlink(x86emu_t* emu, void* path, void* buf, uint32_t sz)
|
||||
{
|
||||
if(strcmp((const char*)path, "/proc/self/exe")==0) {
|
||||
// special case for self...
|
||||
return strlen(strncpy((char*)buf, emu->context->fullpath, sz));
|
||||
}
|
||||
if(strncmp((const char*)path, "/proc/", 6)==0) {
|
||||
// check if self checking....
|
||||
pid_t pid = getpid();
|
||||
char tmp[64];
|
||||
sprintf(tmp, "/proc/%d/exe", pid);
|
||||
if(strcmp((const char*)path, tmp)==0) {
|
||||
return strlen(strncpy((char*)buf, emu->context->fullpath, sz));
|
||||
}
|
||||
}
|
||||
return readlink((const char*)path, (char*)buf, sz);
|
||||
}
|
||||
|
||||
EXPORT void* my_ldiv(x86emu_t* emu, void* p, int32_t num, int32_t den)
|
||||
{
|
||||
*((ldiv_t*)p) = ldiv(num, den);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
x86emu_t *globemu = NULL; // issue with multi threads...
|
||||
static int glob_errfnccallback(const char* epath, int no)
|
||||
{
|
||||
if(globemu) {
|
||||
SetCallbackArg(globemu, 0, (void*)epath);
|
||||
SetCallbackArg(globemu, 1, (void*)no);
|
||||
return (int32_t)RunCallback(globemu);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT int32_t my_glob(x86emu_t *emu, void* pat, int32_t flags, void* errfnc, void* pblog)
|
||||
{
|
||||
if(errfnc)
|
||||
globemu = AddSharedCallback(emu, (uintptr_t)errfnc, 2, NULL, NULL, NULL, NULL);
|
||||
int32_t r = glob((const char*)pat, flags, globemu?glob_errfnccallback:NULL, (glob_t*)pblog);
|
||||
if(globemu) {
|
||||
FreeCallback(globemu);
|
||||
globemu = NULL;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
x86emu_t *scandir64selemu = NULL;
|
||||
x86emu_t *scandir64compemu = NULL;
|
||||
static int scandir64_selcb(const struct dirent64* dir)
|
||||
{
|
||||
if(scandir64selemu) {
|
||||
SetCallbackArg(scandir64selemu, 0, (void*)dir);
|
||||
return (int32_t)RunCallback(scandir64selemu);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#ifdef PANDORA
|
||||
static int scandir64_compcb(const void* a, const void* b)
|
||||
#else
|
||||
static int scandir64_compcb(const struct dirent64** a, const struct dirent64** b)
|
||||
#endif
|
||||
{
|
||||
if(scandir64compemu) {
|
||||
SetCallbackArg(scandir64compemu, 0, (void*)a);
|
||||
SetCallbackArg(scandir64compemu, 1, (void*)b);
|
||||
return (int32_t)RunCallback(scandir64compemu);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT int my_scandir64(x86emu_t *emu, void* dir, void* namelist, void* sel, void* comp)
|
||||
{
|
||||
scandir64selemu = AddSharedCallback(emu, (uintptr_t)sel, 1, NULL, NULL, NULL, NULL);
|
||||
scandir64compemu = AddSharedCallback(emu, (uintptr_t)comp, 2, NULL, NULL, NULL, NULL);
|
||||
int ret = scandir64(dir, namelist, scandir64_selcb, scandir64_compcb);
|
||||
FreeCallback(scandir64selemu);
|
||||
FreeCallback(scandir64compemu);
|
||||
scandir64selemu = NULL;
|
||||
scandir64compemu = NULL;
|
||||
return ret;
|
||||
}
|
||||
x86emu_t *scandirselemu = NULL;
|
||||
x86emu_t *scandircompemu = NULL;
|
||||
static int scandir_selcb(const struct dirent* dir)
|
||||
{
|
||||
if(scandirselemu) {
|
||||
SetCallbackArg(scandirselemu, 0, (void*)dir);
|
||||
return (int32_t)RunCallback(scandirselemu);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#ifdef PANDORA
|
||||
static int scandir_compcb(const void* a, const void* b)
|
||||
#else
|
||||
static int scandir_compcb(const struct dirent** a, const struct dirent** b)
|
||||
#endif
|
||||
{
|
||||
if(scandircompemu) {
|
||||
SetCallbackArg(scandircompemu, 0, (void*)a);
|
||||
SetCallbackArg(scandircompemu, 1, (void*)b);
|
||||
return (int32_t)RunCallback(scandircompemu);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT int my_scandir(x86emu_t *emu, void* dir, void* namelist, void* sel, void* comp)
|
||||
{
|
||||
scandirselemu = AddSharedCallback(emu, (uintptr_t)sel, 1, NULL, NULL, NULL, NULL);
|
||||
scandircompemu = AddSharedCallback(emu, (uintptr_t)comp, 2, NULL, NULL, NULL, NULL);
|
||||
int ret = scandir(dir, namelist, scandir_selcb, scandir_compcb);
|
||||
FreeCallback(scandirselemu);
|
||||
FreeCallback(scandircompemu);
|
||||
scandirselemu = NULL;
|
||||
scandircompemu = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT int32_t my_execvp(x86emu_t* emu, void* a, void* b, va_list v)
|
||||
{
|
||||
return execvp(a, b);
|
||||
}
|
||||
EXPORT int32_t my_execlp(x86emu_t* emu, void* a, void* b, va_list v) __attribute__((alias("my_execvp")));
|
||||
|
||||
EXPORT int32_t my_execl(x86emu_t* emu, void* a, void* b, void* c, va_list v)
|
||||
{
|
||||
int n=1;
|
||||
if(b) {
|
||||
++n;
|
||||
void** cnt = (void**)c;
|
||||
while(cnt[n]) ++n;
|
||||
}
|
||||
void** params = (void**)calloc(n, sizeof(void*));
|
||||
params[0] = b;
|
||||
memcpy(params+4, c, n*sizeof(void*));
|
||||
int32_t r = execv(a, (char* const*)params);
|
||||
free(params);
|
||||
return r;
|
||||
}
|
||||
|
||||
EXPORT void my__Jv_RegisterClasses() {}
|
||||
|
||||
EXPORT int32_t my___cxa_thread_atexit_impl(x86emu_t* emu, void* dtor, void* obj, void* dso)
|
||||
@@ -355,9 +580,6 @@ EXPORT int32_t my___cxa_thread_atexit_impl(x86emu_t* emu, void* dtor, void* obj,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define LIBNAME libc
|
||||
const char* libcName = "libc.so.6";
|
||||
|
||||
extern void __chk_fail();
|
||||
EXPORT unsigned long int my___fdelt_chk (unsigned long int d)
|
||||
{
|
||||
@@ -367,8 +589,24 @@ EXPORT unsigned long int my___fdelt_chk (unsigned long int d)
|
||||
return d / __NFDBITS;
|
||||
}
|
||||
|
||||
EXPORT int32_t my_getrandom(x86emu_t* emu, void* buf, uint32_t buflen, uint32_t flags)
|
||||
{
|
||||
// not always implemented on old linux version...
|
||||
library_t* lib = GetLib(emu->context->maplib, libcName);
|
||||
if(!lib) return 0;
|
||||
void* f = dlsym(lib->priv.w.lib, "getrandom");
|
||||
if(f)
|
||||
return ((iFpuu_t)f)(buf, buflen, flags);
|
||||
// do what should not be done, but it's better then nothing....
|
||||
FILE * rnd = fopen("/dev/random", "rb");
|
||||
uint32_t r = fread(buf, 1, buflen, rnd);
|
||||
fclose(rnd);
|
||||
return r;
|
||||
}
|
||||
|
||||
#define CUSTOM_INIT \
|
||||
InitCpuModel(); \
|
||||
ctSetup(); \
|
||||
box86->libclib = lib; \
|
||||
lib->priv.w.p2 = getLIBCMy(lib); \
|
||||
lib->priv.w.needed = 3; \
|
||||
@@ -404,6 +642,16 @@ void InitCpuModel()
|
||||
| (1<<FEATURE_ADX);
|
||||
}
|
||||
|
||||
EXPORT const unsigned short int *my___ctype_b;
|
||||
EXPORT const int32_t *my___ctype_tolower;
|
||||
EXPORT const int32_t *my___ctype_toupper;
|
||||
|
||||
void ctSetup()
|
||||
{
|
||||
my___ctype_b = *(__ctype_b_loc());
|
||||
my___ctype_toupper = *(__ctype_toupper_loc());
|
||||
my___ctype_tolower = *(__ctype_tolower_loc());
|
||||
}
|
||||
|
||||
// need to undef all read / read64 stuffs!
|
||||
#undef pread
|
||||
@@ -413,9 +661,13 @@ void InitCpuModel()
|
||||
#undef ftello
|
||||
#undef fseekpos
|
||||
#undef fsetpos
|
||||
#undef fgetpos
|
||||
#undef fopen
|
||||
#undef statfs
|
||||
#undef fstatfs
|
||||
#undef freopen
|
||||
#undef truncate
|
||||
#undef ftruncate
|
||||
#undef tmpfile
|
||||
#undef lockf
|
||||
#undef fscanf
|
||||
@@ -430,6 +682,10 @@ void InitCpuModel()
|
||||
#undef mkstemps
|
||||
#undef mkostemp
|
||||
#undef mkostemps
|
||||
#undef pread
|
||||
#undef pwrite
|
||||
#undef creat
|
||||
#undef scandir
|
||||
|
||||
// define all standard library functions
|
||||
#include "wrappedlib_init.h"
|
||||
@@ -452,8 +708,8 @@ int32_t my_setjmp(x86emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p)
|
||||
jpbuff->save_esi = R_ESI;
|
||||
jpbuff->save_edi = R_EDI;
|
||||
jpbuff->save_ebp = R_EBP;
|
||||
jpbuff->save_esp = R_ESP;
|
||||
jpbuff->save_eip = *(uint32_t*)(R_ESP);
|
||||
jpbuff->save_esp = R_ESP+4; // include "return address"
|
||||
jpbuff->save_eip = *(uint32_t*)(R_ESP);
|
||||
// and that's it.. Nothing more for now
|
||||
return 0;
|
||||
}
|
||||
|
||||
+167
-160
@@ -1,11 +1,14 @@
|
||||
#if defined(GO) && defined(GOM) && defined(GO2) && defined(DATA)
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA) && defined(GOS))
|
||||
#error Meh...
|
||||
#endif
|
||||
|
||||
// a64l
|
||||
GO(abort, vFv) // Should be GOM once signal are handled properly
|
||||
// abs
|
||||
GO(abs, iFi)
|
||||
GOW(accept, iFipp)
|
||||
GOW(access, iFpi)
|
||||
// acct
|
||||
// addmntent // Weak
|
||||
GOW(addmntent, iFpp)
|
||||
// addseverity
|
||||
// adjtime // Weak
|
||||
// adjtimex // Weak
|
||||
@@ -32,7 +35,7 @@ DATAV(__after_morecore_hook, 4)
|
||||
GO(alarm, iFu)
|
||||
GO2(aligned_alloc, pFuu, memalign)
|
||||
// alphasort
|
||||
// alphasort64
|
||||
GO(alphasort64, iFpp)
|
||||
DATA(argp_err_exit_status, 4)
|
||||
// argp_error // Weak
|
||||
// argp_failure // Weak
|
||||
@@ -82,9 +85,9 @@ GO(__backtrace, iFpi)
|
||||
GO(__backtrace_symbols, pFpi)
|
||||
GOW(backtrace_symbols, pFpi)
|
||||
GO(__backtrace_symbols_fd, vFpii)
|
||||
// backtrace_symbols_fd // Weak
|
||||
GOW(backtrace_symbols_fd, vFpii)
|
||||
GO(basename, pFp)
|
||||
// bcmp // Weak
|
||||
GOW(bcmp, iFppu)
|
||||
// bcopy
|
||||
// bdflush
|
||||
GOW(bind, iFipu)
|
||||
@@ -94,7 +97,7 @@ GOW(bind_textdomain_codeset, pFpp)
|
||||
// brk // Weak
|
||||
// __bsd_getpgrp
|
||||
// bsd_signal // Weak
|
||||
// bsearch
|
||||
GOM(bsearch, pFEppuup)
|
||||
GOW(btowc, iFi)
|
||||
// bzero // Weak
|
||||
// __bzero
|
||||
@@ -119,9 +122,9 @@ DATA(__check_rhosts_file, 4)
|
||||
// chflags
|
||||
// __chk_fail
|
||||
GOW(chmod, iFpu)
|
||||
// chown // Weak
|
||||
GOW(chown, iFpuu)
|
||||
// chroot
|
||||
// clearenv // Weak
|
||||
GOW(clearenv, iFv)
|
||||
GO(clearerr, vFp)
|
||||
// clearerr_unlocked
|
||||
// clnt_broadcast
|
||||
@@ -143,7 +146,7 @@ GO(clock, uFv)
|
||||
GOW(close, iFi)
|
||||
// __close // Weak
|
||||
GOW(closedir, iFp)
|
||||
// closelog
|
||||
GO(closelog, vFv)
|
||||
// __cmsg_nxthdr
|
||||
// confstr
|
||||
// __confstr_chk
|
||||
@@ -152,15 +155,18 @@ GOW(__connect, iFipu)
|
||||
// copysign // Weak
|
||||
// copysignf // Weak
|
||||
// copysignl // Weak
|
||||
// creat // Weak
|
||||
GOW(creat, iFpu)
|
||||
// creat64
|
||||
// create_module // Weak
|
||||
// ctermid
|
||||
GO(ctime, pFp)
|
||||
GO(ctime_r, pFpp)
|
||||
DATAM(__ctype_b, 4)
|
||||
GO(__ctype_b_loc, pFv)
|
||||
GOW(__ctype_get_mb_cur_max, uFv)
|
||||
DATAM(__ctype_tolower, 4)
|
||||
GO(__ctype_tolower_loc, pFv)
|
||||
DATAM(__ctype_toupper, 4)
|
||||
GO(__ctype_toupper_loc, pFv)
|
||||
// __curbrk // type B
|
||||
GO(cuserid, pFp)
|
||||
@@ -187,7 +193,7 @@ GO(__dcgettext, pFppi)
|
||||
GOW(dgettext, pFpp)
|
||||
GO(__dgettext, pFpp)
|
||||
GO(difftime, dFuu)
|
||||
// dirfd
|
||||
GO(dirfd, iFp)
|
||||
GO(dirname, pFp)
|
||||
// div
|
||||
// _dl_addr
|
||||
@@ -218,12 +224,12 @@ GO(__duplocale, pFp)
|
||||
// endfsent
|
||||
// endgrent
|
||||
GO(endhostent, vFv)
|
||||
// endmntent // Weak
|
||||
GOW(endmntent, iFp)
|
||||
// __endmntent
|
||||
// endnetent
|
||||
// endnetgrent
|
||||
// endprotoent
|
||||
// endpwent
|
||||
GO(endpwent, vFv)
|
||||
// endrpcent
|
||||
// endservent
|
||||
// endspent
|
||||
@@ -240,9 +246,9 @@ DATAV(_environ, 4)
|
||||
// envz_merge
|
||||
// envz_remove
|
||||
// envz_strip
|
||||
// epoll_create
|
||||
// epoll_create1
|
||||
// epoll_ctl
|
||||
GO(epoll_create, iFi)
|
||||
GO(epoll_create1, iFi)
|
||||
GO(epoll_ctl, iFiiip)
|
||||
// epoll_pwait
|
||||
// epoll_wait
|
||||
// erand48
|
||||
@@ -264,10 +270,10 @@ GO(__errno_location, pFv)
|
||||
// ether_ntoa_r
|
||||
// ether_ntohost
|
||||
// euidaccess // Weak
|
||||
// eventfd
|
||||
GO(eventfd, iFui)
|
||||
// eventfd_read
|
||||
// eventfd_write
|
||||
// execl
|
||||
GO(eventfd_write, iFiU)
|
||||
GOM(execl, iFEpVV)
|
||||
// execle
|
||||
GOM(execlp, iFEpVV)
|
||||
GO(execv, iFpp) // maybe need to GOM this one, and check if path is an x86 file...
|
||||
@@ -279,17 +285,17 @@ GOM(_exit, vFEi)
|
||||
// faccessat
|
||||
// fattach
|
||||
// __fbufsize
|
||||
// fchdir // Weak
|
||||
GOW(fchdir, iFi)
|
||||
// fchflags
|
||||
GOW(fchmod, iFiu)
|
||||
// fchmodat
|
||||
// fchown // Weak
|
||||
GOW(fchown, iFiuu)
|
||||
// fchownat
|
||||
GO(fclose, iFp)
|
||||
// fcloseall // Weak
|
||||
GOW(fcntl, iFiiu)
|
||||
GOW(__fcntl, iFiiu)
|
||||
// fcvt
|
||||
GO(fcvt, pFdipp)
|
||||
// fcvt_r
|
||||
GO(fdatasync, iFi)
|
||||
// fdetach
|
||||
@@ -311,7 +317,7 @@ GOW(fgetc, iFp)
|
||||
// fgetgrent
|
||||
// fgetgrent_r // Weak
|
||||
GO(fgetpos, iFpp)
|
||||
// fgetpos64
|
||||
GO(fgetpos64, iFpp)
|
||||
// fgetpwent
|
||||
// fgetpwent_r // Weak
|
||||
GOW(fgets, pFpip)
|
||||
@@ -329,23 +335,23 @@ GO(fgetws, pFpip)
|
||||
// fgetxattr
|
||||
GO(fileno, iFp)
|
||||
// fileno_unlocked // Weak
|
||||
// finite // Weak
|
||||
GOW(finite, iFd)
|
||||
// __finite
|
||||
// finitef // Weak
|
||||
GOW(finitef, iFf)
|
||||
// __finitef
|
||||
// finitel // Weak
|
||||
// __finitel
|
||||
// __flbf
|
||||
// flistxattr
|
||||
// flock // Weak
|
||||
GOW(flock, pFi)
|
||||
GOW(flockfile, vFp)
|
||||
// _flushlbf // Weak
|
||||
// fmemopen
|
||||
// fmtmsg
|
||||
// fnmatch
|
||||
GO(fnmatch, iFppi)
|
||||
GO(fopen, pFpp)
|
||||
GOW(fopen64, pFpp)
|
||||
// fopencookie
|
||||
//GOM(fopencookie, pFppp) // last p are 4 callbacks...
|
||||
GOM(fork, iFEv) // Weak
|
||||
GOM(__fork, iFEv)
|
||||
// __fortify_fail
|
||||
@@ -389,19 +395,19 @@ GO(fseeko, iFpii)
|
||||
GO(fseeko64, iFpIi)
|
||||
// __fsetlocking
|
||||
GO(fsetpos, iFpp)
|
||||
// fsetpos64
|
||||
GO(fsetpos64, iFpp)
|
||||
// fsetxattr
|
||||
// fstatfs // Weak
|
||||
// fstatfs64 // Weak
|
||||
GOW(fstatfs64, iFip)
|
||||
// fstatvfs
|
||||
// fstatvfs64 // Weak
|
||||
GOW(fstatvfs64, iFip) // allignment?
|
||||
GOW(fsync, iFi)
|
||||
GOW(ftell, iFp)
|
||||
// ftello
|
||||
GO(ftello, uFp)
|
||||
GO(ftello64, Ifp)
|
||||
// ftime
|
||||
GO(ftime, iFp)
|
||||
// ftok
|
||||
// ftruncate // Weak
|
||||
GOW(ftruncate, iFiu)
|
||||
GOW(ftruncate64, iFiU)
|
||||
GOW(ftrylockfile, iFp)
|
||||
// fts_children
|
||||
@@ -413,7 +419,7 @@ GOW(ftrylockfile, iFp)
|
||||
// ftw64
|
||||
GOW(funlockfile, vFp)
|
||||
// futimens
|
||||
// futimes // Weak
|
||||
GOW(futimes, iFipp) //int futimes(int fd, const struct timeval tv[2]) TODO: check how it ends up
|
||||
// futimesat
|
||||
// fwide
|
||||
// fwprintf // Weak
|
||||
@@ -442,7 +448,7 @@ GO(getaddrinfo, iFpppp)
|
||||
GOW(getc, iFp)
|
||||
GOW(getchar, iFv)
|
||||
// getchar_unlocked
|
||||
// getcontext
|
||||
GO(getcontext, iFp) // should probably do a my_ version, because context is platform dependant!
|
||||
// getc_unlocked // Weak
|
||||
GO(get_current_dir_name, pFv)
|
||||
GOW(getcwd, pFpu)
|
||||
@@ -450,8 +456,8 @@ GOW(getcwd, pFpu)
|
||||
GO(getdate, pFp)
|
||||
// getdate_err // type B
|
||||
// getdate_r // Weak
|
||||
// getdelim // Weak
|
||||
// __getdelim // Weak
|
||||
GOW(getdelim, iFppip)
|
||||
GOW(__getdelim, iFppip)
|
||||
// getdirentries
|
||||
// getdirentries64
|
||||
// getdomainname
|
||||
@@ -466,10 +472,10 @@ GOW(geteuid, pFv)
|
||||
GOW(getgid, iFv)
|
||||
// getgrent
|
||||
// getgrent_r
|
||||
// getgrgid
|
||||
// getgrgid_r
|
||||
// getgrnam
|
||||
// getgrnam_r
|
||||
GO(getgrgid, pFu)
|
||||
GO(getgrgid_r, iFuppup)
|
||||
GO(getgrnam, pFp)
|
||||
GO(getgrnam_r, iFpppup)
|
||||
// getgrouplist
|
||||
// getgroups // Weak
|
||||
// __getgroups_chk
|
||||
@@ -488,14 +494,14 @@ GO(getifaddrs, iFp)
|
||||
// getipv4sourcefilter
|
||||
// getitimer // Weak
|
||||
// get_kernel_syms // Weak
|
||||
// getline // Weak
|
||||
GOW(getline, iFppp)
|
||||
// getloadavg
|
||||
GO(getlogin, pFv)
|
||||
GO(getlogin_r, iFpu)
|
||||
// __getlogin_r_chk
|
||||
// getmntent
|
||||
GO(getmntent, pFp)
|
||||
// __getmntent_r
|
||||
// getmntent_r // Weak
|
||||
GOW(getmntent_r, pFpppi)
|
||||
// getmsg
|
||||
// get_myaddress
|
||||
GO(getnameinfo, iFpupupui)
|
||||
@@ -515,17 +521,18 @@ GO(getopt_long, iFipppp)
|
||||
GO(getopt_long_only, iFipppp)
|
||||
GOW(getpagesize, iFv)
|
||||
GO(__getpagesize, iFv)
|
||||
// getpass
|
||||
// getpeername // Weak
|
||||
// getpgid // Weak
|
||||
GO(getpass, pFp)
|
||||
GOW(getpeername, iFipp)
|
||||
GOW(getpgid, uFu)
|
||||
// __getpgid
|
||||
// getpgrp
|
||||
// get_phys_pages // Weak
|
||||
GO(getpid, uFv)
|
||||
GO(__getpid, uFv)
|
||||
// getpmsg
|
||||
// getppid // Weak
|
||||
GOW(getppid, uFv)
|
||||
GO(getpriority, iFii)
|
||||
GOM(getrandom, iFEpuu)
|
||||
// getprotobyname
|
||||
// getprotobyname_r
|
||||
// getprotobynumber
|
||||
@@ -535,7 +542,7 @@ GO(getpriority, iFii)
|
||||
// getpt // Weak
|
||||
// getpublickey
|
||||
// getpw // Weak
|
||||
// getpwent
|
||||
GO(getpwent, pFv)
|
||||
// getpwent_r
|
||||
GO(getpwnam, pFp)
|
||||
GO(getpwnam_r, iFpppup)
|
||||
@@ -552,17 +559,17 @@ GO(getrlimit, iFip)
|
||||
// getrpcent
|
||||
// getrpcent_r
|
||||
// getrpcport
|
||||
// getrusage // Weak
|
||||
GOW(getrusage, iFip)
|
||||
GOW(gets, pFp)
|
||||
// __gets_chk
|
||||
// getsecretkey
|
||||
// getservbyname
|
||||
// getservbyname_r
|
||||
GO(getservbyname, pFpp)
|
||||
GO(getservbyname_r, iFppppup)
|
||||
// getservbyport
|
||||
// getservbyport_r
|
||||
GO(getservbyport_r, iFipppup)
|
||||
// getservent
|
||||
// getservent_r
|
||||
// getsid
|
||||
GO(getservent_r, iFppup)
|
||||
GO(getsid, uFu)
|
||||
GOW(getsockname, iFipp)
|
||||
GOW(getsockopt, iFiiipp)
|
||||
// getsourcefilter
|
||||
@@ -597,9 +604,9 @@ GO2(getwc, iFp, fgetwc)
|
||||
GO(getwd, pFp)
|
||||
// __getwd_chk
|
||||
// getxattr
|
||||
// glob
|
||||
GOM(glob, iFEpipp)
|
||||
// glob64
|
||||
// globfree
|
||||
GO(globfree, vFp)
|
||||
// globfree64
|
||||
// glob_pattern_p // Weak
|
||||
GO(gmtime, pFp)
|
||||
@@ -616,7 +623,7 @@ GOW(gmtime_r, pFpp)
|
||||
// group_member // Weak
|
||||
// gsignal // Weak
|
||||
// gtty
|
||||
// hasmntopt // Weak
|
||||
GOW(hasmntopt, pFpp)
|
||||
// hcreate
|
||||
// hcreate_r
|
||||
// hdestroy // Weak
|
||||
@@ -630,11 +637,12 @@ GO(herror, vFp)
|
||||
// hsearch
|
||||
// hsearch_r
|
||||
GO(hstrerror, pFi)
|
||||
// htonl
|
||||
// htons
|
||||
// iconv
|
||||
// iconv_close
|
||||
// iconv_open
|
||||
GO(htonl, uFu)
|
||||
GO(htons, uFu)
|
||||
GO(iconv, uFupppp)
|
||||
GO(iconv_close, iFu)
|
||||
GO(iconv_open, uFpp)
|
||||
GO(iconv_canonicalize, pFp)
|
||||
// if_freenameindex
|
||||
// if_indextoname
|
||||
// if_nameindex
|
||||
@@ -673,8 +681,8 @@ GO(inet_network, iFp)
|
||||
// inet_nsap_addr
|
||||
// inet_nsap_ntoa
|
||||
GO(inet_ntoa, pFi)
|
||||
// inet_ntop
|
||||
// inet_pton
|
||||
GO(inet_ntop, pFippu)
|
||||
GO(inet_pton, iFipp)
|
||||
// initgroups
|
||||
// init_module
|
||||
// initstate // Weak
|
||||
@@ -684,7 +692,7 @@ GO(inet_ntoa, pFi)
|
||||
GO(inotify_add_watch, iFipu)
|
||||
GO(inotify_init, iFv)
|
||||
GO(inotify_init1, iFi)
|
||||
// inotify_rm_watch
|
||||
GO(inotify_rm_watch, iFii)
|
||||
// insque
|
||||
// __internal_endnetgrent
|
||||
// __internal_getnetgrent_r
|
||||
@@ -877,7 +885,7 @@ GO2(__isoc99_sscanf, iFppV, __isoc99_vsscanf)
|
||||
// __isoc99_vswscanf
|
||||
// __isoc99_vwscanf
|
||||
// __isoc99_wscanf
|
||||
// isprint
|
||||
GO(isprint, iFi)
|
||||
// __isprint_l
|
||||
// isprint_l // Weak
|
||||
GO(ispunct, iFi)
|
||||
@@ -901,7 +909,7 @@ GO(isupper, iFi)
|
||||
// iswcntrl // Weak
|
||||
// __iswcntrl_l
|
||||
// iswcntrl_l // Weak
|
||||
// iswctype // Weak
|
||||
GOW(iswctype, iFiu)
|
||||
// __iswctype
|
||||
GO(__iswctype_l, iFiup)
|
||||
// iswctype_l // Weak
|
||||
@@ -934,7 +942,7 @@ GO(isxdigit, iFi)
|
||||
// isxdigit_l // Weak
|
||||
// _itoa_lower_digits // type R
|
||||
// __ivaliduser
|
||||
// jrand48
|
||||
GO(jrand48, iFp)
|
||||
// jrand48_r // Weak
|
||||
// key_decryptsession
|
||||
// key_decryptsession_pk
|
||||
@@ -952,16 +960,16 @@ GOW(kill, iFii)
|
||||
// killpg
|
||||
// klogctl
|
||||
// l64a
|
||||
// labs
|
||||
GO(labs, iFi)
|
||||
// lchmod
|
||||
// lchown // Weak
|
||||
GOW(lchown, iFpuu)
|
||||
// lckpwdf // Weak
|
||||
// lcong48
|
||||
// lcong48_r // Weak
|
||||
// ldexp // Weak
|
||||
// ldexpf // Weak
|
||||
// ldexpl // Weak
|
||||
// ldiv
|
||||
GOS(ldiv, pFEpii) // return a struct, so address of stuct is on the stack, as a shadow 1st element
|
||||
// lfind
|
||||
// lgetxattr
|
||||
// __libc_allocate_rtsig
|
||||
@@ -1010,7 +1018,7 @@ GOW(listen, iFii)
|
||||
GOW(localeconv, pFv)
|
||||
GO(localtime, pFp)
|
||||
GOW(localtime_r, pFpp)
|
||||
// lockf
|
||||
GO(lockf, iFiiu)
|
||||
// lockf64
|
||||
// locs // type B
|
||||
GOM(longjmp, vFEpi)
|
||||
@@ -1029,7 +1037,7 @@ GO(__lxstat, iFipp)
|
||||
GOM(__lxstat64, iFEipp)
|
||||
// madvise
|
||||
// makecontext
|
||||
// mallinfo // Weak
|
||||
GOW(mallinfo, pFv)
|
||||
GO(malloc, pFu)
|
||||
// malloc_get_state // Weak
|
||||
DATAV(__malloc_hook, 4)
|
||||
@@ -1037,7 +1045,7 @@ DATAV(__malloc_initialize_hook, 4)
|
||||
// malloc_set_state // Weak
|
||||
// malloc_stats // Weak
|
||||
// malloc_trim // Weak
|
||||
// malloc_usable_size // Weak
|
||||
GOW(malloc_usable_size, uFp)
|
||||
// mallopt // Weak
|
||||
// mallwatch // type B
|
||||
// mblen
|
||||
@@ -1050,7 +1058,7 @@ GOW(mbsnrtowcs, uFppuup)
|
||||
// __mbsnrtowcs_chk
|
||||
GOW(mbsrtowcs, uFppup)
|
||||
// __mbsrtowcs_chk
|
||||
// mbstowcs
|
||||
GO(mbstowcs, uFppu)
|
||||
// __mbstowcs_chk
|
||||
// mbtowc
|
||||
// mcheck
|
||||
@@ -1081,7 +1089,7 @@ GO(__memset_chk, pFpiuu)
|
||||
GOW(mkdir, iFpu)
|
||||
// mkdirat
|
||||
GO(mkdtemp, pFp)
|
||||
// mkfifo
|
||||
GO(mkfifo, iFpu)
|
||||
// mkfifoat
|
||||
GO(mkostemp, iFpi)
|
||||
GO(mkostemp64, iFpi)
|
||||
@@ -1100,7 +1108,7 @@ GOW(mmap64, pFpuiiiI)
|
||||
// monstartup // Weak
|
||||
// __monstartup
|
||||
DATA(__morecore, 4)
|
||||
// mount // Weak
|
||||
GOW(mount, iFpppup)
|
||||
// mprobe
|
||||
// mprotect // Weak
|
||||
// mrand48
|
||||
@@ -1126,10 +1134,10 @@ GO(__newlocale, pFipp)
|
||||
// nftw
|
||||
// nftw64
|
||||
// ngettext // Weak
|
||||
// nice
|
||||
GO(nice, iFi)
|
||||
// _nl_default_dirname // type R
|
||||
// _nl_domain_bindings // type B
|
||||
// nl_langinfo
|
||||
GO(nl_langinfo, pFu)
|
||||
GO(__nl_langinfo_l, pFup)
|
||||
// nl_langinfo_l // Weak
|
||||
// _nl_msg_cat_cntr // type B
|
||||
@@ -1152,8 +1160,8 @@ GO(__nl_langinfo_l, pFup)
|
||||
// __nss_passwd_lookup
|
||||
// __nss_passwd_lookup2
|
||||
// __nss_services_lookup2
|
||||
// ntohl // Weak
|
||||
// ntohs // Weak
|
||||
GOW(ntohl, uFu)
|
||||
GOW(ntohs, uFu)
|
||||
// ntp_adjtime // Weak
|
||||
// ntp_gettime
|
||||
// _null_auth // type B
|
||||
@@ -1183,7 +1191,7 @@ GOW(open64, iFpiu)
|
||||
// __openat64_2
|
||||
// __open_catalog
|
||||
GOW(opendir, pFp)
|
||||
// openlog
|
||||
GO(openlog, vFpii)
|
||||
// open_memstream
|
||||
// open_wmemstream
|
||||
DATAB(optarg, 4)
|
||||
@@ -1213,7 +1221,7 @@ GOW(pipe, iFp) // the array of 2 int seems to converted as a pointer, on both x
|
||||
GOW(poll, iFpii)
|
||||
GO(__poll, iFpii)
|
||||
GO(popen, pFpp)
|
||||
// posix_fadvise
|
||||
GO(posix_fadvise, iFiuui)
|
||||
// posix_fadvise64
|
||||
// posix_fallocate
|
||||
// posix_fallocate64
|
||||
@@ -1244,7 +1252,7 @@ GOW(posix_memalign, iFpuu)
|
||||
// ppoll
|
||||
// prctl // Weak
|
||||
GOW(pread, iFipui)
|
||||
// pread64 // Weak
|
||||
GOW(pread64, iFipuI)
|
||||
// __pread64 // Weak
|
||||
// __pread64_chk
|
||||
// __pread_chk
|
||||
@@ -1265,7 +1273,7 @@ GOW(pselect, iFippppp)
|
||||
// ptsname
|
||||
// ptsname_r // Weak
|
||||
// __ptsname_r_chk
|
||||
GOW(putc, iFp)
|
||||
GOW(putc, iFip)
|
||||
GO(putchar, iFi)
|
||||
// putchar_unlocked
|
||||
// putc_unlocked
|
||||
@@ -1285,7 +1293,7 @@ GO(putwc, iFip)
|
||||
// putwc_unlocked
|
||||
// pvalloc // Weak
|
||||
// pwrite // Weak
|
||||
// pwrite64 // Weak
|
||||
GOW(pwrite64, iFiuI)
|
||||
// __pwrite64 // Weak
|
||||
// qecvt
|
||||
// qecvt_r
|
||||
@@ -1296,7 +1304,7 @@ GOM(qsort, vFEpuup)
|
||||
GOM(qsort_r, vFEpuupp)
|
||||
// query_module // Weak
|
||||
// quotactl
|
||||
// raise
|
||||
GO(raise, iFi) // will need a GOM version once signal are implemented probably
|
||||
GO(rand, iFv)
|
||||
GOW(random, iFv)
|
||||
// random_r // Weak
|
||||
@@ -1314,7 +1322,7 @@ GOW(readdir, pFp)
|
||||
GO(readdir64, pFp) // check if alignement is correct
|
||||
// readdir64_r
|
||||
GOW(readdir_r, iFppp)
|
||||
GOW(readlink, iFppu)
|
||||
GOM(readlink, iFEppu)
|
||||
// readlinkat
|
||||
// __readlinkat_chk
|
||||
// __readlink_chk
|
||||
@@ -1322,7 +1330,7 @@ GO(readv, iFipi)
|
||||
GO(realloc, pFpu)
|
||||
DATAV(__realloc_hook, 4)
|
||||
GO(realpath, pFpp)
|
||||
// __realpath_chk
|
||||
GO(__realpath_chk, pFppu)
|
||||
// reboot
|
||||
// re_comp // Weak
|
||||
// re_compile_fastmap // Weak
|
||||
@@ -1333,10 +1341,10 @@ GOW(recvfrom, iFipuipp)
|
||||
// __recvfrom_chk
|
||||
GOW(recvmsg, iFipi)
|
||||
// re_exec // Weak
|
||||
// regcomp // Weak
|
||||
// regerror // Weak
|
||||
// regexec
|
||||
// regfree // Weak
|
||||
GOW(regcomp, iFppi)
|
||||
GOW(regerror, uFippu)
|
||||
GO(regexec, iFppupi)
|
||||
GOW(regfree, vFp)
|
||||
// __register_atfork
|
||||
// register_printf_function // Weak
|
||||
// registerrpc
|
||||
@@ -1349,8 +1357,8 @@ GO(remove, iFp)
|
||||
GO(rename, iFpp)
|
||||
// renameat
|
||||
// _res // type B
|
||||
// re_search // Weak
|
||||
// re_search_2 // Weak
|
||||
GOW(re_search, iFppiiip)
|
||||
GOW(re_search_2, iFppipiiipi)
|
||||
// re_set_registers // Weak
|
||||
// re_set_syntax // Weak
|
||||
// _res_hconf // type B
|
||||
@@ -1365,7 +1373,7 @@ DATA(__resp, 4)
|
||||
// re_syntax_options // type B
|
||||
// revoke
|
||||
GO(rewind, vFp)
|
||||
// rewinddir
|
||||
GO(rewinddir, vFp)
|
||||
// rexec
|
||||
// rexec_af
|
||||
// rexecoptions // type B
|
||||
@@ -1390,9 +1398,9 @@ GO(readdir64_r, iFppp) // is this present?
|
||||
// scalbn // Weak
|
||||
// scalbnf // Weak
|
||||
// scalbnl // Weak
|
||||
// scandir
|
||||
// scandir64
|
||||
GO2(scanf, iFpV, vscanf)
|
||||
GOM(scandir, iFEpppp)
|
||||
GOM(scandir64, iFEpppp)
|
||||
GO2(scanf, iFpp, vscanf)
|
||||
// __sched_cpualloc
|
||||
// __sched_cpucount
|
||||
// __sched_cpufree
|
||||
@@ -1413,20 +1421,20 @@ GO(sched_setaffinity, iFiup)
|
||||
// sched_setscheduler // Weak
|
||||
GO(__sched_yield, iFv)
|
||||
GOW(sched_yield, iFv)
|
||||
// __secure_getenv
|
||||
GO2(__secure_getenv, pFp, getenv) //__secure_getenv not always defined
|
||||
// seed48
|
||||
// seed48_r // Weak
|
||||
// seekdir
|
||||
GOW(select, iFipppp)
|
||||
GO(__select, iFipppp)
|
||||
// semctl
|
||||
// semget // Weak
|
||||
// semop // Weak
|
||||
// semtimedop
|
||||
GO(semctl, iFiiippppp) // use vararg after the 3 i
|
||||
GOW(semget, iFuii)
|
||||
GOW(semop, iFipu)
|
||||
GO(semtimedop, iFipup)
|
||||
GOW(send, iFipui)
|
||||
// __send // Weak
|
||||
// sendfile
|
||||
// sendfile64
|
||||
GO(sendfile64, iFiipu)
|
||||
GOW(sendmsg, iFipi)
|
||||
GOW(sendto, iFipuipu)
|
||||
// setaliasent
|
||||
@@ -1437,7 +1445,7 @@ GOW(setbuffer, vFppu)
|
||||
// setegid
|
||||
GOW(setenv, iFppi)
|
||||
// _seterr_reply
|
||||
// seteuid
|
||||
GO(seteuid, iFu)
|
||||
// setfsent
|
||||
// setfsgid
|
||||
// setfsuid
|
||||
@@ -1455,7 +1463,7 @@ GO(setlinebuf, vFp)
|
||||
GO(setlocale, pFip)
|
||||
// setlogin
|
||||
// setlogmask
|
||||
// setmntent // Weak
|
||||
GOW(setmntent, pFpp)
|
||||
// __setmntent
|
||||
// setnetent
|
||||
// setnetgrent
|
||||
@@ -1464,7 +1472,7 @@ GO(setlocale, pFip)
|
||||
// setpgrp
|
||||
GO(setpriority, iFiii)
|
||||
// setprotoent
|
||||
// setpwent
|
||||
GO(setpwent, vFv)
|
||||
GOW(setregid, iFuu)
|
||||
GOW(setresgid, iFuu)
|
||||
// setresuid // Weak
|
||||
@@ -1473,7 +1481,7 @@ GO(setrlimit, iFip)
|
||||
// setrlimit64
|
||||
// setrpcent
|
||||
// setservent
|
||||
// setsid // Weak
|
||||
GOW(setsid, iFv)
|
||||
GOW(setsockopt, iFiiipu)
|
||||
// setsourcefilter
|
||||
// setspent
|
||||
@@ -1489,14 +1497,14 @@ GOW(setvbuf, iFppiu)
|
||||
// setxattr
|
||||
// sgetspent
|
||||
// sgetspent_r // Weak
|
||||
// shmat // Weak
|
||||
// shmctl
|
||||
// shmdt // Weak
|
||||
// shmget // Weak
|
||||
GOW(shmat, pFipi)
|
||||
GOW(shmctl, iFiip)
|
||||
GOW(shmdt, iFp)
|
||||
GOW(shmget, iFuui)
|
||||
GOW(shutdown, iFii)
|
||||
GOM(sigaction, iFEipp) // Weak
|
||||
GOM(__sigaction, iFEipp) // Weak
|
||||
// sigaddset
|
||||
GO(sigaddset, iFpi)
|
||||
// __sigaddset
|
||||
// sigaltstack // Weak
|
||||
// sigandset
|
||||
@@ -1504,7 +1512,7 @@ GOM(__sigaction, iFEipp) // Weak
|
||||
// sigdelset
|
||||
// __sigdelset
|
||||
GO(sigemptyset, iFp)
|
||||
// sigfillset
|
||||
GO(sigfillset, iFp)
|
||||
// siggetmask
|
||||
// sighold
|
||||
// sigignore
|
||||
@@ -1520,8 +1528,8 @@ GOM(signal, pFEip) // Weak
|
||||
// sigorset
|
||||
// sigpause // Weak
|
||||
// __sigpause
|
||||
// sigpending
|
||||
// sigprocmask // Weak
|
||||
GO(sigpending, iFp)
|
||||
GOW(sigprocmask, iFipp)
|
||||
// sigqueue // Weak
|
||||
// sigrelse
|
||||
// sigreturn // Weak
|
||||
@@ -1540,7 +1548,7 @@ GOM(snprintf, iFEpupVV)
|
||||
GOM(__snprintf_chk, iFEpuvvpVV)
|
||||
// sockatmark
|
||||
GOW(socket, iFiii)
|
||||
// socketpair // Weak
|
||||
GOW(socketpair, iFiiip)
|
||||
// splice
|
||||
GOM(sprintf, iFEppVV)
|
||||
GOM(__sprintf_chk, iFEpvvpVV)
|
||||
@@ -1554,9 +1562,9 @@ GO2(sscanf, iFppV, vsscanf) // sscanf va_list is only pointer, no realign to
|
||||
// ssignal // Weak
|
||||
// sstk
|
||||
GOM(__stack_chk_fail, vFE)
|
||||
// statfs // Weak
|
||||
GOW(statfs, iFpp)
|
||||
// __statfs
|
||||
// statfs64 // Weak
|
||||
GOW(statfs64, iFpp) // is alignment ok?
|
||||
GO(statvfs, iFpp)
|
||||
GOW(statvfs64, iFpp) // is alignment ok?
|
||||
DATA(stderr, 4)
|
||||
@@ -1623,7 +1631,7 @@ GO(strpbrk, pFpp)
|
||||
GO(strptime, pFppp)
|
||||
// strptime_l // Weak
|
||||
GO(strrchr, pFpi)
|
||||
// strsep // Weak
|
||||
GOW(strsep, pFpp)
|
||||
// __strsep_1c
|
||||
// __strsep_2c
|
||||
// __strsep_3c
|
||||
@@ -1642,7 +1650,7 @@ GO(strtof, fFpp)
|
||||
GO(__strtof_internal, fFppp)
|
||||
GO(__strtof_l, fFppp)
|
||||
GOW(strtof_l, fFppu)
|
||||
// strtoimax
|
||||
GO(strtoimax, IFppi)
|
||||
GO(strtok, pFpp)
|
||||
GO(__strtok_r, pFppp)
|
||||
GOW(strtok_r, pFppp)
|
||||
@@ -1661,18 +1669,18 @@ GO(strtoll, IFppi)
|
||||
// strtoll_l // Weak
|
||||
// strtoq // Weak
|
||||
GO(strtoul, uFppi)
|
||||
// __strtoul_internal
|
||||
GO(__strtoul_internal, uFppii)
|
||||
GO(strtoull, UFppi)
|
||||
// __strtoul_l
|
||||
// strtoul_l // Weak
|
||||
// __strtoull_internal
|
||||
// __strtoull_l
|
||||
// strtoull_l // Weak
|
||||
// strtoumax
|
||||
GO(strtoumax, UFppi)
|
||||
// strtouq // Weak
|
||||
// strverscmp // Weak
|
||||
// __strverscmp
|
||||
// strxfrm
|
||||
GO(strxfrm, uFppu)
|
||||
GO(__strxfrm_l, uFppup)
|
||||
GO(strxfrm_l, uFppup)
|
||||
// stty
|
||||
@@ -1709,7 +1717,7 @@ GO(strxfrm_l, uFppup)
|
||||
// swapoff // Weak
|
||||
// swapon // Weak
|
||||
// swprintf
|
||||
// __swprintf_chk
|
||||
GOM(__swprintf_chk, iFEpuiupV)
|
||||
// swscanf
|
||||
GOW(symlink, iFpp)
|
||||
// symlinkat
|
||||
@@ -1722,9 +1730,9 @@ GO(__sysconf, iFi)
|
||||
// __sysctl
|
||||
DATA(_sys_errlist, 4)
|
||||
DATA(sys_errlist, 4)
|
||||
// sysinfo
|
||||
// syslog
|
||||
// __syslog_chk
|
||||
GO(sysinfo, iFp)
|
||||
GO2(syslog, vFiV, vsyslog)
|
||||
GO2(__syslog_chk, vFiipV, __vsyslog_chk)
|
||||
// _sys_nerr // type R
|
||||
// sys_nerr // type R
|
||||
DATA(sys_sigabbrev, 4)
|
||||
@@ -1750,16 +1758,16 @@ GO(tcsetattr, iFiip)
|
||||
GOW(textdomain, pFp)
|
||||
// tfind // Weak
|
||||
GO(time, uFp)
|
||||
// timegm
|
||||
GO(timegm, uFp)
|
||||
// timelocal // Weak
|
||||
// timerfd_create
|
||||
// timerfd_gettime
|
||||
// timerfd_settime
|
||||
// times // Weak
|
||||
DATAV(timezone, 4)
|
||||
// __timezone // type B
|
||||
DATAB(__timezone, 4) // type B
|
||||
GO(tmpfile, pFv)
|
||||
// tmpfile64
|
||||
GO(tmpfile64, pFv)
|
||||
GO(tmpnam, pFp)
|
||||
// tmpnam_r
|
||||
// toascii
|
||||
@@ -1776,7 +1784,7 @@ GO(toupper, iFi)
|
||||
// __towctrans
|
||||
// __towctrans_l
|
||||
// towctrans_l // Weak
|
||||
// towlower
|
||||
GO(towlower, iFi)
|
||||
GO(__towlower_l, iFip)
|
||||
// towlower_l // Weak
|
||||
GO(towupper, iFi)
|
||||
@@ -1798,10 +1806,10 @@ GOW(tzset, vFv)
|
||||
// __uflow
|
||||
// ulckpwdf // Weak
|
||||
// ulimit // Weak
|
||||
// umask // Weak
|
||||
GOW(umask, uFu)
|
||||
// umount // Weak
|
||||
// umount2 // Weak
|
||||
// uname // Weak
|
||||
GOW(uname, iFp)
|
||||
// __underflow
|
||||
GOW(ungetc, iFip)
|
||||
GO(ungetwc, iFip)
|
||||
@@ -1820,19 +1828,19 @@ GO(usleep, iFu)
|
||||
// ustat
|
||||
GO(utime, iFpp)
|
||||
// utimensat
|
||||
// utimes // Weak
|
||||
GOW(utimes, iFpp) //TODO: check, signature is int utimes(const char *filename, const struct timeval times[2]);
|
||||
// utmpname // Weak
|
||||
// utmpxname
|
||||
// valloc // Weak
|
||||
// vasprintf // Weak
|
||||
// __vasprintf_chk
|
||||
GOM(vasprintf, iFEppVV)
|
||||
GOM(__vasprintf_chk, iFEpipVV)
|
||||
// vdprintf // Weak
|
||||
// __vdprintf_chk
|
||||
// verr
|
||||
GOM(verr, vFEpV)
|
||||
// verrx
|
||||
// versionsort
|
||||
// versionsort64
|
||||
// vfork // Weak
|
||||
GOM(vfork, iFEv) // Weak
|
||||
// __vfork
|
||||
GOM(vfprintf, iFEppVV)
|
||||
GOM(__vfprintf_chk, iFEpvpVV)
|
||||
@@ -1852,13 +1860,13 @@ GOM(__vsnprintf, iFEpupVV) // Weak
|
||||
GOM(__vsnprintf_chk, iFEpuvvpVV)
|
||||
GOM(vsprintf, iFEppVV) // Weak
|
||||
GOM(__vsprintf_chk, iFEpvvpp)
|
||||
// vsscanf // Weak
|
||||
GO(vsscanf, iFpV)
|
||||
// __vsscanf // Weak
|
||||
GOM(vswprintf, iFEpupVV) // Weak
|
||||
GOM(__vswprintf_chk, iFEpuvvpVV) // Weak
|
||||
// vswscanf
|
||||
// vsyslog
|
||||
// __vsyslog_chk
|
||||
GO(vsyslog, vFipV)
|
||||
GO(__vsyslog_chk, vFiipV)
|
||||
// vtimes
|
||||
// vwarn
|
||||
// vwarnx
|
||||
@@ -1891,7 +1899,7 @@ GO(wcscmp, iFpp)
|
||||
GOW(wcscoll, iFpp)
|
||||
GO(__wcscoll_l, iFppp)
|
||||
GOW(wcscoll_l, iFppp)
|
||||
// wcscpy
|
||||
GO(wcscpy, pFpp)
|
||||
GO(__wcscpy_chk, pFppu)
|
||||
// wcscspn
|
||||
// wcsdup
|
||||
@@ -1912,27 +1920,27 @@ GOW(wcsnrtombs, uFppuup)
|
||||
// __wcsnrtombs_chk
|
||||
// wcspbrk
|
||||
// wcsrchr
|
||||
// wcsrtombs // Weak
|
||||
GOW(wcsrtombs, uFppup)
|
||||
// __wcsrtombs_chk
|
||||
// wcsspn
|
||||
// wcsstr
|
||||
// wcstod
|
||||
GO(wcstod, dFpp)
|
||||
// __wcstod_internal
|
||||
// __wcstod_l
|
||||
// wcstod_l // Weak
|
||||
// wcstof
|
||||
GO(wcstof, fFpp)
|
||||
// __wcstof_internal
|
||||
// __wcstof_l
|
||||
// wcstof_l // Weak
|
||||
// wcstoimax
|
||||
// wcstok
|
||||
// wcstol
|
||||
GO(wcstol, iFppi)
|
||||
// wcstold
|
||||
// __wcstold_internal
|
||||
// __wcstold_l
|
||||
// wcstold_l // Weak
|
||||
// __wcstol_internal
|
||||
// wcstoll
|
||||
GO(wcstoll, IFppi)
|
||||
// __wcstol_l
|
||||
// wcstol_l // Weak
|
||||
// __wcstoll_internal
|
||||
@@ -1941,9 +1949,9 @@ GOW(wcsnrtombs, uFppuup)
|
||||
GO(wcstombs, uFppu)
|
||||
// __wcstombs_chk
|
||||
// wcstoq // Weak
|
||||
// wcstoul
|
||||
GO(wcstoul, iFppi)
|
||||
// __wcstoul_internal
|
||||
// wcstoull
|
||||
GO(wcstoull, UFppi)
|
||||
// __wcstoul_l
|
||||
// wcstoul_l // Weak
|
||||
// __wcstoull_internal
|
||||
@@ -1953,7 +1961,7 @@ GO(wcstombs, uFppu)
|
||||
// wcstouq // Weak
|
||||
// wcswcs // Weak
|
||||
// wcswidth
|
||||
// wcsxfrm
|
||||
GO(wcsxfrm, uFppu)
|
||||
GOW(wcsxfrm_l, uFppup)
|
||||
GO(__wcsxfrm_l, uFppup)
|
||||
GO(wctob, iFi)
|
||||
@@ -1962,7 +1970,7 @@ GO(wctomb, iFpi)
|
||||
// wctrans // Weak
|
||||
// __wctrans_l
|
||||
// wctrans_l // Weak
|
||||
// wctype // Weak
|
||||
GOW(wctype, uFp)
|
||||
GO(__wctype_l, uFpp)
|
||||
GOW(wctype_l, uFpp)
|
||||
// wcwidth
|
||||
@@ -2058,7 +2066,7 @@ GOW(writev, iFipi)
|
||||
// xdr_void
|
||||
// xdr_wrapstring
|
||||
// xencrypt
|
||||
// __xmknod
|
||||
GO(__xmknod, iFipup)
|
||||
// __xmknodat
|
||||
GO(__xpg_basename, pFp)
|
||||
// __xpg_sigpause // Weak
|
||||
@@ -2075,6 +2083,8 @@ GOM(_Jv_RegisterClasses, vFv) // dummy
|
||||
|
||||
GOM(__fdelt_chk, iFi)
|
||||
|
||||
//GOM(getauxval, uFEu) // implemented since glibc 2.16
|
||||
|
||||
// not found (libitm???), but it seems OK to declare dummies:
|
||||
|
||||
GOM(_ITM_RU1, uFp)
|
||||
@@ -2085,6 +2095,3 @@ GOM(_ITM_memcpyRnWt, vFppu) // register(2)
|
||||
GOM(_ITM_addUserCommitAction, vFEpup)
|
||||
GOM(_ITM_registerTMCloneTable, vFEpu)
|
||||
GOM(_ITM_deregisterTMCloneTable, vFEp)
|
||||
|
||||
|
||||
#endif
|
||||
+17
-9
@@ -1,7 +1,7 @@
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
@@ -74,9 +74,10 @@ void* my_dlmopen(x86emu_t* emu, void* lmid, void *filename, int flag)
|
||||
char* my_dlerror(x86emu_t* emu)
|
||||
{
|
||||
//char *dlerror(void);
|
||||
printf_log(LOG_INFO, "Error: unimplement call to dlerror()\n");
|
||||
emu->quit = 1;
|
||||
return "";
|
||||
/*printf_log(LOG_INFO, "Error: unimplement call to dlerror()\n");
|
||||
emu->quit = 1;*/
|
||||
static char* generror = "Generic libdl error";
|
||||
return generror;
|
||||
}
|
||||
void* my_dlsym(x86emu_t* emu, void *handle, void *symbol)
|
||||
{
|
||||
@@ -86,7 +87,7 @@ void* my_dlsym(x86emu_t* emu, void *handle, void *symbol)
|
||||
printf_log(LOG_DEBUG, "Call to dlsym(%p, \"%s\")\n", handle, rsymbol);
|
||||
if(handle==NULL) {
|
||||
// special case, look globably
|
||||
if(GetGlobalSymbolStartEnd(emu->context->maplib, rsymbol, &start, &end, 0))
|
||||
if(GetGlobalSymbolStartEnd(emu->context->maplib, rsymbol, &start, &end))
|
||||
return (void*)start;
|
||||
return NULL;
|
||||
}
|
||||
@@ -97,6 +98,9 @@ void* my_dlsym(x86emu_t* emu, void *handle, void *symbol)
|
||||
return NULL;
|
||||
if(dl->libs[nlib]->get(dl->libs[nlib], rsymbol, &start, &end)==0) {
|
||||
// not found
|
||||
if(dlsym_error && box86_log<LOG_DEBUG) {
|
||||
printf_log(LOG_NONE, "Call to dlsym(%s, \"%s\") Symbol not found\n", GetNameLib(dl->libs[nlib]), rsymbol);
|
||||
}
|
||||
printf_log(LOG_DEBUG, " Symbol not found\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -113,12 +117,16 @@ int my_dlclose(x86emu_t* emu, void *handle)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
int my_dladdr(x86emu_t* emu, void *addr, void *info)
|
||||
int my_dladdr(x86emu_t* emu, void *addr, void *i)
|
||||
{
|
||||
//int dladdr(void *addr, Dl_info *info);
|
||||
printf_log(LOG_INFO, "Error: unimplement call to dladdr(%p, %p)\n", addr, info);
|
||||
emu->quit = 1;
|
||||
return 0;
|
||||
Dl_info *info = (Dl_info*)i;
|
||||
printf_log(LOG_INFO, "Warning: partially unimplement call to dladdr(%p, %p)\n", addr, info);
|
||||
|
||||
//emu->quit = 1;
|
||||
info->dli_saddr = NULL;
|
||||
info->dli_sname = FindSymbolName(emu->context->maplib, addr, &info->dli_saddr, NULL, &info->dli_fname, &info->dli_fbase);
|
||||
return (info->dli_sname)?0:-1;
|
||||
}
|
||||
void* my_dlvsym(x86emu_t* emu, void *handle, void *symbol, void *version)
|
||||
{
|
||||
|
||||
+38
-1
@@ -14,9 +14,11 @@
|
||||
#include "x86emu_private.h"
|
||||
#include "box86context.h"
|
||||
#include "librarian.h"
|
||||
#include "callback.h"
|
||||
|
||||
void* my_glXGetProcAddress(x86emu_t* emu, void* name);
|
||||
void* my_glXGetProcAddressARB(x86emu_t* emu, void* name);
|
||||
void my_glDebugMessageCallback(x86emu_t* emu, void* prod, void* param);
|
||||
|
||||
const char* libglName = "libGL.so.1";
|
||||
#define LIBNAME libgl
|
||||
@@ -90,6 +92,41 @@ EXPORT void* my_glXGetProcAddress(x86emu_t* emu, void* name)
|
||||
printf_log(LOG_INFO, "Warning, no wrapper for %s\n", rname);
|
||||
return NULL;
|
||||
}
|
||||
return (void*)AddBridge(emu->context->system, kh_value(emu->context->glwrappers, k), symbol);
|
||||
return (void*)AddBridge(emu->context->system, kh_value(emu->context->glwrappers, k), symbol, 0);
|
||||
}
|
||||
EXPORT void* my_glXGetProcAddressARB(x86emu_t* emu, void* name) __attribute__((alias("my_glXGetProcAddress")));
|
||||
|
||||
typedef void (*vFpp_t)(void*, void*);
|
||||
typedef void (*debugProc_t)(int32_t, int32_t, uint32_t, int32_t, int32_t, void*, void*);
|
||||
static x86emu_t *debug_cb = NULL;
|
||||
static void debug_callback(int32_t source, int32_t type, uint32_t id, int32_t severity, int32_t length, const char* message, const void* param)
|
||||
{
|
||||
if(!debug_cb)
|
||||
return;
|
||||
SetCallbackArg(debug_cb, 0, (void*)source);
|
||||
SetCallbackArg(debug_cb, 1, (void*)type);
|
||||
SetCallbackArg(debug_cb, 2, (void*)id);
|
||||
SetCallbackArg(debug_cb, 3, (void*)severity);
|
||||
SetCallbackArg(debug_cb, 4, (void*)length);
|
||||
SetCallbackArg(debug_cb, 5, (void*)message);
|
||||
SetCallbackArg(debug_cb, 6, (void*)param);
|
||||
RunCallback(debug_cb);
|
||||
}
|
||||
EXPORT void my_glDebugMessageCallback(x86emu_t* emu, void* prod, void* param)
|
||||
{
|
||||
static vFpp_t DebugMessageCallback = NULL;
|
||||
static int init = 1;
|
||||
if(init) {
|
||||
DebugMessageCallback = my_glXGetProcAddress(emu, "glDebugMessageCallback");
|
||||
init = 0;
|
||||
}
|
||||
if(!DebugMessageCallback)
|
||||
return;
|
||||
if(debug_cb) {
|
||||
FreeCallback(debug_cb);
|
||||
debug_cb = NULL;
|
||||
}
|
||||
if(prod)
|
||||
debug_cb = AddCallback(emu, (uintptr_t)prod, 7, NULL, NULL, NULL, NULL);
|
||||
DebugMessageCallback(prod?debug_callback:NULL, param);
|
||||
}
|
||||
@@ -1366,7 +1366,7 @@ GO(glNormalPointervINTEL,vFup)
|
||||
GO(glTexCoordPointervINTEL,vFiup)
|
||||
GO(glVertexPointervINTEL,vFiup)
|
||||
//KHR_debug
|
||||
// GOM(glDebugMessageCallback,vFE?p)
|
||||
GOM(glDebugMessageCallback,vFEpp) // not ideal, because the my_ version will always exist, even if glDebugMessageCallback doesn't
|
||||
GO(glDebugMessageControl,vFuuuipi)
|
||||
GO(glDebugMessageInsert,vFuuuuip)
|
||||
GO(glGetDebugMessageLog,uFuipppppp)
|
||||
@@ -2825,15 +2825,37 @@ GO(glBlendEquationi,vFuu)
|
||||
GO(glBlendFuncSeparatei,vFuuuuu)
|
||||
GO(glBlendFunci,vFuuu)
|
||||
GO(glMinSampleShading,vFf)
|
||||
//VERSION_4_3
|
||||
GO(glInvalidateNamedFramebuffer, vFiup)
|
||||
//VERSION_4_5
|
||||
GO(glBindTextureUnit, vFuu)
|
||||
GO(glCreateFramebuffers, vFip)
|
||||
GO(glCreateProgramPipelines, vFip)
|
||||
GO(glCreateRenderbuffers, vFip)
|
||||
GO(glCreateTextures, vFuip)
|
||||
GO(glInvalidateNamedFramebufferData, vFuip)
|
||||
|
||||
//GL_KTX_buffer_region
|
||||
GO(glBufferRegionEnabled,uFv)
|
||||
GO(glNewBufferRegion,uFi)
|
||||
GO(glDeleteBufferRegion,vFi)
|
||||
GO(glReadBufferRegion,vFuiiii)
|
||||
GO(glDrawBufferRegion,vFuiiiiii)
|
||||
|
||||
//glx
|
||||
GO(glXBindHyperpipeSGIX,iFpi)
|
||||
GO(glXBindTexImageEXT, vFppip)
|
||||
GO(glXBindSwapBarrierNV, iFpuu)
|
||||
GO(glXBindSwapBarrierSGIX,vFii)
|
||||
GO(glXBindVideoCaptureDeviceNV, iFpup)
|
||||
GO(glXBindVideoDeviceNV, iFpuup)
|
||||
GO(glXBindVideoImageNV, iFpppi)
|
||||
GO(glXChangeDrawableAttributes,vFp)
|
||||
GO(glXChangeDrawableAttributesSGIX,vFp)
|
||||
GO(glXClientInfo,vFv)
|
||||
GO(glXCopyContext,vFppp)
|
||||
GO(glXChooseFBConfig, pFpipp)
|
||||
GO(glXChooseFBConfigSGIX, pFpipp)
|
||||
GO(glXCreateContext,pFpppi)
|
||||
GO(glXCreateContextAttribsARB, pFpppip)
|
||||
GO(glXCreateContextWithConfigSGIX,pFppipi)
|
||||
@@ -2846,6 +2868,8 @@ GO(glXCreatePbuffer,pFpp)
|
||||
GO(glXCreatePixmap,pFppp)
|
||||
GO(glXCreateWindow,pFpppp)
|
||||
GO(glXChooseVisual, pFpip)
|
||||
GO(glXCopyImageSubDataNV, vFppuiiiiipuiiiiiiii)
|
||||
GO(glXCopySubBufferMESA, vFppiiii)
|
||||
GO(glXDestroyContext,vFpp)
|
||||
GO(glXDestroyGLXPbufferSGIX,vFpp)
|
||||
GO(glXDestroyGLXPixmap,vFpp)
|
||||
@@ -2854,21 +2878,37 @@ GO(glXDestroyHyperpipeConfigSGIX,iFpi)
|
||||
GO(glXDestroyPbuffer,vFp)
|
||||
GO(glXDestroyPixmap,vFp)
|
||||
GO(glXDestroyWindow,vFp)
|
||||
GO(glXEnumerateVideoCaptureDevicesNV, pFpip)
|
||||
GO(glXEnumerateVideoDevicesNV, pFpip)
|
||||
GO(glXFreeContextEXT, vFpp)
|
||||
GO(glXGetClientString, pFpi)
|
||||
GO(glXGetContextIDEXT, uFp)
|
||||
GO(glXGetCurrentContext, pFv)
|
||||
GO(glXGetCurrentDisplay, pFv)
|
||||
GO(glXGetCurrentReadDrawable, pFv)
|
||||
GO(glXGetDrawableAttributes,vFi)
|
||||
GO(glXGetDrawableAttributesSGIX,vFi)
|
||||
GO(glXGetFBConfigs,pFpip)
|
||||
GO(glXGetFBConfigAttrib, iFppip)
|
||||
GO(glXGetFBConfigAttribSGIX, iFppip)
|
||||
GO(glXGetFBConfigFromVisualSGIX, pFpp)
|
||||
GO(glXGetFBConfigsSGIX,pFpip)
|
||||
GO(glXGetSelectedEvent, vFppp)
|
||||
GO(glXGetSelectedEventSGIX, vFppp)
|
||||
GO(glXGetVideoDeviceNV, iFpiip)
|
||||
GO(glXGetVideoInfoNV, iFpippp)
|
||||
GO(glXGetVideoSyncSGI, iFp)
|
||||
GO(glXGetVisualConfigs,pFpp)
|
||||
GO(glXGetVisualFromFBConfig, pFpp)
|
||||
GO(glXGetVisualFromFBConfigSGIX, pFpp)
|
||||
GO(glXGetSwapIntervalMESA, iFv)
|
||||
GO(glXHyperpipeAttribSGIX,iFpiiip)
|
||||
//GO(glXHyperpipeConfigSGIX,iFpii?p)
|
||||
GO(glXImportContextEXT, pFpu)
|
||||
GO(glXIsDirect,iFpp)
|
||||
GO(glXJoinSwapGroupNV, iFppu)
|
||||
GO(glXJoinSwapGroupSGIX,vFpp)
|
||||
GO(glXLockVideoCaptureDeviceNV, vFpp)
|
||||
GO(glXMakeContextCurrent,iFpppp)
|
||||
GO(glXMakeCurrent,iFppp)
|
||||
GO(glXMakeCurrentReadSGI,iFppp)
|
||||
@@ -2877,15 +2917,28 @@ GO(glXQueryContextInfoEXT,iFppip)
|
||||
GO(glXQueryDrawable, iFppip)
|
||||
GO(glXQueryExtension, iFppp)
|
||||
GO(glXQueryExtensionsString,pFpi)
|
||||
GO(glXQueryFrameCountNV, iFpip)
|
||||
GO(glXQueryGLXPbufferSGIX, vFppip)
|
||||
GO(glXQueryHyperpipeAttribSGIX,iFpiiip)
|
||||
GO(glXQueryHyperpipeBestAttribSGIX,iFpiiipp)
|
||||
GO(glXQueryHyperpipeConfigSGIX,pFpip)
|
||||
GO(glXQueryHyperpipeNetworkSGIX,pFpp)
|
||||
GO(glXQueryMaxSwapBarriersSGIX,pFpp) //?
|
||||
GO(glXQueryMaxSwapGroupsNV, iFpipp)
|
||||
GO(glXQueryServerString,pFpii)
|
||||
GO(glXQuerySwapGroupNV, iFpipp)
|
||||
GO(glXQueryVersion,iFppp)
|
||||
GO(glXQueryVideoCaptureDeviceNV, iFppip)
|
||||
GO(glXReleaseTexImageEXT, vFppi)
|
||||
GO(glXReleaseVideoCaptureDeviceNV, vFpp)
|
||||
GO(glXReleaseVideoDeviceNV, iFpip)
|
||||
GO(glXReleaseVideoImageNV, iFpp)
|
||||
//GO(glXRender,vFv)
|
||||
//GO(glXRenderLarge,vFv)
|
||||
GO(glXResetFrameCountNV, iFpi)
|
||||
GO(glXSelectEvent, vFppu)
|
||||
GO(glXSelectEventSGIX, vFppu)
|
||||
GO(glXSendPbufferToVideoNV, iFppipi)
|
||||
GO(glXSwapBuffers,vFpp)
|
||||
GO(glXSwapIntervalEXT,pFppi)
|
||||
GO(glXSwapIntervalMESA,iFi)
|
||||
@@ -2894,6 +2947,7 @@ GO(glXUseXFont,vFpiii)
|
||||
//GO(glXVendorPrivate,vFv)
|
||||
//GO(glXVendorPrivateWithReply,vFv)
|
||||
GO(glXWaitGL,vFv)
|
||||
GO(glXWaitVideoSyncSGI, iFiip)
|
||||
GO(glXWaitX,vFv)
|
||||
|
||||
GOM(glXGetProcAddress, pFEp)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
#include "debug.h"
|
||||
|
||||
const char* libjpegName = "libjpeg.so.8";
|
||||
#define LIBNAME libjpeg
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
|
||||
GO(jcopy_block_row, vFppu)
|
||||
GO(jcopy_sample_rows, vFpipiiu)
|
||||
GO(jdiv_round_up, iFii)
|
||||
GO(jinit_1pass_quantizer, vFp)
|
||||
GO(jinit_2pass_quantizer, vFp)
|
||||
GO(jinit_arith_decoder, vFp)
|
||||
GO(jinit_arith_encoder, vFp)
|
||||
GO(jinit_c_coef_controller, vFpi)
|
||||
GO(jinit_c_main_controller, vFpi)
|
||||
GO(jinit_c_master_control, vFpi)
|
||||
GO(jinit_color_converter, vFp)
|
||||
GO(jinit_color_deconverter, vFp)
|
||||
GO(jinit_compress_master, vFp)
|
||||
GO(jinit_c_prep_controller, vFpi)
|
||||
GO(jinit_d_coef_controller, vFpi)
|
||||
GO(jinit_d_main_controller, vFpi)
|
||||
GO(jinit_downsampler, vFp)
|
||||
GO(jinit_d_post_controller, vFpi)
|
||||
GO(jinit_forward_dct, vFp)
|
||||
GO(jinit_huff_decoder, vFp)
|
||||
GO(jinit_huff_encoder, vFp)
|
||||
GO(jinit_input_controller, vFp)
|
||||
GO(jinit_inverse_dct, vFp)
|
||||
GO(jinit_marker_reader, vFp)
|
||||
GO(jinit_marker_writer, vFp)
|
||||
GO(jinit_master_decompress, vFp)
|
||||
GO(jinit_memory_mgr, vFp)
|
||||
GO(jinit_merged_upsampler, vFp)
|
||||
GO(jinit_phuff_decoder, vFp)
|
||||
GO(jinit_phuff_encoder, vFp)
|
||||
GO(jinit_upsampler, vFp)
|
||||
GO(jpeg_abort, vFp)
|
||||
GO(jpeg_abort_compress, vFp)
|
||||
GO(jpeg_abort_decompress, vFp)
|
||||
GO(jpeg_add_quant_table, vFpipii)
|
||||
GO(jpeg_alloc_huff_table, pFp)
|
||||
GO(jpeg_alloc_quant_table, pFp)
|
||||
DATA(jpeg_aritab,4) //R
|
||||
GO(jpeg_calc_jpeg_dimensions, vFp)
|
||||
GO(jpeg_calc_output_dimensions, vFp)
|
||||
GO(jpeg_consume_input, iFp)
|
||||
GO(jpeg_copy_critical_parameters, vFp)
|
||||
GO(jpeg_core_output_dimensions, vFp)
|
||||
GO(jpeg_CreateCompress, vFpiu)
|
||||
GO(jpeg_CreateDecompress, vFpiu)
|
||||
GO(jpeg_crop_scanline, vFppp)
|
||||
GO(jpeg_default_colorspace, vFp)
|
||||
GO(jpeg_default_qtables, vFpi)
|
||||
GO(jpeg_destroy, vFp)
|
||||
GO(jpeg_destroy_compress, vFp)
|
||||
GO(jpeg_destroy_decompress, vFp)
|
||||
//GO(jpeg_fdct_float
|
||||
//GO(jpeg_fdct_ifast
|
||||
//GO(jpeg_fdct_islow
|
||||
//GO(jpeg_fill_bit_buffer
|
||||
GO(jpeg_finish_compress, vFp)
|
||||
GO(jpeg_finish_decompress, iFp)
|
||||
GO(jpeg_finish_output, iFp)
|
||||
//GO(jpeg_free_large
|
||||
//GO(jpeg_free_small
|
||||
//GO(jpeg_gen_optimal_table
|
||||
//GO(jpeg_get_large
|
||||
//GO(jpeg_get_small
|
||||
GO(jpeg_has_multiple_scans, iFp)
|
||||
//GO(jpeg_huff_decode
|
||||
//GO(jpeg_idct_10x10
|
||||
//GO(jpeg_idct_11x11
|
||||
//GO(jpeg_idct_12x12
|
||||
//GO(jpeg_idct_13x13
|
||||
//GO(jpeg_idct_14x14
|
||||
//GO(jpeg_idct_15x15
|
||||
//GO(jpeg_idct_16x16
|
||||
//GO(jpeg_idct_1x1
|
||||
//GO(jpeg_idct_2x2
|
||||
//GO(jpeg_idct_3x3
|
||||
//GO(jpeg_idct_4x4
|
||||
//GO(jpeg_idct_5x5
|
||||
//GO(jpeg_idct_6x6
|
||||
//GO(jpeg_idct_7x7
|
||||
//GO(jpeg_idct_9x9
|
||||
//GO(jpeg_idct_float
|
||||
//GO(jpeg_idct_ifast
|
||||
//GO(jpeg_idct_islow
|
||||
GO(jpeg_input_complete, iFp)
|
||||
//GO(jpeg_make_c_derived_tbl
|
||||
//GO(jpeg_make_d_derived_tbl
|
||||
//GO(jpeg_mem_available
|
||||
GO(jpeg_mem_dest, vFppp)
|
||||
//GO(jpeg_mem_init
|
||||
GO(jpeg_mem_src, vFppu)
|
||||
//GO(jpeg_mem_term
|
||||
DATA(jpeg_natural_order,4) //R
|
||||
GO(jpeg_new_colormap, vFp)
|
||||
//GO(jpeg_open_backing_store
|
||||
GO(jpeg_quality_scaling, iFi)
|
||||
GO(jpeg_read_coefficients, pFp)
|
||||
GO(jpeg_read_header, iFpi)
|
||||
GO(jpeg_read_raw_data, uFppu)
|
||||
GO(jpeg_read_scanlines, uFppu)
|
||||
GO(jpeg_resync_to_restart, iFpi)
|
||||
GO(jpeg_save_markers, vFpiu)
|
||||
GO(jpeg_set_colorspace, vFpi)
|
||||
GO(jpeg_set_defaults, vFp)
|
||||
GO(jpeg_set_linear_quality, vFpii)
|
||||
//GOM(jpeg_set_marker_processor, vFEpiB)
|
||||
GO(jpeg_set_quality, vFpii)
|
||||
//GO(jpeg_simd_cpu_support
|
||||
GO(jpeg_simple_progression, vFp)
|
||||
GO(jpeg_skip_scanlines, uFpu)
|
||||
GO(jpeg_start_compress, vFpi)
|
||||
GO(jpeg_start_decompress, iFp)
|
||||
GO(jpeg_start_output, iFpi)
|
||||
GO(jpeg_std_error, pFp)
|
||||
GO(jpeg_stdio_dest, vFpp)
|
||||
GO(jpeg_stdio_src, vFpp)
|
||||
DATA(jpeg_std_message_table, 4)
|
||||
GO(jpeg_suppress_tables, vFpi)
|
||||
GO(jpeg_write_coefficients, vFpp)
|
||||
GO(jpeg_write_marker, vFpipu)
|
||||
GO(jpeg_write_m_byte, vFpi)
|
||||
GO(jpeg_write_m_header, vFpiu)
|
||||
GO(jpeg_write_raw_data, uFppu)
|
||||
GO(jpeg_write_scanlines, uFppu)
|
||||
GO(jpeg_write_tables, vFp)
|
||||
GO(jround_up, iFii)
|
||||
GO(jzero_far, vFpu)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
#include <complex.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
@@ -10,6 +11,19 @@
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
#include "debug.h"
|
||||
|
||||
EXPORT void* my_clog(void* p, double real, double img)
|
||||
{
|
||||
*(double complex*)p = clog(real+img*I);
|
||||
return p;
|
||||
}
|
||||
|
||||
EXPORT void* my_csqrt(void* p, double real, double img)
|
||||
{
|
||||
*(double complex*)p = csqrt(real+img*I);
|
||||
return p;
|
||||
}
|
||||
|
||||
const char* libmName = "libm.so.6";
|
||||
#define LIBNAME libm
|
||||
|
||||
+14
-14
@@ -73,7 +73,7 @@ GOW(ceilf, fFf)
|
||||
// cimag // Weak
|
||||
// cimagf // Weak
|
||||
// cimagl // Weak
|
||||
// clog // Weak
|
||||
GOS(clog, pFpdd) // return a double complex, that is a struct
|
||||
// clog10 // Weak
|
||||
// __clog10
|
||||
// clog10f // Weak
|
||||
@@ -85,8 +85,8 @@ GOW(ceilf, fFf)
|
||||
// conj // Weak
|
||||
// conjf // Weak
|
||||
// conjl // Weak
|
||||
// copysign // Weak
|
||||
// copysignf // Weak
|
||||
GOW(copysign, dFdd)
|
||||
GOW(copysignf, fFff)
|
||||
// copysignl // Weak
|
||||
GOW(cos, dFd)
|
||||
GOW(cosf, fFf)
|
||||
@@ -111,7 +111,7 @@ GOW(coshf, fFf)
|
||||
// csinhf // Weak
|
||||
// csinhl // Weak
|
||||
// csinl // Weak
|
||||
// csqrt // Weak
|
||||
GOS(csqrt, pFpdd)
|
||||
// csqrtf // Weak
|
||||
// csqrtl // Weak
|
||||
// ctan // Weak
|
||||
@@ -161,14 +161,14 @@ GO(__exp_finite, dFd)
|
||||
// fegetexcept
|
||||
// fegetexceptflag
|
||||
// fegetround
|
||||
// feholdexcept
|
||||
GO(feholdexcept, iFp)
|
||||
// feraiseexcept
|
||||
// fesetenv
|
||||
// fesetexceptflag
|
||||
// fesetround
|
||||
// fetestexcept
|
||||
// feupdateenv
|
||||
// finite // Weak
|
||||
GOW(finite, iFd)
|
||||
// __finite
|
||||
GOW(finitef, iFf)
|
||||
GO(__finitef, iFf)
|
||||
@@ -202,8 +202,8 @@ GO2(frexpl, LFLp, frexp)
|
||||
// gammal // Weak
|
||||
// __gamma_r_finite
|
||||
// __gmon_start__ // Weak
|
||||
// hypot // Weak
|
||||
// hypotf // Weak
|
||||
GOW(hypot, dFdd)
|
||||
GOW(hypotf, fFff)
|
||||
// __hypotf_finite
|
||||
// __hypot_finite
|
||||
// hypotl // Weak
|
||||
@@ -271,8 +271,8 @@ GO(__log_finite, dFd)
|
||||
GOW(lrint, iFd)
|
||||
GOW(lrintf, iFf)
|
||||
// lrintl // Weak
|
||||
// lround // Weak
|
||||
// lroundf // Weak
|
||||
GOW(lround, iFd)
|
||||
GOW(lroundf, iFf)
|
||||
// lroundl // Weak
|
||||
// matherr // Weak
|
||||
GOW(modf, dFdp)
|
||||
@@ -317,11 +317,11 @@ GOW(roundf, fFf)
|
||||
// __scalbf_finite
|
||||
// __scalb_finite
|
||||
// scalbl // Weak
|
||||
// scalbln // Weak
|
||||
// scalblnf // Weak
|
||||
GOW(scalbln, dFdi)
|
||||
GOW(scalblnf, fFfi)
|
||||
// scalblnl // Weak
|
||||
// scalbn // Weak
|
||||
// scalbnf // Weak
|
||||
GOW(scalbn, dFdi)
|
||||
GOW(scalbnf, fFfi)
|
||||
// scalbnl // Weak
|
||||
// __signbit
|
||||
// __signbitf
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* liboggName = "libogg.so.0";
|
||||
#define LIBNAME libogg
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error meh!
|
||||
#endif
|
||||
|
||||
//GO(oggpack_adv,
|
||||
//GO(oggpack_adv1,
|
||||
//GO(oggpackB_adv,
|
||||
//GO(oggpackB_adv1,
|
||||
//GO(oggpackB_bits,
|
||||
//GO(oggpackB_bytes,
|
||||
//GO(oggpackB_get_buffer,
|
||||
//GO(oggpack_bits,
|
||||
//GO(oggpackB_look,
|
||||
//GO(oggpackB_look1,
|
||||
//GO(oggpackB_read,
|
||||
//GO(oggpackB_read1,
|
||||
//GO(oggpackB_readinit,
|
||||
//GO(oggpackB_reset,
|
||||
//GO(oggpackB_write,
|
||||
//GO(oggpackB_writealign,
|
||||
//GO(oggpackB_writecheck,
|
||||
//GO(oggpackB_writeclear,
|
||||
//GO(oggpackB_writecopy,
|
||||
//GO(oggpackB_writeinit,
|
||||
//GO(oggpackB_writetrunc,
|
||||
//GO(oggpack_bytes,
|
||||
//GO(ogg_packet_clear,
|
||||
//GO(oggpack_get_buffer,
|
||||
//GO(oggpack_look,
|
||||
//GO(oggpack_look1,
|
||||
//GO(oggpack_read,
|
||||
//GO(oggpack_read1,
|
||||
//GO(oggpack_readinit,
|
||||
//GO(oggpack_reset,
|
||||
//GO(oggpack_write,
|
||||
//GO(oggpack_writealign,
|
||||
//GO(oggpack_writecheck,
|
||||
//GO(oggpack_writeclear,
|
||||
//GO(oggpack_writecopy,
|
||||
//GO(oggpack_writeinit,
|
||||
//GO(oggpack_writetrunc,
|
||||
GO(ogg_page_bos, iFp)
|
||||
//GO(ogg_page_checksum_set,
|
||||
//GO(ogg_page_continued,
|
||||
GO(ogg_page_eos, iFp)
|
||||
GO(ogg_page_granulepos, IFp)
|
||||
//GO(ogg_page_packets,
|
||||
//GO(ogg_page_pageno,
|
||||
GO(ogg_page_serialno, iFp)
|
||||
//GO(ogg_page_version,
|
||||
//GO(ogg_stream_check,
|
||||
GO(ogg_stream_clear, iFp)
|
||||
//GO(ogg_stream_destroy,
|
||||
//GO(ogg_stream_eos,
|
||||
//GO(ogg_stream_flush,
|
||||
//GO(ogg_stream_flush_fill,
|
||||
GO(ogg_stream_init, iFpi)
|
||||
//GO(ogg_stream_iovecin,
|
||||
//GO(ogg_stream_packetin,
|
||||
GO(ogg_stream_packetout, iFpp)
|
||||
//GO(ogg_stream_packetpeek,
|
||||
GO(ogg_stream_pagein, iFpp)
|
||||
//GO(ogg_stream_pageout,
|
||||
//GO(ogg_stream_pageout_fill,
|
||||
//GO(ogg_stream_reset,
|
||||
//GO(ogg_stream_reset_serialno,
|
||||
GO(ogg_sync_buffer, pFpi)
|
||||
//GO(ogg_sync_check,
|
||||
GO(ogg_sync_clear, iFp)
|
||||
//GO(ogg_sync_destroy,
|
||||
GO(ogg_sync_init, iFp)
|
||||
GO(ogg_sync_pageout, iFpp)
|
||||
//GO(ogg_sync_pageseek,
|
||||
//GO(ogg_sync_reset,
|
||||
GO(ogg_sync_wrote, iFpi)
|
||||
+14
-4
@@ -15,16 +15,27 @@
|
||||
#include "box86context.h"
|
||||
#include "librarian.h"
|
||||
|
||||
const char* libpthreadName = "libpthread.so.0";
|
||||
#define LIBNAME libpthread
|
||||
|
||||
|
||||
int my_pthread_create(x86emu_t *emu, void* t, void* attr, void* start_routine, void* arg); //implemented in thread.c
|
||||
int my_pthread_key_create(x86emu_t* emu, void* key, void* dtor);
|
||||
int my___pthread_key_create(x86emu_t* emu, void* key, void* dtor);
|
||||
int my_pthread_once(x86emu_t* emu, void* once, void* cb);
|
||||
int my_pthread_cond_broadcast(x86emu_t* emu, void* cond);
|
||||
int my_pthread_cond_destroy(x86emu_t* emu, void* cond);
|
||||
int my_pthread_cond_init(x86emu_t* emu, void* cond, void* attr);
|
||||
int my_pthread_cond_signal(x86emu_t* emu, void* cond);
|
||||
int my_pthread_cond_timedwait(x86emu_t* emu, void* cond, void* mutex, void* abstime);
|
||||
int my_pthread_cond_wait(x86emu_t* emu, void* cond, void* mutex);
|
||||
|
||||
|
||||
typedef int (*iFpp_t)(void*, void*);
|
||||
typedef int (*iFppu_t)(void*, void*, uint32_t);
|
||||
EXPORT int my_pthread_setname_np(x86emu_t* emu, void* t, void* n)
|
||||
{
|
||||
library_t* lib = GetLib(emu->context->maplib, "libpthread.so.0");
|
||||
library_t* lib = GetLib(emu->context->maplib, libpthreadName);
|
||||
if(!lib) return 0;
|
||||
void* f = dlsym(lib->priv.w.lib, "pthread_setname_np");
|
||||
if(f)
|
||||
@@ -33,7 +44,7 @@ EXPORT int my_pthread_setname_np(x86emu_t* emu, void* t, void* n)
|
||||
}
|
||||
EXPORT int my_pthread_getname_np(x86emu_t* emu, void* t, void* n, uint32_t s)
|
||||
{
|
||||
library_t* lib = GetLib(emu->context->maplib, "libpthread.so.0");
|
||||
library_t* lib = GetLib(emu->context->maplib, libpthreadName);
|
||||
if(!lib) return 0;
|
||||
void* f = dlsym(lib->priv.w.lib, "pthread_getname_np");
|
||||
if(f)
|
||||
@@ -43,7 +54,6 @@ EXPORT int my_pthread_getname_np(x86emu_t* emu, void* t, void* n, uint32_t s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* libpthreadName = "libpthread.so.0";
|
||||
#define LIBNAME libpthread
|
||||
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
@@ -47,17 +47,17 @@ GO(pthread_cancel, iFi)
|
||||
// _pthread_cleanup_push_defer
|
||||
// __pthread_cleanup_routine
|
||||
GO(pthread_condattr_destroy, iFp)
|
||||
// pthread_condattr_getclock
|
||||
GO(pthread_condattr_getclock, iFpp)
|
||||
// pthread_condattr_getpshared
|
||||
GO(pthread_condattr_init, iFp)
|
||||
// pthread_condattr_setclock
|
||||
GO(pthread_condattr_setclock, iFpp)
|
||||
// pthread_condattr_setpshared
|
||||
GO(pthread_cond_broadcast, iFp)
|
||||
GO(pthread_cond_destroy, iFp)
|
||||
GO(pthread_cond_init, iFpp)
|
||||
GO(pthread_cond_signal, iFp)
|
||||
GO(pthread_cond_timedwait, iFppp)
|
||||
GO(pthread_cond_wait, iFpp)
|
||||
GOM(pthread_cond_broadcast, iFEp)
|
||||
GOM(pthread_cond_destroy, iFEp)
|
||||
GOM(pthread_cond_init, iFEpp)
|
||||
GOM(pthread_cond_signal, iFEp)
|
||||
GOM(pthread_cond_timedwait, iFEppp)
|
||||
GOM(pthread_cond_wait, iFEpp)
|
||||
GOM(pthread_create, iFEpppp)
|
||||
GO(pthread_detach, iFu)
|
||||
GO(pthread_equal, iFuu)
|
||||
@@ -75,7 +75,7 @@ GO(pthread_join, iFup)
|
||||
GOM(__pthread_key_create, iFEpp)
|
||||
GOM(pthread_key_create, iFEpp)
|
||||
GO(pthread_key_delete, iFu)
|
||||
// pthread_kill
|
||||
GO(pthread_kill, iFpi)
|
||||
// pthread_kill_other_threads_np
|
||||
GO(__pthread_mutexattr_destroy, iFp)
|
||||
GO(pthread_mutexattr_destroy, iFp)
|
||||
@@ -132,14 +132,14 @@ GOM(pthread_once, iFEpp)
|
||||
GO(pthread_self, uFv)
|
||||
// pthread_setaffinity_np
|
||||
// pthread_setcancelstate
|
||||
// pthread_setcanceltype
|
||||
GO(pthread_setcanceltype, iFip)
|
||||
// pthread_setconcurrency
|
||||
GOM(pthread_setname_np, iFEpp) // not present on the Pandora
|
||||
GO(pthread_setschedparam, iFpip)
|
||||
// pthread_setschedprio
|
||||
// __pthread_setspecific
|
||||
GO(pthread_setspecific, iFup)
|
||||
// pthread_sigmask
|
||||
GO(pthread_sigmask, iFipp)
|
||||
// pthread_spin_destroy
|
||||
// pthread_spin_init
|
||||
// pthread_spin_lock
|
||||
|
||||
@@ -14,6 +14,7 @@ typedef struct wrappedlib_s {
|
||||
wrappedlib_init_t init;
|
||||
wrappedlib_fini_t fini;
|
||||
wrappedlib_get_t get;
|
||||
wrappedlib_get_t getnoweak;
|
||||
} wrappedlib_t;
|
||||
|
||||
#endif //__WRAPPEDLIB_H__
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* libvorbisName = "libvorbis.so.0";
|
||||
#define LIBNAME libvorbis
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error meh!
|
||||
#endif
|
||||
|
||||
//GO(_book_maptype1_quantvals,
|
||||
//GO(_book_unquantize,
|
||||
//GO(drft_backward,
|
||||
//GO(drft_clear,
|
||||
//GO(drft_forward,
|
||||
//GO(drft_init,
|
||||
//GO(_float32_pack,
|
||||
//GO(_float32_unpack,
|
||||
//GO(floor1_encode,
|
||||
//GO(floor1_fit,
|
||||
//GO(floor1_interpolate_fit,
|
||||
//GO(_make_words,
|
||||
//GO(mdct_backward,
|
||||
//GO(mdct_clear,
|
||||
//GO(mdct_forward,
|
||||
//GO(mdct_init,
|
||||
//GO(ov_ilog,
|
||||
//GO(res0_free_info,
|
||||
//GO(res0_free_look,
|
||||
//GO(res0_inverse,
|
||||
//GO(res0_look,
|
||||
//GO(res0_pack,
|
||||
//GO(res0_unpack,
|
||||
//GO(res1_class,
|
||||
//GO(res1_forward,
|
||||
//GO(res1_inverse,
|
||||
//GO(res2_class,
|
||||
//GO(res2_forward,
|
||||
//GO(res2_inverse,
|
||||
//GO(_ve_envelope_clear,
|
||||
//GO(_ve_envelope_init,
|
||||
//GO(_ve_envelope_mark,
|
||||
//GO(_ve_envelope_search,
|
||||
//GO(_ve_envelope_shift,
|
||||
//GO(_vi_gpsy_free,
|
||||
//GO(_vi_psy_free,
|
||||
//GO(vorbis_analysis,
|
||||
//GO(vorbis_analysis_blockout,
|
||||
//GO(vorbis_analysis_buffer,
|
||||
//GO(vorbis_analysis_headerout,
|
||||
//GO(vorbis_analysis_init,
|
||||
//GO(vorbis_analysis_wrote,
|
||||
//GO(_vorbis_apply_window,
|
||||
//GO(vorbis_bitrate_addblock,
|
||||
//GO(vorbis_bitrate_clear,
|
||||
//GO(vorbis_bitrate_flushpacket,
|
||||
//GO(vorbis_bitrate_init,
|
||||
//GO(vorbis_bitrate_managed,
|
||||
//GO(_vorbis_block_alloc,
|
||||
GO(vorbis_block_clear, iFp)
|
||||
GO(vorbis_block_init, iFpp)
|
||||
//GO(_vorbis_block_ripcord,
|
||||
//GO(vorbis_book_clear,
|
||||
//GO(vorbis_book_codelen,
|
||||
//GO(vorbis_book_codeword,
|
||||
//GO(vorbis_book_decode,
|
||||
//GO(vorbis_book_decodev_add,
|
||||
//GO(vorbis_book_decodevs_add,
|
||||
//GO(vorbis_book_decodev_set,
|
||||
//GO(vorbis_book_decodevv_add,
|
||||
//GO(vorbis_book_encode,
|
||||
//GO(vorbis_book_init_decode,
|
||||
//GO(vorbis_book_init_encode,
|
||||
//GO(vorbis_comment_add,
|
||||
//GO(vorbis_comment_add_tag,
|
||||
GO(vorbis_comment_clear, vFp)
|
||||
//GO(vorbis_commentheader_out,
|
||||
GO(vorbis_comment_init, vFp)
|
||||
//GO(vorbis_comment_query,
|
||||
//GO(vorbis_comment_query_count,
|
||||
GO(vorbis_dsp_clear, vFp)
|
||||
//GO(vorbis_granule_time,
|
||||
//GO(vorbis_info_blocksize,
|
||||
GO(vorbis_info_clear, vFp)
|
||||
GO(vorbis_info_init, vFp)
|
||||
//GO(vorbis_lpc_from_data,
|
||||
//GO(vorbis_lpc_predict,
|
||||
//GO(vorbis_lpc_to_lsp,
|
||||
//GO(vorbis_lsp_to_curve,
|
||||
//GO(vorbis_packet_blocksize,
|
||||
//GO(vorbis_staticbook_destroy,
|
||||
//GO(vorbis_staticbook_pack,
|
||||
//GO(vorbis_staticbook_unpack,
|
||||
GO(vorbis_synthesis, iFpp)
|
||||
GO(vorbis_synthesis_blockin, iFpp)
|
||||
//GO(vorbis_synthesis_halfrate,
|
||||
//GO(vorbis_synthesis_halfrate_p,
|
||||
GO(vorbis_synthesis_headerin, iFppp)
|
||||
//GO(vorbis_synthesis_idheader,
|
||||
GO(vorbis_synthesis_init, iFpp)
|
||||
//GO(vorbis_synthesis_lapout,
|
||||
GO(vorbis_synthesis_pcmout, iFpp)
|
||||
GO(vorbis_synthesis_read, iFpi)
|
||||
//GO(vorbis_synthesis_restart,
|
||||
//GO(vorbis_synthesis_trackonly,
|
||||
//GO(vorbis_version_string,
|
||||
//GO(vorbis_window,
|
||||
//GO(_vorbis_window_get,
|
||||
//GO(_vp_ampmax_decay,
|
||||
//GO(_vp_couple_quantize_normalize,
|
||||
//GO(_vp_global_free,
|
||||
//GO(_vp_global_look,
|
||||
//GO(_vp_noisemask,
|
||||
//GO(_vp_offset_and_mix,
|
||||
//GO(_vp_psy_clear,
|
||||
//GO(_vp_psy_init,
|
||||
//GO(_vp_tonemask,
|
||||
+209
-11
@@ -21,7 +21,22 @@ const char* libx11Name = "libX11.so.6";
|
||||
#define LIBNAME libx11
|
||||
|
||||
typedef int (*XErrorHandler)(void *, void *);
|
||||
XErrorHandler my_XSetErrorHandler(x86emu_t* t, XErrorHandler handler);
|
||||
void* my_XSetErrorHandler(x86emu_t* t, XErrorHandler handler);
|
||||
typedef int (*XIOErrorHandler)(void *);
|
||||
void* my_XSetIOErrorHandler(x86emu_t* t, XIOErrorHandler handler);
|
||||
|
||||
EXPORT void* my_XESetWireToEvent(x86emu_t* emu, void* display, int32_t event_number, void* proc)
|
||||
{
|
||||
printf_log(LOG_NONE, "BOX86: Error, called unimplemented XESetWireToEvent(%p, %d, %p)\n", display, event_number, proc);
|
||||
emu->quit = 1;
|
||||
return NULL;
|
||||
}
|
||||
EXPORT void* my_XESetEventToWire(x86emu_t* emu, void* display, int32_t event_number, void* proc)
|
||||
{
|
||||
printf_log(LOG_NONE, "BOX86: Error, called unimplemented XESetEventToWire(%p, %d, %p)\n", display, event_number, proc);
|
||||
emu->quit = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef int(*EventHandler) (void*,void*,void*);
|
||||
int32_t my_XIfEvent(x86emu_t* emu, void* d,void* ev, EventHandler h, void* arg);
|
||||
@@ -51,7 +66,7 @@ typedef struct ximage_s {
|
||||
int32_t (*destroy_image) (void*);
|
||||
uint32_t (*get_pixel) (void*, int32_t, int32_t);
|
||||
int32_t (*put_pixel) (void*, int32_t, int32_t, uint32_t);
|
||||
void*(*sub_image) (void*, int32_t, int32_t, uint32_t, uint32_t);
|
||||
void*(*sub_image) (void*, int32_t, int32_t, uint32_t, uint32_t); //sub_image return a new XImage that need bridging => custom wrapper
|
||||
int32_t (*add_pixel) (void*, int32_t);
|
||||
} ximage_t;
|
||||
|
||||
@@ -75,19 +90,30 @@ typedef struct _XImage {
|
||||
} XImage;
|
||||
|
||||
typedef void* (*pFp_t)(void*);
|
||||
typedef void* (*pFpip_t)(void*, int32_t, void*);
|
||||
typedef int32_t (*iFp_t)(void*);
|
||||
typedef int32_t (*iFpi_t)(void*, int32_t);
|
||||
typedef int32_t (*iFpppp_t)(void*, void*, void*, void*);
|
||||
typedef uint32_t (*uFpii_t)(void*, int32_t, int32_t);
|
||||
typedef int32_t (*iFpiiu_t)(void*, int32_t, int32_t, uint32_t);
|
||||
typedef void* (*pFpiiuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t);
|
||||
typedef void* (*pFppiiuuui_t)(void*, void*, int32_t, int32_t, uint32_t, uint32_t, uint32_t, int32_t);
|
||||
typedef void* (*pFppuiipuuii_t)(void*, void*, uint32_t, int32_t, int32_t, void*, uint32_t, uint32_t, int32_t, int32_t);
|
||||
typedef void* (*pFppiiuuuipii_t)(void*, void*, int32_t, int32_t, uint32_t, uint32_t, uint32_t, int32_t, void*, int32_t, int32_t);
|
||||
typedef int32_t (*iFppppiiiiuu_t)(void*, void*, void*, void*, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t);
|
||||
|
||||
typedef struct x11_my_s {
|
||||
// functions
|
||||
pFp_t XSetErrorHandler;
|
||||
pFp_t XSetIOErrorHandler;
|
||||
pFpip_t XESetError;
|
||||
iFpppp_t XIfEvent;
|
||||
iFpppp_t XCheckIfEvent;
|
||||
iFpppp_t XPeekIfEvent;
|
||||
pFppuiipuuii_t XCreateImage;
|
||||
pFppiiuuui_t XGetImage;
|
||||
iFppppiiiiuu_t XPutImage;
|
||||
pFppiiuuuipii_t XGetSubImage;
|
||||
} x11_my_t;
|
||||
|
||||
void* getX11My(library_t* lib)
|
||||
@@ -95,8 +121,15 @@ void* getX11My(library_t* lib)
|
||||
x11_my_t* my = (x11_my_t*)calloc(1, sizeof(x11_my_t));
|
||||
#define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
|
||||
GO(XSetErrorHandler, pFp_t)
|
||||
GO(XSetIOErrorHandler, pFp_t)
|
||||
GO(XESetError, pFpip_t)
|
||||
GO(XIfEvent, iFpppp_t)
|
||||
GO(XCheckIfEvent, iFpppp_t)
|
||||
GO(XPeekIfEvent, iFpppp_t)
|
||||
GO(XCreateImage, pFppuiipuuii_t)
|
||||
GO(XGetImage, pFppiiuuui_t)
|
||||
GO(XPutImage, iFppppiiiiuu_t)
|
||||
GO(XGetSubImage, pFppiiuuuipii_t)
|
||||
#undef GO
|
||||
return my;
|
||||
}
|
||||
@@ -110,6 +143,18 @@ void freeX11My(void* lib)
|
||||
void* my_XCreateImage(x86emu_t* emu, void* disp, void* vis, uint32_t depth, int32_t fmt, int32_t off
|
||||
, void* data, uint32_t w, uint32_t h, int32_t pad, int32_t bpl);
|
||||
|
||||
void* my_XGetImage(x86emu_t* emu, void* disp, void* drawable, int32_t x, int32_t y
|
||||
, uint32_t w, uint32_t h, uint32_t plane, int32_t fmt);
|
||||
|
||||
int32_t my_XPutImage(x86emu_t* emu, void* disp, void* drawable, void* gc, void* image
|
||||
, int32_t src_x, int32_t src_y, int32_t dst_x, int32_t dst_y
|
||||
, uint32_t w, uint32_t h);
|
||||
|
||||
void* my_XGetSubImage(x86emu_t* emu, void* disp, void* drawable
|
||||
, int32_t x, int32_t y
|
||||
, uint32_t w, uint32_t h, uint32_t plane, int32_t fmt
|
||||
, void* image, int32_t dst_x, int32_t dst_y);
|
||||
|
||||
#define CUSTOM_INIT \
|
||||
lib->priv.w.p2 = getX11My(lib);
|
||||
|
||||
@@ -120,6 +165,8 @@ void* my_XCreateImage(x86emu_t* emu, void* disp, void* vis, uint32_t depth, int3
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
static x86emu_t *errorhandlercb = NULL;
|
||||
static x86emu_t *ioerrorhandlercb = NULL;
|
||||
static x86emu_t *exterrorhandlercb = NULL; // should be set per screen and per extension!
|
||||
static int my_errorhandle_callback(void* display, void* errorevent)
|
||||
{
|
||||
if(!errorhandlercb)
|
||||
@@ -128,18 +175,89 @@ static int my_errorhandle_callback(void* display, void* errorevent)
|
||||
SetCallbackArg(errorhandlercb, 1, errorevent);
|
||||
return (int)RunCallback(errorhandlercb);
|
||||
}
|
||||
static int my_ioerrorhandle_callback(void* display)
|
||||
{
|
||||
if(!ioerrorhandlercb)
|
||||
return 0;
|
||||
SetCallbackArg(ioerrorhandlercb, 0, display);
|
||||
return (int)RunCallback(ioerrorhandlercb);
|
||||
}
|
||||
static int my_exterrorhandle_callback(void* display, void* err, void* codes, int* ret_code)
|
||||
{
|
||||
if(!exterrorhandlercb)
|
||||
return 0;
|
||||
SetCallbackArg(exterrorhandlercb, 0, display);
|
||||
SetCallbackArg(exterrorhandlercb, 1, err);
|
||||
SetCallbackArg(exterrorhandlercb, 2, codes);
|
||||
SetCallbackArg(exterrorhandlercb, 3, ret_code);
|
||||
return (int)RunCallback(exterrorhandlercb);
|
||||
}
|
||||
|
||||
EXPORT XErrorHandler my_XSetErrorHandler(x86emu_t* emu, XErrorHandler handler)
|
||||
EXPORT void* my_XSetErrorHandler(x86emu_t* emu, XErrorHandler handler)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
if(errorhandlercb) { FreeCallback(errorhandlercb); errorhandlercb=NULL;}
|
||||
x86emu_t *cb = NULL;
|
||||
if (handler!=NULL)
|
||||
void* ret;
|
||||
XErrorHandler old = NULL;
|
||||
if(GetNativeFnc((uintptr_t)handler)) {
|
||||
old = (XErrorHandler)my->XSetErrorHandler(GetNativeFnc((uintptr_t)handler));
|
||||
} else {
|
||||
cb = AddCallback(emu, (uintptr_t)handler, 2, NULL, NULL, NULL, NULL);
|
||||
old = (XErrorHandler)my->XSetErrorHandler(cb);
|
||||
}
|
||||
if(CheckBridged(lib->priv.w.bridge, old))
|
||||
ret = (void*)CheckBridged(lib->priv.w.bridge, old);
|
||||
else
|
||||
ret = (void*)AddBridge(lib->priv.w.bridge, iFpp, old, 0);
|
||||
if(errorhandlercb) FreeCallback(errorhandlercb);
|
||||
errorhandlercb = cb;
|
||||
XErrorHandler old = (XErrorHandler)my->XSetErrorHandler(cb);
|
||||
return (old)?((XErrorHandler)AddBridge(lib->priv.w.bridge, iFpp, old)):NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT void* my_XSetIOErrorHandler(x86emu_t* emu, XIOErrorHandler handler)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
if(ioerrorhandlercb) { FreeCallback(ioerrorhandlercb); ioerrorhandlercb=NULL;}
|
||||
x86emu_t *cb = NULL;
|
||||
void* ret;
|
||||
XIOErrorHandler old = NULL;
|
||||
if(GetNativeFnc((uintptr_t)handler)) {
|
||||
old = (XIOErrorHandler)my->XSetIOErrorHandler(GetNativeFnc((uintptr_t)handler));
|
||||
} else {
|
||||
cb = AddCallback(emu, (uintptr_t)handler, 2, NULL, NULL, NULL, NULL);
|
||||
old = (XIOErrorHandler)my->XSetIOErrorHandler(cb);
|
||||
}
|
||||
if(CheckBridged(lib->priv.w.bridge, old))
|
||||
ret = (void*)CheckBridged(lib->priv.w.bridge, old);
|
||||
else
|
||||
ret = (void*)AddBridge(lib->priv.w.bridge, iFp, old, 0);
|
||||
if(ioerrorhandlercb) FreeCallback(ioerrorhandlercb);
|
||||
ioerrorhandlercb = cb;
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT void* my_XESetError(x86emu_t* emu, void* display, int32_t extension, void* handler)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
x86emu_t *cb = NULL;
|
||||
void* ret;
|
||||
void* old = NULL;
|
||||
if(GetNativeFnc((uintptr_t)handler)) {
|
||||
old = my->XESetError(display, extension, GetNativeFnc((uintptr_t)handler));
|
||||
} else {
|
||||
cb = AddCallback(emu, (uintptr_t)handler, 4, NULL, NULL, NULL, NULL);
|
||||
old = my->XESetError(display, extension, cb);
|
||||
}
|
||||
if(CheckBridged(lib->priv.w.bridge, old))
|
||||
ret = (void*)CheckBridged(lib->priv.w.bridge, old);
|
||||
else
|
||||
ret = (void*)AddBridge(lib->priv.w.bridge, iFpip, old, 0);
|
||||
if(exterrorhandlercb) FreeCallback(exterrorhandlercb);
|
||||
exterrorhandlercb = cb;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t xifevent_callback(void* dpy, void *event, void* arg)
|
||||
@@ -155,19 +273,45 @@ EXPORT int32_t my_XIfEvent(x86emu_t* emu, void* d,void* ev, EventHandler h, void
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
x86emu_t *cb = NULL;
|
||||
cb = AddCallback(emu, (uintptr_t)h, 3, NULL, NULL, arg, NULL);
|
||||
cb = AddSharedCallback(emu, (uintptr_t)h, 3, NULL, NULL, arg, NULL);
|
||||
int32_t ret = my->XIfEvent(d, ev, xifevent_callback, (void*)cb);
|
||||
FreeCallback(cb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT int32_t my_XCheckIfEvent(x86emu_t* emu, void* d,void* ev, EventHandler h, void* arg)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
x86emu_t *cb = NULL;
|
||||
cb = AddSharedCallback(emu, (uintptr_t)h, 3, NULL, NULL, arg, NULL);
|
||||
int32_t ret = my->XCheckIfEvent(d, ev, xifevent_callback, (void*)cb);
|
||||
FreeCallback(cb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT int32_t my_XPeekIfEvent(x86emu_t* emu, void* d,void* ev, EventHandler h, void* arg)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
x86emu_t *cb = NULL;
|
||||
cb = AddSharedCallback(emu, (uintptr_t)h, 3, NULL, NULL, arg, NULL);
|
||||
int32_t ret = my->XPeekIfEvent(d, ev, xifevent_callback, (void*)cb);
|
||||
FreeCallback(cb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sub_image_wrapper(x86emu_t *emu, uintptr_t fnc);
|
||||
typedef void* (*sub_image_wrapper_t)(void*, int32_t, int32_t, uint32_t, uint32_t);
|
||||
|
||||
|
||||
void BridgeImageFunc(x86emu_t *emu, XImage *img)
|
||||
{
|
||||
bridge_t* system = emu->context->system;
|
||||
|
||||
#define GO(A, W) \
|
||||
fnc = CheckBridged(system, img->f.A); \
|
||||
if(!fnc) fnc = AddBridge(system, W, img->f.A); \
|
||||
if(!fnc) fnc = AddBridge(system, W, img->f.A, 0); \
|
||||
img->f.A = (W##_t)fnc;
|
||||
|
||||
uintptr_t fnc;
|
||||
@@ -176,7 +320,7 @@ void BridgeImageFunc(x86emu_t *emu, XImage *img)
|
||||
GO(destroy_image, iFp)
|
||||
GO(get_pixel, uFpii)
|
||||
GO(put_pixel, iFpiiu)
|
||||
GO(sub_image, pFpiiuu)
|
||||
GO(sub_image, sub_image_wrapper)
|
||||
GO(add_pixel, iFpi)
|
||||
#undef GO
|
||||
}
|
||||
@@ -196,11 +340,20 @@ void UnbridgeImageFunc(x86emu_t *emu, XImage *img)
|
||||
GO(destroy_image, iFp)
|
||||
GO(get_pixel, uFpii)
|
||||
GO(put_pixel, iFpiiu)
|
||||
GO(sub_image, pFpiiuu)
|
||||
GO(sub_image, sub_image_wrapper)
|
||||
GO(add_pixel, iFpi)
|
||||
#undef GO
|
||||
}
|
||||
|
||||
void sub_image_wrapper(x86emu_t *emu, uintptr_t fnc)
|
||||
{
|
||||
pFpiiuu_t fn = (pFpiiuu_t)fnc;
|
||||
void* img = fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20));
|
||||
BridgeImageFunc(emu, (XImage*)img);
|
||||
R_EAX=(uintptr_t)img;
|
||||
}
|
||||
|
||||
|
||||
EXPORT void* my_XCreateImage(x86emu_t* emu, void* disp, void* vis, uint32_t depth, int32_t fmt, int32_t off
|
||||
, void* data, uint32_t w, uint32_t h, int32_t pad, int32_t bpl)
|
||||
{
|
||||
@@ -214,3 +367,48 @@ EXPORT void* my_XCreateImage(x86emu_t* emu, void* disp, void* vis, uint32_t dept
|
||||
BridgeImageFunc(emu, img);
|
||||
return img;
|
||||
}
|
||||
|
||||
EXPORT void* my_XGetImage(x86emu_t* emu, void* disp, void* drawable, int32_t x, int32_t y
|
||||
, uint32_t w, uint32_t h, uint32_t plane, int32_t fmt)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
|
||||
XImage *img = my->XGetImage(disp, drawable, x, y, w, h, plane, fmt);
|
||||
if(!img)
|
||||
return img;
|
||||
// bridge all access functions...
|
||||
BridgeImageFunc(emu, img);
|
||||
return img;
|
||||
}
|
||||
|
||||
EXPORT int32_t my_XPutImage(x86emu_t* emu, void* disp, void* drawable, void* gc, void* image
|
||||
, int32_t src_x, int32_t src_y, int32_t dst_x, int32_t dst_y
|
||||
, uint32_t w, uint32_t h)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
|
||||
UnbridgeImageFunc(emu, (XImage*)image);
|
||||
int32_t r = my->XPutImage(disp, drawable, gc, image, src_x, src_y, dst_x, dst_y, w, h);
|
||||
// bridge all access functions...
|
||||
BridgeImageFunc(emu, (XImage*)image);
|
||||
return r;
|
||||
}
|
||||
|
||||
EXPORT void* my_XGetSubImage(x86emu_t* emu, void* disp, void* drawable
|
||||
, int32_t x, int32_t y
|
||||
, uint32_t w, uint32_t h, uint32_t plane, int32_t fmt
|
||||
, void* image, int32_t dst_x, int32_t dst_y)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libx11Name);
|
||||
x11_my_t *my = (x11_my_t*)lib->priv.w.p2;
|
||||
|
||||
UnbridgeImageFunc(emu, (XImage*)image);
|
||||
XImage *img = my->XGetSubImage(disp, drawable, x, y, w, h, plane, fmt, image, dst_x, dst_y);
|
||||
if(img)
|
||||
BridgeImageFunc(emu, img);
|
||||
|
||||
BridgeImageFunc(emu, (XImage*)image);
|
||||
return img;
|
||||
}
|
||||
+106
-106
@@ -26,7 +26,7 @@ DATAB(_qfree, 4)
|
||||
//GO(XAddPixel
|
||||
//GO(XAddToExtensionList
|
||||
//GO(XAddToSaveSet
|
||||
//GO(XAllocClassHint
|
||||
GO(XAllocClassHint, pFv)
|
||||
GO(XAllocColor, iFppp)
|
||||
//GO(XAllocColorCells
|
||||
//GO(XAllocColorPlanes
|
||||
@@ -42,25 +42,25 @@ GO(XAllocWMHints, pFv)
|
||||
//GO(XAllowEvents
|
||||
//GO(XAllPlanes
|
||||
// _XAsyncErrorHandler
|
||||
//GO(XAutoRepeatOff
|
||||
//GO(XAutoRepeatOn
|
||||
GO(XAutoRepeatOff, iFp)
|
||||
GO(XAutoRepeatOn, iFp)
|
||||
//GO(XBaseFontNameListOfFontSet
|
||||
//GO(XBell
|
||||
GO(XBell, iFpi)
|
||||
//GO(XBitmapBitOrder
|
||||
//GO(XBitmapPad
|
||||
//GO(XBitmapUnit
|
||||
//GO(XBlackPixel
|
||||
GO(XBlackPixel, uFpi)
|
||||
//GO(XBlackPixelOfScreen
|
||||
//GO(XCellsOfScreen
|
||||
//GO(XChangeActivePointerGrab
|
||||
//GO(XChangeGC
|
||||
//GO(XChangeKeyboardControl
|
||||
GO(XChangeKeyboardControl, iFpup)
|
||||
//GO(XChangeKeyboardMapping
|
||||
//GO(XChangePointerControl
|
||||
GO(XChangePointerControl, iFpiiiii)
|
||||
GO(XChangeProperty, iFppppiipi)
|
||||
//GO(XChangeSaveSet
|
||||
//GO(XChangeWindowAttributes
|
||||
//GO(XCheckIfEvent
|
||||
GOM(XCheckIfEvent, iFEpppp)
|
||||
GO(XCheckMaskEvent, iFpup)
|
||||
GO(XCheckTypedEvent, iFpip)
|
||||
GO(XCheckTypedWindowEvent, iFppip)
|
||||
@@ -70,7 +70,7 @@ GO(XCheckWindowEvent, iFppup)
|
||||
//GO(XCirculateSubwindowsUp
|
||||
GO(XClearArea, iFppiiuui)
|
||||
GO(XClearWindow, iFpp)
|
||||
//GO(XClipBox
|
||||
GO(XClipBox, iFpp)
|
||||
GO(XCloseDisplay, iFp)
|
||||
GO(XCloseIM, iFu)
|
||||
// _XCloseLC
|
||||
@@ -212,20 +212,20 @@ GO(XConfigureWindow, iFppup)
|
||||
//GO(XContextDependentDrawing
|
||||
//GO(XContextualDrawing
|
||||
//GO(XConvertCase
|
||||
//GO(XConvertSelection
|
||||
//GO(XCopyArea
|
||||
GO(XConvertSelection, iFpppppu)
|
||||
GO(XCopyArea, iFppppiiuuii)
|
||||
GO(XCopyColormapAndFree, uFpu)
|
||||
// _XCopyEventCookie
|
||||
//GO(XCopyGC
|
||||
//GO(XCopyPlane
|
||||
GO(XCopyPlane, iFppppiiuuiiu)
|
||||
// _XCopyToArg
|
||||
GO(XCreateBitmapFromData, pFpppuu)
|
||||
GO(XCreateColormap, uFpppi)
|
||||
//GO(XCreateFontCursor
|
||||
//GO(XCreateFontSet
|
||||
GO(XCreateFontCursor, pFpu)
|
||||
GO(XCreateFontSet, pFppppp)
|
||||
GO(XCreateGC, pFppup)
|
||||
//GO(XCreateGlyphCursor
|
||||
GO(XCreateIC, uFpppppp) // use vararg, so putting an arbitrary number of args
|
||||
GO(XCreateIC, uFpppppppppppppppp) // use vararg, so putting an arbitrary number of args, also can have Callbacks ?! Allegro have 7 args and no callback
|
||||
GOM(XCreateImage, pFEppuiipuuii)
|
||||
GO(dummy_XCreateImage, pFppuiipuuii) // to have the wrapper
|
||||
DATAB(_XCreateMutex_fn, 4)
|
||||
@@ -233,7 +233,7 @@ DATAB(_XCreateMutex_fn, 4)
|
||||
GO(XCreatePixmap, pFppuuu)
|
||||
GO(XCreatePixmapCursor, pFpppppuu)
|
||||
GO(XCreatePixmapFromBitmapData, pFpppuuuuu)
|
||||
//GO(XCreateRegion
|
||||
GO(XCreateRegion, pFv)
|
||||
GO(XCreateSimpleWindow, pFppiiuuuuu)
|
||||
GO(XCreateWindow, pFppiiuuuiupup)
|
||||
DATAB(_Xdebug, 4)
|
||||
@@ -244,10 +244,10 @@ GO(XDefaultDepth, iFpi)
|
||||
// _XDefaultError
|
||||
//GO(XDefaultGC
|
||||
//GO(XDefaultGCOfScreen
|
||||
// _XDefaultIOError
|
||||
GO(_XDefaultIOError, iFp)
|
||||
// _XDefaultOpenIM
|
||||
// _XDefaultOpenOM
|
||||
//GO(XDefaultRootWindow
|
||||
GO(XDefaultRootWindow, pFp)
|
||||
GO(XDefaultScreen, pFp)
|
||||
//GO(XDefaultScreenOfDisplay
|
||||
//GO(XDefaultString
|
||||
@@ -263,48 +263,48 @@ GO(XDeleteProperty, iFppp)
|
||||
GO(XDestroyIC, vFu)
|
||||
//GOM(XDestroyImage, iFEp) //need to unbridge
|
||||
//GO(XDestroyOC
|
||||
//GO(XDestroyRegion
|
||||
GO(XDestroyRegion, iFp)
|
||||
GO(XDestroySubwindows, iFpp)
|
||||
GO(XDestroyWindow, iFpp)
|
||||
//GO(XDirectionalDependentDrawing
|
||||
//GO(XDisableAccessControl
|
||||
//GO(XDisplayCells
|
||||
GO(XDisplayHeight, iFpi)
|
||||
//GO(XDisplayHeightMM
|
||||
//GO(XDisplayKeycodes
|
||||
GO(XDisplayHeightMM, iFpi)
|
||||
GO(XDisplayKeycodes, iFppp)
|
||||
//GO(XDisplayMotionBufferSize
|
||||
//GO(XDisplayName
|
||||
GO(XDisplayName, pFp)
|
||||
//GO(XDisplayOfIM
|
||||
//GO(XDisplayOfOM
|
||||
//GO(XDisplayOfScreen
|
||||
//GO(XDisplayPlanes
|
||||
//GO(XDisplayString
|
||||
GO(XDisplayString, pFp)
|
||||
GO(XDisplayWidth, iFpi)
|
||||
//GO(XDisplayWidthMM
|
||||
GO(XDisplayWidthMM, iFpi)
|
||||
//GO(XDoesBackingStore
|
||||
//GO(XDoesSaveUnders
|
||||
//GO(XDrawArc
|
||||
GO(XDrawArc, iFpppiiuuii)
|
||||
//GO(XDrawArcs
|
||||
//GO(XDrawImageString
|
||||
//GO(XDrawImageString16
|
||||
//GO(XDrawLine
|
||||
//GO(XDrawLines
|
||||
//GO(XDrawPoint
|
||||
GO(XDrawLine, iFpppiiii)
|
||||
GO(XDrawLines, iFppppii)
|
||||
GO(XDrawPoint, iFpppii)
|
||||
//GO(XDrawPoints
|
||||
//GO(XDrawRectangle
|
||||
//GO(XDrawRectangles
|
||||
//GO(XDrawSegments
|
||||
GO(XDrawRectangle, iFpppiiuu)
|
||||
GO(XDrawRectangles, iFppppi)
|
||||
GO(XDrawSegments, iFppppi)
|
||||
GO(XDrawString, iFpppiipi)
|
||||
GO(XDrawString16, iFpppiipi)
|
||||
//GO(XDrawText
|
||||
//GO(XDrawText16
|
||||
// _XEatData
|
||||
// _XEatDataWords
|
||||
GO(_XEatData, vFpu)
|
||||
GO(_XEatDataWords, vFpu)
|
||||
//GO(XEHeadOfExtensionList
|
||||
//GO(XEmptyRegion
|
||||
GO(XEmptyRegion, iFp)
|
||||
//GO(XEnableAccessControl
|
||||
// _XEnq
|
||||
//GO(XEqualRegion
|
||||
GO(XEqualRegion, iFpp)
|
||||
// _XError
|
||||
DATAB(_XErrorFunction, 4)
|
||||
//GO(XESetBeforeFlush
|
||||
@@ -313,15 +313,15 @@ DATAB(_XErrorFunction, 4)
|
||||
//GO(XESetCopyGC
|
||||
//GO(XESetCreateFont
|
||||
//GO(XESetCreateGC
|
||||
//GO(XESetError
|
||||
GOM(XESetError, pFEpip)
|
||||
//GO(XESetErrorString
|
||||
//GO(XESetEventToWire
|
||||
GOM(XESetEventToWire, pFEpip)
|
||||
//GO(XESetFlushGC
|
||||
//GO(XESetFreeFont
|
||||
//GO(XESetFreeGC
|
||||
//GO(XESetPrintErrorValues
|
||||
//GO(XESetWireToError
|
||||
//GO(XESetWireToEvent
|
||||
GOM(XESetWireToEvent, pFEpip)
|
||||
//GO(XESetWireToEventCookie
|
||||
//GO(XEventMaskOfScreen
|
||||
GO(XEventsQueued, iFpi)
|
||||
@@ -336,18 +336,18 @@ GO(XEventsQueued, iFpi)
|
||||
//GO(XFetchBytes
|
||||
// _XFetchEventCookie
|
||||
//GO(XFetchName
|
||||
//GO(XFillArc
|
||||
GO(XFillArc, iFpppiiuuii)
|
||||
//GO(XFillArcs
|
||||
//GO(XFillPolygon
|
||||
GO(XFillPolygon, iFppppiii)
|
||||
GO(XFillRectangle, iFpppiiuu)
|
||||
GO(XFillRectangles, iFppppi)
|
||||
GO(XFilterEvent, iFpp)
|
||||
//GO(XFindContext
|
||||
//GO(XFindOnExtensionList
|
||||
GO(XFlush, iFp)
|
||||
// _XFlush
|
||||
GO(_XFlush, vFp)
|
||||
GO(XFlushGC, vFpp)
|
||||
// _XFlushGCCache
|
||||
GO(_XFlushGCCache, vFpp)
|
||||
//GO(XFontsOfFontSet
|
||||
GO(XForceScreenSaver, iFpi)
|
||||
GO(XFree, iFp)
|
||||
@@ -365,12 +365,12 @@ GO(XFreeFont, iFpp)
|
||||
GO(XFreeFontInfo, iFppi)
|
||||
GO(XFreeFontNames, iFp)
|
||||
GO(XFreeFontPath, iFp)
|
||||
//GO(XFreeFontSet
|
||||
GO(XFreeFontSet, vFpp)
|
||||
GO(XFreeGC, iFpp)
|
||||
GO(XFreeModifiermap, iFp)
|
||||
DATAB(_XFreeMutex_fn, 4)
|
||||
GO(XFreePixmap, iFpp)
|
||||
//GO(XFreeStringList
|
||||
GO(XFreeStringList, vFp)
|
||||
// _XFreeTemp
|
||||
// _XFreeX11XCBStructure
|
||||
GO(XGContextFromGC, pFp)
|
||||
@@ -394,38 +394,38 @@ GO(XGetGeometry, iFppppppppp)
|
||||
GO(XGetIconName, iFppp)
|
||||
//GO(XGetIconSizes
|
||||
GO(XGetICValues, pFpppppp) // use varargs...
|
||||
GO(XGetImage, pFppiiuuui)
|
||||
//GO(XGetIMValues
|
||||
GOM(XGetImage, pFEppiiuuui) // return an XImage with callbacks that needs wrapping
|
||||
GO(XGetIMValues, pFppppppp) // use varargs
|
||||
GO(XGetInputFocus, iFppp)
|
||||
GO(XGetKeyboardControl, iFpp)
|
||||
//GO(XGetKeyboardMapping
|
||||
GO(XGetKeyboardMapping, pFppip)
|
||||
// _XGetLCValues
|
||||
//GO(XGetModifierMapping
|
||||
GO(XGetModifierMapping, pFp)
|
||||
//GO(XGetMotionEvents
|
||||
//GO(XGetNormalHints
|
||||
//GO(XGetOCValues
|
||||
//GO(XGetOMValues
|
||||
//GOM(XGetPixel, uFEpii) // need unbridging
|
||||
GO(dummy_XGetPixel, uFpii) // for the wrapper
|
||||
//GO(XGetPointerControl
|
||||
GO(XGetPointerControl, iFpppp)
|
||||
GO(XGetPointerMapping, iFppi)
|
||||
// _XGetRequest
|
||||
GO(_XGetRequest, pFpuu)
|
||||
//GO(XGetRGBColormaps
|
||||
// _XGetScanlinePad
|
||||
GO(XGetScreenSaver, iFppppp)
|
||||
//GO(XGetSelectionOwner
|
||||
GO(XGetSelectionOwner, pFpp)
|
||||
//GO(XGetSizeHints
|
||||
//GO(XGetStandardColormap
|
||||
GO(XGetSubImage, pFppiiuuuipii)
|
||||
GOM(XGetSubImage, pFEppiiuuuipii)
|
||||
//GO(XGetTextProperty
|
||||
GO(XGetTransientForHint, iFppp)
|
||||
//GO(XGetVisualInfo
|
||||
GO(XGetVisualInfo, pFpipp)
|
||||
GO(XGetWindowAttributes, iFppp)
|
||||
// _XGetWindowAttributes
|
||||
GO(XGetWindowProperty, iFpppiiipppppp)
|
||||
//GO(XGetWMClientMachine
|
||||
GO(XGetWMColormapWindows, iFpppp)
|
||||
//GO(XGetWMHints
|
||||
GO(XGetWMHints, pFpp)
|
||||
//GO(XGetWMIconName
|
||||
//GO(XGetWMName
|
||||
GO(XGetWMNormalHints, iFpppp)
|
||||
@@ -486,12 +486,12 @@ DATAB(_XInitDisplayLock_fn, 4)
|
||||
// _XInitKeysymDB
|
||||
GO(XInitThreads, uFv)
|
||||
//GO(XInsertModifiermapEntry
|
||||
//GO(XInstallColormap
|
||||
GO(XInstallColormap, iFpp)
|
||||
//GO(XInternalConnectionNumbers
|
||||
GO(XInternAtom, pFppi)
|
||||
GO(XInternAtoms, uFppiip)
|
||||
//GO(XIntersectRegion
|
||||
// _XIOError
|
||||
GO(XIntersectRegion, iFppp)
|
||||
GO(_XIOError, iFp)
|
||||
DATAB(_XIOErrorFunction, 4)
|
||||
// _XIsEventCookie
|
||||
//GO(XkbAddDeviceLedInfo
|
||||
@@ -611,7 +611,7 @@ DATA(_XkbGetAtomNameFunc, 4)
|
||||
//GO(XkbGetPerClientControls
|
||||
// _XkbGetReadBufferCountedString
|
||||
// _XkbGetReadBufferPtr
|
||||
//GO(XkbGetState
|
||||
GO(XkbGetState, iFpup)
|
||||
//GO(XkbGetUpdatedMap
|
||||
//GO(XkbGetVirtualMods
|
||||
//GO(XkbGetXlibControls
|
||||
@@ -751,11 +751,11 @@ DATA(_XlcPublicMethods, 4)
|
||||
// _Xlcwctomb
|
||||
//GO(XListDepths
|
||||
GO(XListExtensions, pFpp)
|
||||
//GO(XListFonts
|
||||
//GO(XListFontsWithInfo
|
||||
GO(XListFonts, pFppip)
|
||||
GO(XListFontsWithInfo, pFppipp)
|
||||
//GO(XListHosts
|
||||
//GO(XListInstalledColormaps
|
||||
//GO(XListPixmapFormats
|
||||
GO(XListPixmapFormats, pFpp)
|
||||
GO(XListProperties, pFppp)
|
||||
GO(XLoadFont, pFpp)
|
||||
GO(XLoadQueryFont, pFpp)
|
||||
@@ -775,9 +775,9 @@ GO(XMapRaised, iFpp)
|
||||
GO(XMapSubwindows, iFpp)
|
||||
GO(XMapWindow, iFpp)
|
||||
GO(XMaskEvent, iFpup)
|
||||
//GO(XMatchVisualInfo
|
||||
GO(XMatchVisualInfo, iFpiiip)
|
||||
//GO(XMaxCmapsOfScreen
|
||||
//GO(XMaxRequestSize
|
||||
GO(XMaxRequestSize, iFp)
|
||||
//GO(XmbDrawImageString
|
||||
//GO(XmbDrawString
|
||||
//GO(XmbDrawText
|
||||
@@ -804,7 +804,7 @@ GO(XNextEvent, iFpp)
|
||||
//GO(XNoOp
|
||||
// _XNoticeCreateBitmap
|
||||
// _XNoticePutBitmap
|
||||
//GO(XOffsetRegion
|
||||
GO(XOffsetRegion, iFpii)
|
||||
//GO(XOMOfOC
|
||||
GO(XOpenDisplay, pFp)
|
||||
GO(XOpenIM, uFpppp)
|
||||
@@ -814,11 +814,11 @@ GO(XOpenIM, uFpppp)
|
||||
GO(XParseColor, iFpppp)
|
||||
//GO(XParseGeometry
|
||||
GO(XPeekEvent, iFpp)
|
||||
//GO(XPeekIfEvent
|
||||
GOM(XPeekIfEvent, iFEpppp)
|
||||
GO(XPending, iFp)
|
||||
//GO(Xpermalloc
|
||||
//GO(XPlanesOfScreen
|
||||
//GO(XPointInRegion
|
||||
GO(XPointInRegion, iFpp)
|
||||
// _XPollfdCacheAdd
|
||||
// _XPollfdCacheDel
|
||||
// _XPollfdCacheInit
|
||||
@@ -830,7 +830,7 @@ GO(XPending, iFp)
|
||||
//GO(XProtocolVersion
|
||||
//GO(XPutBackEvent
|
||||
// _XPutBackEvent
|
||||
GO(XPutImage, iFppppiiiiuu)
|
||||
GOM(XPutImage, iFEppppiiiiuu)
|
||||
//GO(XPutPixel
|
||||
//GO(XQLength
|
||||
GO(XQueryBestCursor, iFppuupp)
|
||||
@@ -841,21 +841,21 @@ GO(XQueryColor, iFppp)
|
||||
GO(XQueryColors, iFpppi)
|
||||
GO(XQueryExtension, iFppppp)
|
||||
GO(XQueryFont, pFpp)
|
||||
//GO(XQueryKeymap
|
||||
GO(XQueryKeymap, iFpp)
|
||||
GO(XQueryPointer, iFppppppppp)
|
||||
GO(XQueryTextExtents, iFpppipppp)
|
||||
GO(XQueryTextExtents16, iFpppipppp)
|
||||
GO(XQueryTree, pFpppppp)
|
||||
//GO(XRaiseWindow
|
||||
// _XRead
|
||||
GO(XRaiseWindow, iFpp)
|
||||
GO(_XRead, iFppi)
|
||||
//GO(XReadBitmapFile
|
||||
//GO(XReadBitmapFileData
|
||||
// _XReadEvents
|
||||
// _XReadPad
|
||||
GO(_XReadPad, vFppi)
|
||||
GO(XRebindKeysym, iFpupipi)
|
||||
GO(XRecolorCursor, iFpppp)
|
||||
//GO(XReconfigureWMWindow
|
||||
//GO(XRectInRegion
|
||||
GO(XRectInRegion, iFpiiuu)
|
||||
GO(XRefreshKeyboardMapping, iFp)
|
||||
// _XRefreshKeyboardMapping
|
||||
// _XRegisterFilterByMask
|
||||
@@ -866,8 +866,8 @@ GO(XRefreshKeyboardMapping, iFp)
|
||||
//GO(XRemoveFromSaveSet
|
||||
//GO(XRemoveHost
|
||||
//GO(XRemoveHosts
|
||||
//GO(XReparentWindow
|
||||
// _XReply
|
||||
GO(XReparentWindow, iFpppii)
|
||||
GO(_XReply, iFppii)
|
||||
GO(XResetScreenSaver, iFp)
|
||||
GO(XResizeWindow, iFppuu)
|
||||
//GO(XResourceManagerString
|
||||
@@ -911,11 +911,11 @@ GO(XRotateWindowProperties, iFpppii)
|
||||
//GO(XSaveContext
|
||||
//GO(XScreenCount
|
||||
//GO(XScreenNumberOfScreen
|
||||
//GO(XScreenOfDisplay
|
||||
GO(XScreenOfDisplay, pFpi)
|
||||
// _XScreenOfWindow
|
||||
//GO(XScreenResourceString
|
||||
GO(XSelectInput, iFppi)
|
||||
// _XSend
|
||||
GO(_XSend, vFppi)
|
||||
GO(XSendEvent, uFppiip)
|
||||
//GO(XServerVendor
|
||||
GO(XSetAccessControl, iFpi)
|
||||
@@ -923,7 +923,7 @@ GO(XSetAccessControl, iFpi)
|
||||
GO(XSetArcMode, iFppi)
|
||||
//GO(XSetAuthorization
|
||||
GO(XSetBackground, iFppu)
|
||||
//GO(XSetClassHint
|
||||
GO(XSetClassHint, iFppp)
|
||||
GO(XSetClipMask, iFppp)
|
||||
GO(XSetClipOrigin, iFppii)
|
||||
GO(XSetClipRectangles, iFppiipii)
|
||||
@@ -940,15 +940,15 @@ GO(XSetForeground, iFppu)
|
||||
GO(XSetFunction, iFppi)
|
||||
GO(XSetGraphicsExposures, iFppu)
|
||||
GO(XSetICFocus, vFu)
|
||||
//GO(XSetIconName
|
||||
GO(XSetIconName, iFppp)
|
||||
//GO(XSetIconSizes
|
||||
GO(XSetICValues, pFpppppp) // use vargarg
|
||||
// _XSetImage
|
||||
//GO(XSetIMValues
|
||||
//GO(XSetInputFocus
|
||||
//GO(XSetIOErrorHandler
|
||||
// _XSetLastRequestRead
|
||||
//GO(XSetLineAttributes
|
||||
GO(XSetInputFocus, iFppii)
|
||||
GOM(XSetIOErrorHandler, pFEp)
|
||||
GO(_XSetLastRequestRead, uFpp)
|
||||
GO(XSetLineAttributes, iFppuiii)
|
||||
GO(XSetLocaleModifiers, pFp)
|
||||
//GO(XSetModifierMapping
|
||||
//GO(XSetNormalHints
|
||||
@@ -956,49 +956,49 @@ GO(XSetLocaleModifiers, pFp)
|
||||
//GO(XSetOMValues
|
||||
//GO(XSetPlaneMask
|
||||
//GO(XSetPointerMapping
|
||||
//GO(XSetRegion
|
||||
GO(XSetRegion, iFppp)
|
||||
//GO(XSetRGBColormaps
|
||||
//GO(XSetScreenSaver
|
||||
//GO(XSetSelectionOwner
|
||||
GO(XSetSelectionOwner, iFpppu)
|
||||
//GO(XSetSizeHints
|
||||
//GO(XSetStandardColormap
|
||||
GO(XSetStandardProperties, iFpppppppp)
|
||||
//GO(XSetState
|
||||
//GO(XSetStipple
|
||||
GO(XSetStipple, iFppp)
|
||||
GO(XSetSubwindowMode, iFppi)
|
||||
//GO(XSetTextProperty
|
||||
//GO(XSetTile
|
||||
GO(XSetTextProperty, vFpppp)
|
||||
GO(XSetTile, iFppp)
|
||||
GO(XSetTransientForHint, iFppp)
|
||||
//GO(XSetTSOrigin
|
||||
//GO(XSetWindowBackground
|
||||
//GO(XSetWindowBackgroundPixmap
|
||||
GO(XSetTSOrigin, iFppii)
|
||||
GO(XSetWindowBackground, iFppu)
|
||||
GO(XSetWindowBackgroundPixmap, iFppp)
|
||||
//GO(XSetWindowBorder
|
||||
//GO(XSetWindowBorderPixmap
|
||||
GO(XSetWindowBorderWidth, iFppu)
|
||||
//GO(XSetWindowColormap
|
||||
GO(XSetWindowColormap, iFppp)
|
||||
//GO(XSetWMClientMachine
|
||||
GO(XSetWMColormapWindows, iFpppi)
|
||||
GO(XSetWMHints, iFppp)
|
||||
//GO(XSetWMIconName
|
||||
//GO(XSetWMName
|
||||
GO(XSetWMName, vFppp)
|
||||
GO(XSetWMNormalHints, iFpppp)
|
||||
GO(XSetWMProperties, vFpppppippp)
|
||||
GO(XSetWMProtocols, iFpppi)
|
||||
GO(XSetWMSizeHints, vFpppu)
|
||||
//GO(XSetZoomHints
|
||||
//GO(XShrinkRegion
|
||||
GO(XShrinkRegion, iFpii)
|
||||
//GO(XStoreBuffer
|
||||
//GO(XStoreBytes
|
||||
//GO(XStoreColor
|
||||
//GO(XStoreColors
|
||||
GO(XStoreColor, iFppp)
|
||||
GO(XStoreColors, iFpppi)
|
||||
// _XStoreEventCookie
|
||||
GO(XStoreName, iFppp)
|
||||
//GO(XStoreNamedColor
|
||||
//GO(XStringListToTextProperty
|
||||
GO(XStringListToTextProperty, iFpip)
|
||||
//GO(XStringToKeysym
|
||||
//GOM(XSubImage, pFEpiiuu) // need unbridging
|
||||
GO(dummy_XSubImage, pFpiiuu) // for the wrapper
|
||||
//GO(XSubtractRegion
|
||||
GO(XSubtractRegion, iFppp)
|
||||
GO(XSupportsLocale, iFv)
|
||||
GO(XSync, iFpu)
|
||||
GO(XSynchronize, iFpi)
|
||||
@@ -1007,8 +1007,8 @@ GO(XTextExtents16, iFppipppp)
|
||||
// _XTextHeight
|
||||
// _XTextHeight16
|
||||
//GO(XTextPropertyToStringList
|
||||
//GO(XTextWidth
|
||||
//GO(XTextWidth16
|
||||
GO(XTextWidth, iFppi)
|
||||
GO(XTextWidth16, iFppi)
|
||||
DATAB(_Xthread_self_fn, 4)
|
||||
GO(XTranslateCoordinates, iFpppiippp)
|
||||
// _XTranslateKey
|
||||
@@ -1021,8 +1021,8 @@ GO(XUngrabKeyboard, iFpu)
|
||||
GO(XUngrabPointer, iFpu)
|
||||
GO(XUngrabServer, iFp)
|
||||
GO(XUninstallColormap, iFpp)
|
||||
//GO(XUnionRectWithRegion
|
||||
//GO(XUnionRegion
|
||||
GO(XUnionRectWithRegion, iFppp)
|
||||
GO(XUnionRegion, iFppp)
|
||||
// _XUnknownCopyEventCookie
|
||||
// _XUnknownNativeEvent
|
||||
// _XUnknownWireEvent
|
||||
@@ -1040,14 +1040,14 @@ GO(XUnsetICFocus, vFu)
|
||||
// _XUpdateAtomCache
|
||||
// _XUpdateGCCache
|
||||
//GO(Xutf8DrawImageString
|
||||
//GO(Xutf8DrawString
|
||||
GO(Xutf8DrawString, vFppppiipi)
|
||||
//GO(Xutf8DrawText
|
||||
GO(Xutf8LookupString, iFuppipp)
|
||||
//GO(Xutf8ResetIC
|
||||
GO(Xutf8SetWMProperties, vFpppppippp)
|
||||
//GO(Xutf8TextEscapement
|
||||
//GO(Xutf8TextExtents
|
||||
//GO(Xutf8TextListToTextProperty
|
||||
GO(Xutf8TextExtents, iFppipp)
|
||||
GO(Xutf8TextListToTextProperty, iFppiup)
|
||||
// _Xutf8TextListToTextProperty
|
||||
//GO(Xutf8TextPerCharExtents
|
||||
//GO(Xutf8TextPropertyToTextList
|
||||
@@ -1055,7 +1055,7 @@ GO(Xutf8SetWMProperties, vFpppppippp)
|
||||
//GO(XVaCreateNestedList
|
||||
//GO(XVendorRelease
|
||||
// _XVIDtoVisual
|
||||
//GO(XVisualIDFromVisual
|
||||
GO(XVisualIDFromVisual, uFp)
|
||||
GO(XWarpPointer, iFpppiiuuii)
|
||||
//GO(XwcDrawImageString
|
||||
//GO(XwcDrawString
|
||||
@@ -1087,4 +1087,4 @@ GO(XWindowEvent, iFppup)
|
||||
GO(XWithdrawWindow, iFppi)
|
||||
//GO(XWMGeometry
|
||||
//GO(XWriteBitmapFile
|
||||
//GO(XXorRegion
|
||||
GO(XXorRegion, iFppp)
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
#include "debug.h"
|
||||
|
||||
const char* libx11xcbName = "libX11-xcb.so.1";
|
||||
#define LIBNAME libx11xcb
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error meh!
|
||||
#endif
|
||||
|
||||
GO(XGetXCBConnection, pFp)
|
||||
GO(XSetEventQueueOwner, vFpu)
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
#include "debug.h"
|
||||
|
||||
const char* libxcbName = "libxcb.so.1";
|
||||
#define LIBNAME libxcb
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
@@ -0,0 +1,678 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error meh!
|
||||
#endif
|
||||
|
||||
//GO(xcb_alloc_color,
|
||||
//GO(xcb_alloc_color_cells,
|
||||
//GO(xcb_alloc_color_cells_masks,
|
||||
//GO(xcb_alloc_color_cells_masks_end,
|
||||
//GO(xcb_alloc_color_cells_masks_length,
|
||||
//GO(xcb_alloc_color_cells_pixels,
|
||||
//GO(xcb_alloc_color_cells_pixels_end,
|
||||
//GO(xcb_alloc_color_cells_pixels_length,
|
||||
//GO(xcb_alloc_color_cells_reply,
|
||||
//GO(xcb_alloc_color_cells_sizeof,
|
||||
//GO(xcb_alloc_color_cells_unchecked,
|
||||
//GO(xcb_alloc_color_planes,
|
||||
//GO(xcb_alloc_color_planes_pixels,
|
||||
//GO(xcb_alloc_color_planes_pixels_end,
|
||||
//GO(xcb_alloc_color_planes_pixels_length,
|
||||
//GO(xcb_alloc_color_planes_reply,
|
||||
//GO(xcb_alloc_color_planes_sizeof,
|
||||
//GO(xcb_alloc_color_planes_unchecked,
|
||||
//GO(xcb_alloc_color_reply,
|
||||
//GO(xcb_alloc_color_unchecked,
|
||||
//GO(xcb_alloc_named_color,
|
||||
//GO(xcb_alloc_named_color_reply,
|
||||
//GO(xcb_alloc_named_color_sizeof,
|
||||
//GO(xcb_alloc_named_color_unchecked,
|
||||
//GO(xcb_allow_events,
|
||||
//GO(xcb_allow_events_checked,
|
||||
//GO(xcb_arc_end,
|
||||
//GO(xcb_arc_next,
|
||||
//GO(xcb_atom_end,
|
||||
//GO(xcb_atom_next,
|
||||
//GO(xcb_bell,
|
||||
//GO(xcb_bell_checked,
|
||||
//GO(xcb_big_requests_enable,
|
||||
//GO(xcb_big_requests_enable_reply,
|
||||
//GO(xcb_big_requests_enable_unchecked,
|
||||
DATA(xcb_big_requests_id, 4)
|
||||
//GO(xcb_bool32_end,
|
||||
//GO(xcb_bool32_next,
|
||||
//GO(xcb_button_end,
|
||||
//GO(xcb_button_next,
|
||||
//GO(xcb_change_active_pointer_grab,
|
||||
//GO(xcb_change_active_pointer_grab_checked,
|
||||
//GO(xcb_change_gc,
|
||||
//GO(xcb_change_gc_aux,
|
||||
//GO(xcb_change_gc_aux_checked,
|
||||
//GO(xcb_change_gc_checked,
|
||||
//GO(xcb_change_gc_sizeof,
|
||||
//GO(xcb_change_gc_value_list,
|
||||
//GO(xcb_change_gc_value_list_serialize,
|
||||
//GO(xcb_change_gc_value_list_sizeof,
|
||||
//GO(xcb_change_gc_value_list_unpack,
|
||||
//GO(xcb_change_hosts,
|
||||
//GO(xcb_change_hosts_address,
|
||||
//GO(xcb_change_hosts_address_end,
|
||||
//GO(xcb_change_hosts_address_length,
|
||||
//GO(xcb_change_hosts_checked,
|
||||
//GO(xcb_change_hosts_sizeof,
|
||||
//GO(xcb_change_keyboard_control,
|
||||
//GO(xcb_change_keyboard_control_aux,
|
||||
//GO(xcb_change_keyboard_control_aux_checked,
|
||||
//GO(xcb_change_keyboard_control_checked,
|
||||
//GO(xcb_change_keyboard_control_sizeof,
|
||||
//GO(xcb_change_keyboard_control_value_list,
|
||||
//GO(xcb_change_keyboard_control_value_list_serialize,
|
||||
//GO(xcb_change_keyboard_control_value_list_sizeof,
|
||||
//GO(xcb_change_keyboard_control_value_list_unpack,
|
||||
//GO(xcb_change_keyboard_mapping,
|
||||
//GO(xcb_change_keyboard_mapping_checked,
|
||||
//GO(xcb_change_keyboard_mapping_keysyms,
|
||||
//GO(xcb_change_keyboard_mapping_keysyms_end,
|
||||
//GO(xcb_change_keyboard_mapping_keysyms_length,
|
||||
//GO(xcb_change_keyboard_mapping_sizeof,
|
||||
//GO(xcb_change_pointer_control,
|
||||
//GO(xcb_change_pointer_control_checked,
|
||||
//GO(xcb_change_property,
|
||||
//GO(xcb_change_property_checked,
|
||||
//GO(xcb_change_property_data,
|
||||
//GO(xcb_change_property_data_end,
|
||||
//GO(xcb_change_property_data_length,
|
||||
//GO(xcb_change_property_sizeof,
|
||||
//GO(xcb_change_save_set,
|
||||
//GO(xcb_change_save_set_checked,
|
||||
//GO(xcb_change_window_attributes,
|
||||
//GO(xcb_change_window_attributes_aux,
|
||||
//GO(xcb_change_window_attributes_aux_checked,
|
||||
//GO(xcb_change_window_attributes_checked,
|
||||
//GO(xcb_change_window_attributes_sizeof,
|
||||
//GO(xcb_change_window_attributes_value_list,
|
||||
//GO(xcb_change_window_attributes_value_list_serialize,
|
||||
//GO(xcb_change_window_attributes_value_list_sizeof,
|
||||
//GO(xcb_change_window_attributes_value_list_unpack,
|
||||
//GO(xcb_char2b_end,
|
||||
//GO(xcb_char2b_next,
|
||||
//GO(xcb_charinfo_end,
|
||||
//GO(xcb_charinfo_next,
|
||||
//GO(xcb_circulate_window,
|
||||
//GO(xcb_circulate_window_checked,
|
||||
//GO(xcb_clear_area,
|
||||
//GO(xcb_clear_area_checked,
|
||||
//GO(xcb_client_message_data_end,
|
||||
//GO(xcb_client_message_data_next,
|
||||
//GO(xcb_close_font,
|
||||
//GO(xcb_close_font_checked,
|
||||
//GO(xcb_coloritem_end,
|
||||
//GO(xcb_coloritem_next,
|
||||
//GO(xcb_colormap_end,
|
||||
//GO(xcb_colormap_next,
|
||||
//GO(xcb_configure_window,
|
||||
//GO(xcb_configure_window_aux,
|
||||
//GO(xcb_configure_window_aux_checked,
|
||||
//GO(xcb_configure_window_checked,
|
||||
//GO(xcb_configure_window_sizeof,
|
||||
//GO(xcb_configure_window_value_list,
|
||||
//GO(xcb_configure_window_value_list_serialize,
|
||||
//GO(xcb_configure_window_value_list_sizeof,
|
||||
//GO(xcb_configure_window_value_list_unpack,
|
||||
//GO(xcb_connect,
|
||||
//GO(xcb_connection_has_error,
|
||||
//GO(xcb_connect_to_display_with_auth_info,
|
||||
//GO(xcb_connect_to_fd,
|
||||
//GO(xcb_convert_selection,
|
||||
//GO(xcb_convert_selection_checked,
|
||||
//GO(xcb_copy_area,
|
||||
//GO(xcb_copy_area_checked,
|
||||
//GO(xcb_copy_colormap_and_free,
|
||||
//GO(xcb_copy_colormap_and_free_checked,
|
||||
//GO(xcb_copy_gc,
|
||||
//GO(xcb_copy_gc_checked,
|
||||
//GO(xcb_copy_plane,
|
||||
//GO(xcb_copy_plane_checked,
|
||||
//GO(xcb_create_colormap,
|
||||
//GO(xcb_create_colormap_checked,
|
||||
//GO(xcb_create_cursor,
|
||||
//GO(xcb_create_cursor_checked,
|
||||
//GO(xcb_create_gc,
|
||||
//GO(xcb_create_gc_aux,
|
||||
//GO(xcb_create_gc_aux_checked,
|
||||
//GO(xcb_create_gc_checked,
|
||||
//GO(xcb_create_gc_sizeof,
|
||||
//GO(xcb_create_gc_value_list,
|
||||
//GO(xcb_create_gc_value_list_serialize,
|
||||
//GO(xcb_create_gc_value_list_sizeof,
|
||||
//GO(xcb_create_gc_value_list_unpack,
|
||||
//GO(xcb_create_glyph_cursor,
|
||||
//GO(xcb_create_glyph_cursor_checked,
|
||||
//GO(xcb_create_pixmap,
|
||||
//GO(xcb_create_pixmap_checked,
|
||||
//GO(xcb_create_window,
|
||||
//GO(xcb_create_window_aux,
|
||||
//GO(xcb_create_window_aux_checked,
|
||||
//GO(xcb_create_window_checked,
|
||||
//GO(xcb_create_window_sizeof,
|
||||
//GO(xcb_create_window_value_list,
|
||||
//GO(xcb_create_window_value_list_serialize,
|
||||
//GO(xcb_create_window_value_list_sizeof,
|
||||
//GO(xcb_create_window_value_list_unpack,
|
||||
//GO(xcb_cursor_end,
|
||||
//GO(xcb_cursor_next,
|
||||
GO(xcb_delete_property, pFppp)
|
||||
//GO(xcb_delete_property_checked,
|
||||
//GO(xcb_depth_end,
|
||||
//GO(xcb_depth_next,
|
||||
//GO(xcb_depth_sizeof,
|
||||
//GO(xcb_depth_visuals,
|
||||
//GO(xcb_depth_visuals_iterator,
|
||||
//GO(xcb_depth_visuals_length,
|
||||
//GO(xcb_destroy_subwindows,
|
||||
//GO(xcb_destroy_subwindows_checked,
|
||||
//GO(xcb_destroy_window,
|
||||
//GO(xcb_destroy_window_checked,
|
||||
//GO(xcb_discard_reply,
|
||||
//GO(xcb_discard_reply64,
|
||||
//GO(xcb_disconnect,
|
||||
//GO(xcb_drawable_end,
|
||||
//GO(xcb_drawable_next,
|
||||
//GO(xcb_fill_poly,
|
||||
//GO(xcb_fill_poly_checked,
|
||||
//GO(xcb_fill_poly_points,
|
||||
//GO(xcb_fill_poly_points_iterator,
|
||||
//GO(xcb_fill_poly_points_length,
|
||||
//GO(xcb_fill_poly_sizeof,
|
||||
//GO(xcb_flush,
|
||||
//GO(xcb_fontable_end,
|
||||
//GO(xcb_fontable_next,
|
||||
//GO(xcb_font_end,
|
||||
//GO(xcb_font_next,
|
||||
//GO(xcb_fontprop_end,
|
||||
//GO(xcb_fontprop_next,
|
||||
//GO(xcb_force_screen_saver,
|
||||
//GO(xcb_force_screen_saver_checked,
|
||||
//GO(xcb_format_end,
|
||||
//GO(xcb_format_next,
|
||||
//GO(xcb_free_colormap,
|
||||
//GO(xcb_free_colormap_checked,
|
||||
//GO(xcb_free_colors,
|
||||
//GO(xcb_free_colors_checked,
|
||||
//GO(xcb_free_colors_pixels,
|
||||
//GO(xcb_free_colors_pixels_end,
|
||||
//GO(xcb_free_colors_pixels_length,
|
||||
//GO(xcb_free_colors_sizeof,
|
||||
//GO(xcb_free_cursor,
|
||||
//GO(xcb_free_cursor_checked,
|
||||
//GO(xcb_free_gc,
|
||||
//GO(xcb_free_gc_checked,
|
||||
//GO(xcb_free_pixmap,
|
||||
//GO(xcb_free_pixmap_checked,
|
||||
//GO(xcb_gcontext_end,
|
||||
//GO(xcb_gcontext_next,
|
||||
//GO(xcb_generate_id,
|
||||
//GO(xcb_get_atom_name,
|
||||
//GO(xcb_get_atom_name_name,
|
||||
//GO(xcb_get_atom_name_name_end,
|
||||
//GO(xcb_get_atom_name_name_length,
|
||||
//GO(xcb_get_atom_name_reply,
|
||||
//GO(xcb_get_atom_name_sizeof,
|
||||
//GO(xcb_get_atom_name_unchecked,
|
||||
//GO(xcb_get_extension_data,
|
||||
//GO(xcb_get_file_descriptor,
|
||||
//GO(xcb_get_font_path,
|
||||
//GO(xcb_get_font_path_path_iterator,
|
||||
//GO(xcb_get_font_path_path_length,
|
||||
//GO(xcb_get_font_path_reply,
|
||||
//GO(xcb_get_font_path_sizeof,
|
||||
//GO(xcb_get_font_path_unchecked,
|
||||
//GO(xcb_get_geometry,
|
||||
GO(xcb_get_geometry_reply, pFppp)
|
||||
//GO(xcb_get_geometry_unchecked,
|
||||
//GO(xcb_get_image,
|
||||
//GO(xcb_get_image_data,
|
||||
//GO(xcb_get_image_data_end,
|
||||
//GO(xcb_get_image_data_length,
|
||||
//GO(xcb_get_image_reply,
|
||||
//GO(xcb_get_image_sizeof,
|
||||
//GO(xcb_get_image_unchecked,
|
||||
//GO(xcb_get_input_focus,
|
||||
GO(xcb_get_input_focus_reply, pFppp)
|
||||
//GO(xcb_get_input_focus_unchecked,
|
||||
//GO(xcb_get_keyboard_control,
|
||||
//GO(xcb_get_keyboard_control_reply,
|
||||
//GO(xcb_get_keyboard_control_unchecked,
|
||||
//GO(xcb_get_keyboard_mapping,
|
||||
//GO(xcb_get_keyboard_mapping_keysyms,
|
||||
//GO(xcb_get_keyboard_mapping_keysyms_end,
|
||||
//GO(xcb_get_keyboard_mapping_keysyms_length,
|
||||
//GO(xcb_get_keyboard_mapping_reply,
|
||||
//GO(xcb_get_keyboard_mapping_sizeof,
|
||||
//GO(xcb_get_keyboard_mapping_unchecked,
|
||||
//GO(xcb_get_maximum_request_length,
|
||||
//GO(xcb_get_modifier_mapping,
|
||||
//GO(xcb_get_modifier_mapping_keycodes,
|
||||
//GO(xcb_get_modifier_mapping_keycodes_end,
|
||||
//GO(xcb_get_modifier_mapping_keycodes_length,
|
||||
//GO(xcb_get_modifier_mapping_reply,
|
||||
//GO(xcb_get_modifier_mapping_sizeof,
|
||||
//GO(xcb_get_modifier_mapping_unchecked,
|
||||
//GO(xcb_get_motion_events,
|
||||
//GO(xcb_get_motion_events_events,
|
||||
//GO(xcb_get_motion_events_events_iterator,
|
||||
//GO(xcb_get_motion_events_events_length,
|
||||
//GO(xcb_get_motion_events_reply,
|
||||
//GO(xcb_get_motion_events_sizeof,
|
||||
//GO(xcb_get_motion_events_unchecked,
|
||||
//GO(xcb_get_pointer_control,
|
||||
//GO(xcb_get_pointer_control_reply,
|
||||
//GO(xcb_get_pointer_control_unchecked,
|
||||
//GO(xcb_get_pointer_mapping,
|
||||
//GO(xcb_get_pointer_mapping_map,
|
||||
//GO(xcb_get_pointer_mapping_map_end,
|
||||
//GO(xcb_get_pointer_mapping_map_length,
|
||||
//GO(xcb_get_pointer_mapping_reply,
|
||||
//GO(xcb_get_pointer_mapping_sizeof,
|
||||
//GO(xcb_get_pointer_mapping_unchecked,
|
||||
//GO(xcb_get_property,
|
||||
//GO(xcb_get_property_reply,
|
||||
//GO(xcb_get_property_sizeof,
|
||||
//GO(xcb_get_property_unchecked,
|
||||
//GO(xcb_get_property_value,
|
||||
//GO(xcb_get_property_value_end,
|
||||
//GO(xcb_get_property_value_length,
|
||||
//GO(xcb_get_reply_fds,
|
||||
//GO(xcb_get_screen_saver,
|
||||
//GO(xcb_get_screen_saver_reply,
|
||||
//GO(xcb_get_screen_saver_unchecked,
|
||||
//GO(xcb_get_selection_owner,
|
||||
//GO(xcb_get_selection_owner_reply,
|
||||
//GO(xcb_get_selection_owner_unchecked,
|
||||
//GO(xcb_get_setup,
|
||||
//GO(xcb_get_window_attributes,
|
||||
//GO(xcb_get_window_attributes_reply,
|
||||
//GO(xcb_get_window_attributes_unchecked,
|
||||
//GO(xcb_grab_button,
|
||||
//GO(xcb_grab_button_checked,
|
||||
//GO(xcb_grab_key,
|
||||
//GO(xcb_grab_keyboard,
|
||||
//GO(xcb_grab_keyboard_reply,
|
||||
//GO(xcb_grab_keyboard_unchecked,
|
||||
//GO(xcb_grab_key_checked,
|
||||
//GO(xcb_grab_pointer,
|
||||
//GO(xcb_grab_pointer_reply,
|
||||
//GO(xcb_grab_pointer_unchecked,
|
||||
//GO(xcb_grab_server,
|
||||
//GO(xcb_grab_server_checked,
|
||||
//GO(xcb_host_address,
|
||||
//GO(xcb_host_address_end,
|
||||
//GO(xcb_host_address_length,
|
||||
//GO(xcb_host_end,
|
||||
//GO(xcb_host_next,
|
||||
//GO(xcb_host_sizeof,
|
||||
//GO(xcb_image_text_16,
|
||||
//GO(xcb_image_text_16_checked,
|
||||
//GO(xcb_image_text_16_sizeof,
|
||||
//GO(xcb_image_text_16_string,
|
||||
//GO(xcb_image_text_16_string_iterator,
|
||||
//GO(xcb_image_text_16_string_length,
|
||||
//GO(xcb_image_text_8,
|
||||
//GO(xcb_image_text_8_checked,
|
||||
//GO(xcb_image_text_8_sizeof,
|
||||
//GO(xcb_image_text_8_string,
|
||||
//GO(xcb_image_text_8_string_end,
|
||||
//GO(xcb_image_text_8_string_length,
|
||||
//GO(xcb_install_colormap,
|
||||
//GO(xcb_install_colormap_checked,
|
||||
//GO(xcb_intern_atom,
|
||||
//GO(xcb_intern_atom_reply,
|
||||
//GO(xcb_intern_atom_sizeof,
|
||||
//GO(xcb_intern_atom_unchecked,
|
||||
//GO(xcb_keycode32_end,
|
||||
//GO(xcb_keycode32_next,
|
||||
//GO(xcb_keycode_end,
|
||||
//GO(xcb_keycode_next,
|
||||
//GO(xcb_keysym_end,
|
||||
//GO(xcb_keysym_next,
|
||||
//GO(xcb_kill_client,
|
||||
//GO(xcb_kill_client_checked,
|
||||
//GO(xcb_list_extensions,
|
||||
//GO(xcb_list_extensions_names_iterator,
|
||||
//GO(xcb_list_extensions_names_length,
|
||||
//GO(xcb_list_extensions_reply,
|
||||
//GO(xcb_list_extensions_sizeof,
|
||||
//GO(xcb_list_extensions_unchecked,
|
||||
//GO(xcb_list_fonts,
|
||||
//GO(xcb_list_fonts_names_iterator,
|
||||
//GO(xcb_list_fonts_names_length,
|
||||
//GO(xcb_list_fonts_reply,
|
||||
//GO(xcb_list_fonts_sizeof,
|
||||
//GO(xcb_list_fonts_unchecked,
|
||||
//GO(xcb_list_fonts_with_info,
|
||||
//GO(xcb_list_fonts_with_info_name,
|
||||
//GO(xcb_list_fonts_with_info_name_end,
|
||||
//GO(xcb_list_fonts_with_info_name_length,
|
||||
//GO(xcb_list_fonts_with_info_properties,
|
||||
//GO(xcb_list_fonts_with_info_properties_iterator,
|
||||
//GO(xcb_list_fonts_with_info_properties_length,
|
||||
//GO(xcb_list_fonts_with_info_reply,
|
||||
//GO(xcb_list_fonts_with_info_sizeof,
|
||||
//GO(xcb_list_fonts_with_info_unchecked,
|
||||
//GO(xcb_list_hosts,
|
||||
//GO(xcb_list_hosts_hosts_iterator,
|
||||
//GO(xcb_list_hosts_hosts_length,
|
||||
//GO(xcb_list_hosts_reply,
|
||||
//GO(xcb_list_hosts_sizeof,
|
||||
//GO(xcb_list_hosts_unchecked,
|
||||
//GO(xcb_list_installed_colormaps,
|
||||
//GO(xcb_list_installed_colormaps_cmaps,
|
||||
//GO(xcb_list_installed_colormaps_cmaps_end,
|
||||
//GO(xcb_list_installed_colormaps_cmaps_length,
|
||||
//GO(xcb_list_installed_colormaps_reply,
|
||||
//GO(xcb_list_installed_colormaps_sizeof,
|
||||
//GO(xcb_list_installed_colormaps_unchecked,
|
||||
//GO(xcb_list_properties,
|
||||
//GO(xcb_list_properties_atoms,
|
||||
//GO(xcb_list_properties_atoms_end,
|
||||
//GO(xcb_list_properties_atoms_length,
|
||||
//GO(xcb_list_properties_reply,
|
||||
//GO(xcb_list_properties_sizeof,
|
||||
//GO(xcb_list_properties_unchecked,
|
||||
//GO(xcb_lookup_color,
|
||||
//GO(xcb_lookup_color_reply,
|
||||
//GO(xcb_lookup_color_sizeof,
|
||||
//GO(xcb_lookup_color_unchecked,
|
||||
//GO(xcb_map_subwindows,
|
||||
//GO(xcb_map_subwindows_checked,
|
||||
//GO(xcb_map_window,
|
||||
//GO(xcb_map_window_checked,
|
||||
//GO(xcb_no_operation,
|
||||
//GO(xcb_no_operation_checked,
|
||||
//GO(xcb_open_font,
|
||||
//GO(xcb_open_font_checked,
|
||||
//GO(xcb_open_font_name,
|
||||
//GO(xcb_open_font_name_end,
|
||||
//GO(xcb_open_font_name_length,
|
||||
//GO(xcb_open_font_sizeof,
|
||||
//GO(xcb_parse_display,
|
||||
//GO(xcb_pixmap_end,
|
||||
//GO(xcb_pixmap_next,
|
||||
//GO(xcb_point_end,
|
||||
//GO(xcb_point_next,
|
||||
//GO(xcb_poll_for_event,
|
||||
GO(xcb_poll_for_queued_event, pFp)
|
||||
//GO(xcb_poll_for_reply,
|
||||
//GO(xcb_poll_for_reply64,
|
||||
//GO(xcb_poll_for_special_event,
|
||||
//GO(xcb_poly_arc,
|
||||
//GO(xcb_poly_arc_arcs,
|
||||
//GO(xcb_poly_arc_arcs_iterator,
|
||||
//GO(xcb_poly_arc_arcs_length,
|
||||
//GO(xcb_poly_arc_checked,
|
||||
//GO(xcb_poly_arc_sizeof,
|
||||
//GO(xcb_poly_fill_arc,
|
||||
//GO(xcb_poly_fill_arc_arcs,
|
||||
//GO(xcb_poly_fill_arc_arcs_iterator,
|
||||
//GO(xcb_poly_fill_arc_arcs_length,
|
||||
//GO(xcb_poly_fill_arc_checked,
|
||||
//GO(xcb_poly_fill_arc_sizeof,
|
||||
//GO(xcb_poly_fill_rectangle,
|
||||
//GO(xcb_poly_fill_rectangle_checked,
|
||||
//GO(xcb_poly_fill_rectangle_rectangles,
|
||||
//GO(xcb_poly_fill_rectangle_rectangles_iterator,
|
||||
//GO(xcb_poly_fill_rectangle_rectangles_length,
|
||||
//GO(xcb_poly_fill_rectangle_sizeof,
|
||||
//GO(xcb_poly_line,
|
||||
//GO(xcb_poly_line_checked,
|
||||
//GO(xcb_poly_line_points,
|
||||
//GO(xcb_poly_line_points_iterator,
|
||||
//GO(xcb_poly_line_points_length,
|
||||
//GO(xcb_poly_line_sizeof,
|
||||
//GO(xcb_poly_point,
|
||||
//GO(xcb_poly_point_checked,
|
||||
//GO(xcb_poly_point_points,
|
||||
//GO(xcb_poly_point_points_iterator,
|
||||
//GO(xcb_poly_point_points_length,
|
||||
//GO(xcb_poly_point_sizeof,
|
||||
//GO(xcb_poly_rectangle,
|
||||
//GO(xcb_poly_rectangle_checked,
|
||||
//GO(xcb_poly_rectangle_rectangles,
|
||||
//GO(xcb_poly_rectangle_rectangles_iterator,
|
||||
//GO(xcb_poly_rectangle_rectangles_length,
|
||||
//GO(xcb_poly_rectangle_sizeof,
|
||||
//GO(xcb_poly_segment,
|
||||
//GO(xcb_poly_segment_checked,
|
||||
//GO(xcb_poly_segment_segments,
|
||||
//GO(xcb_poly_segment_segments_iterator,
|
||||
//GO(xcb_poly_segment_segments_length,
|
||||
//GO(xcb_poly_segment_sizeof,
|
||||
//GO(xcb_poly_text_16,
|
||||
//GO(xcb_poly_text_16_checked,
|
||||
//GO(xcb_poly_text_16_items,
|
||||
//GO(xcb_poly_text_16_items_end,
|
||||
//GO(xcb_poly_text_16_items_length,
|
||||
//GO(xcb_poly_text_16_sizeof,
|
||||
//GO(xcb_poly_text_8,
|
||||
//GO(xcb_poly_text_8_checked,
|
||||
//GO(xcb_poly_text_8_items,
|
||||
//GO(xcb_poly_text_8_items_end,
|
||||
//GO(xcb_poly_text_8_items_length,
|
||||
//GO(xcb_poly_text_8_sizeof,
|
||||
//GO(xcb_popcount,
|
||||
//GO(xcb_prefetch_extension_data,
|
||||
//GO(xcb_prefetch_maximum_request_length,
|
||||
//GO(xcb_put_image,
|
||||
//GO(xcb_put_image_checked,
|
||||
//GO(xcb_put_image_data,
|
||||
//GO(xcb_put_image_data_end,
|
||||
//GO(xcb_put_image_data_length,
|
||||
//GO(xcb_put_image_sizeof,
|
||||
//GO(xcb_query_best_size,
|
||||
//GO(xcb_query_best_size_reply,
|
||||
//GO(xcb_query_best_size_unchecked,
|
||||
//GO(xcb_query_colors,
|
||||
//GO(xcb_query_colors_colors,
|
||||
//GO(xcb_query_colors_colors_iterator,
|
||||
//GO(xcb_query_colors_colors_length,
|
||||
//GO(xcb_query_colors_reply,
|
||||
//GO(xcb_query_colors_sizeof,
|
||||
//GO(xcb_query_colors_unchecked,
|
||||
//GO(xcb_query_extension,
|
||||
//GO(xcb_query_extension_reply,
|
||||
//GO(xcb_query_extension_sizeof,
|
||||
//GO(xcb_query_extension_unchecked,
|
||||
//GO(xcb_query_font,
|
||||
//GO(xcb_query_font_char_infos,
|
||||
//GO(xcb_query_font_char_infos_iterator,
|
||||
//GO(xcb_query_font_char_infos_length,
|
||||
//GO(xcb_query_font_properties,
|
||||
//GO(xcb_query_font_properties_iterator,
|
||||
//GO(xcb_query_font_properties_length,
|
||||
//GO(xcb_query_font_reply,
|
||||
//GO(xcb_query_font_sizeof,
|
||||
//GO(xcb_query_font_unchecked,
|
||||
//GO(xcb_query_keymap,
|
||||
//GO(xcb_query_keymap_reply,
|
||||
//GO(xcb_query_keymap_unchecked,
|
||||
//GO(xcb_query_pointer,
|
||||
//GO(xcb_query_pointer_reply,
|
||||
//GO(xcb_query_pointer_unchecked,
|
||||
//GO(xcb_query_text_extents,
|
||||
//GO(xcb_query_text_extents_reply,
|
||||
//GO(xcb_query_text_extents_sizeof,
|
||||
//GO(xcb_query_text_extents_unchecked,
|
||||
//GO(xcb_query_tree,
|
||||
//GO(xcb_query_tree_children,
|
||||
//GO(xcb_query_tree_children_end,
|
||||
//GO(xcb_query_tree_children_length,
|
||||
//GO(xcb_query_tree_reply,
|
||||
//GO(xcb_query_tree_sizeof,
|
||||
//GO(xcb_query_tree_unchecked,
|
||||
//GO(xcb_recolor_cursor,
|
||||
//GO(xcb_recolor_cursor_checked,
|
||||
//GO(xcb_rectangle_end,
|
||||
//GO(xcb_rectangle_next,
|
||||
//GO(xcb_register_for_special_xge,
|
||||
//GO(xcb_reparent_window,
|
||||
//GO(xcb_reparent_window_checked,
|
||||
//GO(xcb_request_check,
|
||||
//GO(xcb_rgb_end,
|
||||
//GO(xcb_rgb_next,
|
||||
//GO(xcb_rotate_properties,
|
||||
//GO(xcb_rotate_properties_atoms,
|
||||
//GO(xcb_rotate_properties_atoms_end,
|
||||
//GO(xcb_rotate_properties_atoms_length,
|
||||
//GO(xcb_rotate_properties_checked,
|
||||
//GO(xcb_rotate_properties_sizeof,
|
||||
//GO(xcb_screen_allowed_depths_iterator,
|
||||
//GO(xcb_screen_allowed_depths_length,
|
||||
//GO(xcb_screen_end,
|
||||
//GO(xcb_screen_next,
|
||||
//GO(xcb_screen_sizeof,
|
||||
//GO(xcb_segment_end,
|
||||
//GO(xcb_segment_next,
|
||||
//GO(xcb_send_event,
|
||||
//GO(xcb_send_event_checked,
|
||||
//GO(xcb_send_fd,
|
||||
//GO(xcb_send_request,
|
||||
//GO(xcb_send_request64,
|
||||
//GO(xcb_send_request_with_fds,
|
||||
//GO(xcb_send_request_with_fds64,
|
||||
//GO(xcb_set_access_control,
|
||||
//GO(xcb_set_access_control_checked,
|
||||
//GO(xcb_set_clip_rectangles,
|
||||
//GO(xcb_set_clip_rectangles_checked,
|
||||
//GO(xcb_set_clip_rectangles_rectangles,
|
||||
//GO(xcb_set_clip_rectangles_rectangles_iterator,
|
||||
//GO(xcb_set_clip_rectangles_rectangles_length,
|
||||
//GO(xcb_set_clip_rectangles_sizeof,
|
||||
//GO(xcb_set_close_down_mode,
|
||||
//GO(xcb_set_close_down_mode_checked,
|
||||
//GO(xcb_set_dashes,
|
||||
//GO(xcb_set_dashes_checked,
|
||||
//GO(xcb_set_dashes_dashes,
|
||||
//GO(xcb_set_dashes_dashes_end,
|
||||
//GO(xcb_set_dashes_dashes_length,
|
||||
//GO(xcb_set_dashes_sizeof,
|
||||
//GO(xcb_set_font_path,
|
||||
//GO(xcb_set_font_path_checked,
|
||||
//GO(xcb_set_font_path_font_iterator,
|
||||
//GO(xcb_set_font_path_font_length,
|
||||
//GO(xcb_set_font_path_sizeof,
|
||||
//GO(xcb_set_input_focus,
|
||||
//GO(xcb_set_input_focus_checked,
|
||||
//GO(xcb_set_modifier_mapping,
|
||||
//GO(xcb_set_modifier_mapping_reply,
|
||||
//GO(xcb_set_modifier_mapping_sizeof,
|
||||
//GO(xcb_set_modifier_mapping_unchecked,
|
||||
//GO(xcb_set_pointer_mapping,
|
||||
//GO(xcb_set_pointer_mapping_reply,
|
||||
//GO(xcb_set_pointer_mapping_sizeof,
|
||||
//GO(xcb_set_pointer_mapping_unchecked,
|
||||
//GO(xcb_set_screen_saver,
|
||||
//GO(xcb_set_screen_saver_checked,
|
||||
//GO(xcb_set_selection_owner,
|
||||
//GO(xcb_set_selection_owner_checked,
|
||||
//GO(xcb_setup_authenticate_end,
|
||||
//GO(xcb_setup_authenticate_next,
|
||||
//GO(xcb_setup_authenticate_reason,
|
||||
//GO(xcb_setup_authenticate_reason_end,
|
||||
//GO(xcb_setup_authenticate_reason_length,
|
||||
//GO(xcb_setup_authenticate_sizeof,
|
||||
//GO(xcb_setup_end,
|
||||
//GO(xcb_setup_failed_end,
|
||||
//GO(xcb_setup_failed_next,
|
||||
//GO(xcb_setup_failed_reason,
|
||||
//GO(xcb_setup_failed_reason_end,
|
||||
//GO(xcb_setup_failed_reason_length,
|
||||
//GO(xcb_setup_failed_sizeof,
|
||||
//GO(xcb_setup_next,
|
||||
//GO(xcb_setup_pixmap_formats,
|
||||
//GO(xcb_setup_pixmap_formats_iterator,
|
||||
//GO(xcb_setup_pixmap_formats_length,
|
||||
//GO(xcb_setup_request_authorization_protocol_data,
|
||||
//GO(xcb_setup_request_authorization_protocol_data_end,
|
||||
//GO(xcb_setup_request_authorization_protocol_data_length,
|
||||
//GO(xcb_setup_request_authorization_protocol_name,
|
||||
//GO(xcb_setup_request_authorization_protocol_name_end,
|
||||
//GO(xcb_setup_request_authorization_protocol_name_length,
|
||||
//GO(xcb_setup_request_end,
|
||||
//GO(xcb_setup_request_next,
|
||||
//GO(xcb_setup_request_sizeof,
|
||||
//GO(xcb_setup_roots_iterator,
|
||||
//GO(xcb_setup_roots_length,
|
||||
//GO(xcb_setup_sizeof,
|
||||
//GO(xcb_setup_vendor,
|
||||
//GO(xcb_setup_vendor_end,
|
||||
//GO(xcb_setup_vendor_length,
|
||||
//GO(xcb_store_colors,
|
||||
//GO(xcb_store_colors_checked,
|
||||
//GO(xcb_store_colors_items,
|
||||
//GO(xcb_store_colors_items_iterator,
|
||||
//GO(xcb_store_colors_items_length,
|
||||
//GO(xcb_store_colors_sizeof,
|
||||
//GO(xcb_store_named_color,
|
||||
//GO(xcb_store_named_color_checked,
|
||||
//GO(xcb_store_named_color_name,
|
||||
//GO(xcb_store_named_color_name_end,
|
||||
//GO(xcb_store_named_color_name_length,
|
||||
//GO(xcb_store_named_color_sizeof,
|
||||
//GO(xcb_str_end,
|
||||
//GO(xcb_str_name,
|
||||
//GO(xcb_str_name_end,
|
||||
//GO(xcb_str_name_length,
|
||||
//GO(xcb_str_next,
|
||||
//GO(xcb_str_sizeof,
|
||||
//GO(xcb_sumof,
|
||||
//GO(xcb_take_socket,
|
||||
//GO(xcb_timecoord_end,
|
||||
//GO(xcb_timecoord_next,
|
||||
//GO(xcb_timestamp_end,
|
||||
//GO(xcb_timestamp_next,
|
||||
//GO(xcb_translate_coordinates,
|
||||
//GO(xcb_translate_coordinates_reply,
|
||||
//GO(xcb_translate_coordinates_unchecked,
|
||||
//GO(xcb_ungrab_button,
|
||||
//GO(xcb_ungrab_button_checked,
|
||||
//GO(xcb_ungrab_key,
|
||||
GO(xcb_ungrab_keyboard, pFpp)
|
||||
GO(xcb_ungrab_keyboard_checked, pFpp)
|
||||
GO(xcb_ungrab_key_checked, pFpCpupCC)
|
||||
//GO(xcb_ungrab_pointer,
|
||||
//GO(xcb_ungrab_pointer_checked,
|
||||
//GO(xcb_ungrab_server,
|
||||
//GO(xcb_ungrab_server_checked,
|
||||
//GO(xcb_uninstall_colormap,
|
||||
//GO(xcb_uninstall_colormap_checked,
|
||||
//GO(xcb_unmap_subwindows,
|
||||
//GO(xcb_unmap_subwindows_checked,
|
||||
//GO(xcb_unmap_window,
|
||||
//GO(xcb_unmap_window_checked,
|
||||
//GO(xcb_unregister_for_special_event,
|
||||
//GO(xcb_visualid_end,
|
||||
//GO(xcb_visualid_next,
|
||||
//GO(xcb_visualtype_end,
|
||||
//GO(xcb_visualtype_next,
|
||||
//GO(xcb_wait_for_event,
|
||||
//GO(xcb_wait_for_reply,
|
||||
//GO(xcb_wait_for_reply64,
|
||||
//GO(xcb_wait_for_special_event,
|
||||
//GO(xcb_warp_pointer,
|
||||
//GO(xcb_warp_pointer_checked,
|
||||
//GO(xcb_window_end,
|
||||
//GO(xcb_window_next,
|
||||
//GO(xcb_writev,
|
||||
//GO(xcb_xc_misc_get_version,
|
||||
//GO(xcb_xc_misc_get_version_reply,
|
||||
//GO(xcb_xc_misc_get_version_unchecked,
|
||||
//GO(xcb_xc_misc_get_xid_list,
|
||||
//GO(xcb_xc_misc_get_xid_list_ids,
|
||||
//GO(xcb_xc_misc_get_xid_list_ids_end,
|
||||
//GO(xcb_xc_misc_get_xid_list_ids_length,
|
||||
//GO(xcb_xc_misc_get_xid_list_reply,
|
||||
//GO(xcb_xc_misc_get_xid_list_sizeof,
|
||||
//GO(xcb_xc_misc_get_xid_list_unchecked,
|
||||
//GO(xcb_xc_misc_get_xid_range,
|
||||
//GO(xcb_xc_misc_get_xid_range_reply,
|
||||
//GO(xcb_xc_misc_get_xid_range_unchecked,
|
||||
DATA(xcb_xc_misc_id, 4)
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* libxcursorName = "libXcursor.so.1";
|
||||
#define LIBNAME libxcursor
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
GO(XcursorAnimateCreate, pFp)
|
||||
GO(XcursorAnimateDestroy, vFp)
|
||||
GO(XcursorAnimateNext, pFp)
|
||||
GO(XcursorCommentCreate, pFui)
|
||||
GO(XcursorCommentDestroy, vFp)
|
||||
GO(XcursorCommentsCreate, pFi)
|
||||
GO(XcursorCommentsDestroy, vFp)
|
||||
//GO(_XcursorCreateFontCursor,
|
||||
//GO(_XcursorCreateGlyphCursor,
|
||||
GO(XcursorCursorsCreate, pFpi)
|
||||
GO(XcursorCursorsDestroy, vFp)
|
||||
GO(XcursorFileLoad, pFppp)
|
||||
GO(XcursorFileLoadAllImages, pFp)
|
||||
GO(XcursorFileLoadImage, pFpi)
|
||||
GO(XcursorFileLoadImages, pFpi)
|
||||
GO(XcursorFilenameLoad, iFppp)
|
||||
GO(XcursorFilenameLoadAllImages, pFp)
|
||||
GO(XcursorFilenameLoadCursor, pFpp)
|
||||
GO(XcursorFilenameLoadCursors, pFpp)
|
||||
GO(XcursorFilenameLoadImage, pFpi)
|
||||
GO(XcursorFilenameLoadImages, pFpi)
|
||||
GO(XcursorFilenameSave, iFppp)
|
||||
GO(XcursorFilenameSaveImages, iFpp)
|
||||
GO(XcursorFileSave, iFppp)
|
||||
GO(XcursorFileSaveImages, iFpp)
|
||||
GO(XcursorGetDefaultSize, iFp)
|
||||
//GO(_XcursorGetDisplayInfo,
|
||||
GO(XcursorGetTheme, pFp)
|
||||
GO(XcursorGetThemeCore, iFp)
|
||||
GO(XcursorImageCreate, pFii)
|
||||
GO(XcursorImageDestroy, vFp)
|
||||
//GOM(XcursorImageHash, vFEpp) // needs unbridge XImage (first p)
|
||||
GO(XcursorImageLoadCursor, pFpp)
|
||||
GO(XcursorImagesCreate, pFi)
|
||||
GO(XcursorImagesDestroy, vFp)
|
||||
GO(XcursorImagesLoadCursor, pFpp)
|
||||
GO(XcursorImagesLoadCursors, pFpp)
|
||||
GO(XcursorImagesSetName, vFpp)
|
||||
GO(XcursorLibraryLoadCursor, pFpp)
|
||||
GO(XcursorLibraryLoadCursors, pFpp)
|
||||
GO(XcursorLibraryLoadImage, pFppi)
|
||||
GO(XcursorLibraryLoadImages, pFppi)
|
||||
GO(XcursorLibraryPath, pFv)
|
||||
GO(XcursorLibraryShape, iFp)
|
||||
GO(XcursorNoticeCreateBitmap, vFppuu)
|
||||
//GOM(XcursorNoticePutBitmap, vFEppp) //needs unbridge XImage (last p)
|
||||
GO(XcursorSetDefaultSize, iFpi)
|
||||
GO(XcursorSetTheme, iFpp)
|
||||
GO(XcursorSetThemeCore, iFpi)
|
||||
GO(XcursorShapeLoadCursor, pFpu)
|
||||
GO(XcursorShapeLoadCursors, pFpu)
|
||||
GO(XcursorShapeLoadImage, pFupi)
|
||||
GO(XcursorShapeLoadImages, pFupi)
|
||||
GO(XcursorSupportsAnim, iFp)
|
||||
GO(XcursorSupportsARGB, iFp)
|
||||
GO(XcursorTryShapeBitmapCursor, pFpppppuu)
|
||||
GO(XcursorTryShapeCursor, pFpppuupp)
|
||||
GO(XcursorXcFileLoad, iFppp)
|
||||
GO(XcursorXcFileLoadAllImages, pFp)
|
||||
GO(XcursorXcFileLoadImage, pFpi)
|
||||
GO(XcursorXcFileLoadImages, pFpi)
|
||||
GO(XcursorXcFileSave, iFppp)
|
||||
Executable
+102
@@ -0,0 +1,102 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
#include "x86emu_private.h"
|
||||
#include "callback.h"
|
||||
#include "librarian.h"
|
||||
#include "box86context.h"
|
||||
#include "x86emu_private.h"
|
||||
|
||||
const char* libxextName = "libXext.so.6";
|
||||
#define LIBNAME libxext
|
||||
|
||||
typedef struct _XImage XImage;
|
||||
void BridgeImageFunc(x86emu_t *emu, XImage *img);
|
||||
void UnbridgeImageFunc(x86emu_t *emu, XImage *img);
|
||||
|
||||
typedef int32_t (*iFpppiiu_t)(void*, void*, void*, int32_t, int32_t, uint32_t);
|
||||
typedef void* (*pFppuippuu_t)(void*, void*, uint32_t, int32_t, void*, void*, uint32_t, uint32_t);
|
||||
typedef int32_t (*iFppppiiiiuui_t)(void*, void*, void*, void*, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, int32_t);
|
||||
|
||||
typedef struct xext_my_s {
|
||||
// functions
|
||||
pFppuippuu_t XShmCreateImage;
|
||||
iFpppiiu_t XShmGetImage;
|
||||
iFppppiiiiuui_t XShmPutImage;
|
||||
} xext_my_t;
|
||||
|
||||
void* getXextMy(library_t* lib)
|
||||
{
|
||||
xext_my_t* my = (xext_my_t*)calloc(1, sizeof(xext_my_t));
|
||||
#define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
|
||||
GO(XShmCreateImage, pFppuippuu_t)
|
||||
GO(XShmGetImage, iFpppiiu_t)
|
||||
GO(XShmPutImage, iFppppiiiiuui_t)
|
||||
#undef GO
|
||||
return my;
|
||||
}
|
||||
|
||||
void freeXextMy(void* lib)
|
||||
{
|
||||
xext_my_t *my = (xext_my_t *)lib;
|
||||
}
|
||||
|
||||
EXPORT void* my_XShmCreateImage(x86emu_t* emu, void* disp, void* vis, uint32_t depth, int32_t fmt
|
||||
, void* data, void* shminfo, uint32_t w, uint32_t h)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libxextName);
|
||||
xext_my_t *my = (xext_my_t*)lib->priv.w.p2;
|
||||
|
||||
XImage *img = my->XShmCreateImage(disp, vis, depth, fmt, data, shminfo, w, h);
|
||||
if(!img)
|
||||
return img;
|
||||
// bridge all access functions...
|
||||
BridgeImageFunc(emu, img);
|
||||
return img;
|
||||
}
|
||||
|
||||
EXPORT int32_t my_XShmPutImage(x86emu_t* emu, void* disp, void* drawable, void* gc, void* image
|
||||
, int32_t src_x, int32_t src_y, int32_t dst_x, int32_t dst_y
|
||||
, uint32_t w, uint32_t h, int32_t sendevt)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libxextName);
|
||||
xext_my_t *my = (xext_my_t*)lib->priv.w.p2;
|
||||
|
||||
UnbridgeImageFunc(emu, (XImage*)image);
|
||||
int32_t r = my->XShmPutImage(disp, drawable, gc, image, src_x, src_y, dst_x, dst_y, w, h, sendevt);
|
||||
// bridge all access functions...
|
||||
BridgeImageFunc(emu, (XImage*)image);
|
||||
return r;
|
||||
}
|
||||
|
||||
EXPORT int32_t my_XShmGetImage(x86emu_t* emu, void* disp, void* drawable, void* image, int32_t x, int32_t y, uint32_t plane)
|
||||
{
|
||||
library_t * lib = GetLib(emu->context->maplib, libxextName);
|
||||
xext_my_t *my = (xext_my_t*)lib->priv.w.p2;
|
||||
|
||||
UnbridgeImageFunc(emu, (XImage*)image);
|
||||
int32_t r = my->XShmGetImage(disp, drawable, image, x, y, plane);
|
||||
// bridge all access functions...
|
||||
BridgeImageFunc(emu, (XImage*)image);
|
||||
return r;
|
||||
}
|
||||
|
||||
#define CUSTOM_INIT \
|
||||
lib->priv.w.p2 = getXextMy(lib);
|
||||
|
||||
#define CUSTOM_FINI \
|
||||
freeXextMy(lib->priv.w.p2); \
|
||||
free(lib->priv.w.p2);
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+139
@@ -0,0 +1,139 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
GO(DPMSCapable, iFp)
|
||||
GO(DPMSDisable, iFp)
|
||||
GO(DPMSEnable, iFp)
|
||||
GO(DPMSForceLevel, iFpu)
|
||||
GO(DPMSGetTimeouts, iFpppp)
|
||||
GO(DPMSGetVersion, iFppp)
|
||||
GO(DPMSInfo, iFppp)
|
||||
GO(DPMSQueryExtension, iFppp)
|
||||
GO(DPMSSetTimeouts, iFpuuu)
|
||||
//GO(XagCreateAssociation,
|
||||
//GO(XagCreateEmbeddedApplicationGroup,
|
||||
//GO(XagCreateNonembeddedApplicationGroup,
|
||||
//GO(XagDestroyApplicationGroup,
|
||||
//GO(XagDestroyAssociation,
|
||||
//GO(XagGetApplicationGroupAttributes,
|
||||
//GO(XagQueryApplicationGroup,
|
||||
//GO(XagQueryVersion,
|
||||
//GO(XcupGetReservedColormapEntries,
|
||||
//GO(XcupQueryVersion,
|
||||
//GO(XcupStoreColors,
|
||||
GO(XdbeAllocateBackBufferName, pFppu)
|
||||
GO(XdbeBeginIdiom, iFp)
|
||||
GO(XdbeDeallocateBackBufferName, iFpp)
|
||||
GO(XdbeEndIdiom, iFp)
|
||||
GO(XdbeFreeVisualInfo, vFp)
|
||||
GO(XdbeGetBackBufferAttributes, pFpp)
|
||||
GO(XdbeGetVisualInfo, pFppp)
|
||||
GO(XdbeQueryExtension, iFppp)
|
||||
GO(XdbeSwapBuffers, iFppi)
|
||||
//GO(XeviGetVisualInfo,
|
||||
//GO(XeviQueryExtension,
|
||||
//GO(XeviQueryVersion,
|
||||
GO(XextAddDisplay, pFppppip)
|
||||
GO(XextCreateExtension, pFv)
|
||||
GO(XextDestroyExtension, vFp)
|
||||
DATAB(_XExtensionErrorFunction, 4)
|
||||
GO(XextFindDisplay, pFpp)
|
||||
GO(XextRemoveDisplay, iFpp)
|
||||
//GO(XGEQueryExtension,
|
||||
//GO(XGEQueryVersion,
|
||||
//GO(XLbxGetEventBase,
|
||||
//GO(XLbxQueryExtension,
|
||||
//GO(XLbxQueryVersion,
|
||||
//GO(XmbufChangeBufferAttributes,
|
||||
//GO(XmbufChangeWindowAttributes,
|
||||
//GO(XmbufClearBufferArea,
|
||||
//GO(XmbufCreateBuffers,
|
||||
//GO(XmbufCreateStereoWindow,
|
||||
//GO(XmbufDestroyBuffers,
|
||||
//GO(XmbufDisplayBuffers,
|
||||
//GO(XmbufGetBufferAttributes,
|
||||
//GO(XmbufGetScreenInfo,
|
||||
//GO(XmbufGetVersion,
|
||||
//GO(XmbufGetWindowAttributes,
|
||||
//GO(XmbufQueryExtension,
|
||||
GO(XMissingExtension, iFpp)
|
||||
//GO(XMITMiscGetBugMode,
|
||||
//GO(XMITMiscQueryExtension,
|
||||
//GO(XMITMiscSetBugMode,
|
||||
//GO(XSecurityAllocXauth,
|
||||
//GO(XSecurityFreeXauth,
|
||||
//GO(XSecurityGenerateAuthorization,
|
||||
//GO(XSecurityQueryExtension,
|
||||
//GO(XSecurityRevokeAuthorization,
|
||||
//GO(XSetExtensionErrorHandler,
|
||||
GO(XShapeCombineMask, vFppiiipi)
|
||||
GO(XShapeCombineRectangles, vFppiiipiii)
|
||||
GO(XShapeCombineRegion, vFppiiipi)
|
||||
GO(XShapeCombineShape, vFppiiipii)
|
||||
GO(XShapeGetRectangles, pFppipp)
|
||||
GO(XShapeInputSelected, uFpp)
|
||||
GO(XShapeOffsetShape, vFppiii)
|
||||
GO(XShapeQueryExtension, iFppp)
|
||||
GO(XShapeQueryExtents, iFpppppppppppp)
|
||||
GO(XShapeQueryVersion, iFppp)
|
||||
GO(XShapeSelectInput, vFppu)
|
||||
GO(XShmAttach, iFpp)
|
||||
GOM(XShmCreateImage, pFEppuippuu) //need brige/unbridge...
|
||||
GO(XShmCreatePixmap, pFppppuuu)
|
||||
GO(XShmDetach, iFpp)
|
||||
GO(XShmGetEventBase, iFp)
|
||||
GOM(XShmGetImage, iFEpppiiu) //need brige/unbridge...
|
||||
GO(XShmPixmapFormat, iFp)
|
||||
GOM(XShmPutImage, iFEppppiiiiuui) //need brige/unbridge...
|
||||
GO(XShmQueryExtension, iFp)
|
||||
GO(XShmQueryVersion, iFpppp)
|
||||
//GO(XSyncAwait,
|
||||
//GO(XSyncAwaitFence,
|
||||
//GO(XSyncChangeAlarm,
|
||||
//GO(XSyncChangeCounter,
|
||||
//GO(XSyncCreateAlarm,
|
||||
//GO(XSyncCreateCounter,
|
||||
//GO(XSyncCreateFence,
|
||||
//GO(XSyncDestroyAlarm,
|
||||
//GO(XSyncDestroyCounter,
|
||||
//GO(XSyncDestroyFence,
|
||||
//GO(XSyncFreeSystemCounterList,
|
||||
//GO(XSyncGetPriority,
|
||||
//GO(XSyncInitialize,
|
||||
//GO(XSyncIntsToValue,
|
||||
//GO(XSyncIntToValue,
|
||||
//GO(XSyncListSystemCounters,
|
||||
//GO(XSyncMaxValue,
|
||||
//GO(XSyncMinValue,
|
||||
//GO(XSyncQueryAlarm,
|
||||
//GO(XSyncQueryCounter,
|
||||
//GO(XSyncQueryExtension,
|
||||
//GO(XSyncQueryFence,
|
||||
//GO(XSyncResetFence,
|
||||
//GO(XSyncSetCounter,
|
||||
//GO(XSyncSetPriority,
|
||||
//GO(XSyncTriggerFence,
|
||||
//GO(XSyncValueAdd,
|
||||
//GO(XSyncValueEqual,
|
||||
//GO(XSyncValueGreaterOrEqual,
|
||||
//GO(XSyncValueGreaterThan,
|
||||
//GO(XSyncValueHigh32,
|
||||
//GO(XSyncValueIsNegative,
|
||||
//GO(XSyncValueIsPositive,
|
||||
//GO(XSyncValueIsZero,
|
||||
//GO(XSyncValueLessOrEqual,
|
||||
//GO(XSyncValueLessThan,
|
||||
//GO(XSyncValueLow32,
|
||||
//GO(XSyncValueSubtract,
|
||||
DATA(XTestFakeAckType, 4)
|
||||
//GO(XTestFakeInput,
|
||||
//GO(XTestFlush,
|
||||
//GO(XTestGetInput,
|
||||
DATAB(XTestInputActionType, 4)
|
||||
//GO(XTestMovePointer,
|
||||
//GO(XTestPressButton,
|
||||
//GO(XTestPressKey,
|
||||
//GO(XTestQueryInputSize,
|
||||
//GO(XTestReset,
|
||||
//GO(XTestStopInput,
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* libxfixesName = "libXfixes.so.3";
|
||||
#define LIBNAME libxfixes
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
GO(XFixesChangeCursor, vFppp)
|
||||
GO(XFixesChangeCursorByName, vFppp)
|
||||
GO(XFixesChangeSaveSet, vFppiii)
|
||||
GO(XFixesCopyRegion, vFppp)
|
||||
GO(XFixesCreatePointerBarrier, pFppiiiiiip)
|
||||
GO(XFixesCreateRegion, pFppi)
|
||||
GO(XFixesCreateRegionFromBitmap, pFpp)
|
||||
GO(XFixesCreateRegionFromGC, pFpp)
|
||||
GO(XFixesCreateRegionFromPicture, pFpp)
|
||||
GO(XFixesCreateRegionFromWindow, pFppi)
|
||||
GO(XFixesDestroyPointerBarrier, vFpp)
|
||||
GO(XFixesDestroyRegion, vFpp)
|
||||
GO(XFixesExpandRegion, vFpppuuuu)
|
||||
DATA(XFixesExtensionInfo, 4) //B
|
||||
DATA(XFixesExtensionName, 4) //D
|
||||
GO(XFixesFetchRegion, pFppp)
|
||||
GO(XFixesFetchRegionAndBounds, pFpppp)
|
||||
GO(XFixesFindDisplay, pFp)
|
||||
GO(XFixesGetCursorImage, pFp)
|
||||
GO(XFixesGetCursorName, pFppp)
|
||||
GO(XFixesHideCursor, vFpp)
|
||||
GO(XFixesIntersectRegion, vFpppp)
|
||||
GO(XFixesInvertRegion, vFpppp)
|
||||
GO(XFixesQueryExtension, iFppp)
|
||||
GO(XFixesQueryVersion, iFppp)
|
||||
GO(XFixesRegionExtents, vFppp)
|
||||
GO(XFixesSelectCursorInput, vFppu)
|
||||
GO(XFixesSelectSelectionInput, vFpppu)
|
||||
GO(XFixesSetCursorName, vFppp)
|
||||
GO(XFixesSetGCClipRegion, vFppiip)
|
||||
GO(XFixesSetPictureClipRegion, vFppiip)
|
||||
GO(XFixesSetRegion, vFpppi)
|
||||
GO(XFixesSetWindowShapeRegion, vFppiiip)
|
||||
GO(XFixesShowCursor, vFpp)
|
||||
GO(XFixesSubtractRegion, vFpppp)
|
||||
GO(XFixesTranslateRegion, vFppii)
|
||||
GO(XFixesUnionRegion, vFpppp)
|
||||
GO(XFixesVersion, iFv)
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* libxiName = "libXi.so.6";
|
||||
#define LIBNAME libxi
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
//GO(XAllowDeviceEvents,
|
||||
//GO(XChangeDeviceControl,
|
||||
//GO(XChangeDeviceDontPropagateList,
|
||||
//GO(XChangeDeviceKeyMapping,
|
||||
//GO(XChangeDeviceProperty,
|
||||
//GO(XChangeFeedbackControl,
|
||||
//GO(XChangeKeyboardDevice,
|
||||
//GO(XChangePointerDevice,
|
||||
//GO(XCloseDevice,
|
||||
//GO(XDeleteDeviceProperty,
|
||||
//GO(XDeviceBell,
|
||||
//GO(XFreeDeviceControl,
|
||||
//GO(XFreeDeviceList,
|
||||
//GO(XFreeDeviceMotionEvents,
|
||||
//GO(XFreeDeviceState,
|
||||
//GO(XFreeFeedbackList,
|
||||
//GO(XGetDeviceButtonMapping,
|
||||
//GO(XGetDeviceControl,
|
||||
//GO(XGetDeviceDontPropagateList,
|
||||
//GO(XGetDeviceFocus,
|
||||
//GO(XGetDeviceKeyMapping,
|
||||
//GO(XGetDeviceModifierMapping,
|
||||
//GO(XGetDeviceMotionEvents,
|
||||
//GO(XGetDeviceProperty,
|
||||
//GO(XGetExtensionVersion,
|
||||
//GO(XGetFeedbackControl,
|
||||
//GO(XGetSelectedExtensionEvents,
|
||||
//GO(XGrabDevice,
|
||||
//GO(XGrabDeviceButton,
|
||||
//GO(XGrabDeviceKey,
|
||||
//GO(XIAllowEvents,
|
||||
//GO(XIAllowTouchEvents,
|
||||
//GO(XIBarrierReleasePointer,
|
||||
//GO(XIBarrierReleasePointers,
|
||||
//GO(XIChangeHierarchy,
|
||||
//GO(XIChangeProperty,
|
||||
//GO(XIDefineCursor,
|
||||
//GO(XIDeleteProperty,
|
||||
GO(XIFreeDeviceInfo, vFp)
|
||||
//GO(XIGetClientPointer,
|
||||
//GO(XIGetFocus,
|
||||
//GO(XIGetProperty,
|
||||
GO(XIGetSelectedEvents, iFpppi)
|
||||
//GO(XIGrabButton,
|
||||
//GO(XIGrabDevice,
|
||||
//GO(XIGrabEnter,
|
||||
//GO(XIGrabFocusIn,
|
||||
//GO(XIGrabKeycode,
|
||||
//GO(XIGrabTouchBegin,
|
||||
//GO(XIListProperties,
|
||||
GO(XIQueryDevice, pFpip)
|
||||
GO(XIQueryPointer, iFpipppppppppp)
|
||||
GO(XIQueryVersion, iFppp)
|
||||
GO(XISelectEvents, iFpppi)
|
||||
//GO(XISetClientPointer,
|
||||
//GO(XISetFocus,
|
||||
//GO(XIUndefineCursor,
|
||||
//GO(XIUngrabButton,
|
||||
//GO(XIUngrabDevice,
|
||||
//GO(XIUngrabEnter,
|
||||
//GO(XIUngrabFocusIn,
|
||||
//GO(XIUngrabKeycode,
|
||||
//GO(XIUngrabTouchBegin,
|
||||
//GO(XIWarpPointer,
|
||||
//GO(XListDeviceProperties,
|
||||
//GO(XListInputDevices,
|
||||
//GO(XOpenDevice,
|
||||
//GO(XQueryDeviceState,
|
||||
//GO(XSelectExtensionEvent,
|
||||
//GO(XSendExtensionEvent,
|
||||
//GO(XSetDeviceButtonMapping,
|
||||
//GO(XSetDeviceFocus,
|
||||
//GO(XSetDeviceMode,
|
||||
//GO(XSetDeviceModifierMapping,
|
||||
//GO(XSetDeviceValuators,
|
||||
//GO(XUngrabDevice,
|
||||
//GO(XUngrabDeviceButton,
|
||||
//GO(XUngrabDeviceKey,
|
||||
//GO(_XiGetDevicePresenceNotifyEvent,
|
||||
//GO(_xibadclass,
|
||||
//GO(_xibaddevice,
|
||||
//GO(_xibadevent,
|
||||
//GO(_xibadmode,
|
||||
//GO(_xidevicebusy,
|
||||
@@ -5,7 +5,7 @@
|
||||
GO(XRRQueryVersion,iFppp)
|
||||
GO(XRRFreeScreenConfigInfo,vFp)
|
||||
GO(XRRGetCrtcInfo, pFppu)
|
||||
//GO(XRRListOutputProperties
|
||||
GO(XRRListOutputProperties, pFpup)
|
||||
GO(XRRQueryExtension, iFppp)
|
||||
//GO(XRRAllocModeInfo
|
||||
//GO(XRRGetProviderProperty
|
||||
@@ -30,7 +30,7 @@ GO(XRRSetScreenConfig,iFpppiuu)
|
||||
GO(XRRSetScreenSize, vFppiiii)
|
||||
GO(XRRSetScreenConfigAndRate,iFpppiuwu)
|
||||
GO(XRRFreeScreenResources, vFp)
|
||||
//GO(XRRGetOutputPrimary
|
||||
GO(XRRGetOutputPrimary, uFpp)
|
||||
//GO(XRRCreateMode
|
||||
GO(XRRConfigCurrentRate,wFp)
|
||||
//GO(XRRDestroyMode
|
||||
@@ -51,8 +51,8 @@ GO(XRRGetScreenSizeRange, iFpppppp)
|
||||
GO(XRRRates,pFpiip)
|
||||
//GO(XRRFreeProviderInfo
|
||||
GO(XRRConfigRates,pFpip)
|
||||
//GO(XRRQueryOutputProperty
|
||||
//GO(XRRGetOutputProperty
|
||||
GO(XRRQueryOutputProperty, pFpup)
|
||||
GO(XRRGetOutputProperty, iFpupiiiipppppp)
|
||||
//GO(XRRFreeGamma
|
||||
GO(XRRRootToScreen,iFp)
|
||||
GO(XRRGetScreenInfo,pFpp)
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* libxrenderName = "libXrender.so.1";
|
||||
#define LIBNAME libxrender
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
GO(XRenderAddGlyphs, vFppppipi)
|
||||
GO(XRenderAddTraps, vFppiipi)
|
||||
GO(XRenderChangePicture, vFppup)
|
||||
GO(XRenderComposite, vFppup)
|
||||
GO(XRenderCompositeDoublePoly, vFpipppiiiipii)
|
||||
GO(XRenderCompositeString16, vFpippppiiiipi)
|
||||
GO(XRenderCompositeString32, vFpippppiiiipi)
|
||||
GO(XRenderCompositeString8, vFpippppiiiipi)
|
||||
GO(XRenderCompositeText16, vFpipppiiiipi)
|
||||
GO(XRenderCompositeText32, vFpipppiiiipi)
|
||||
GO(XRenderCompositeText8, vFpipppiiiipi)
|
||||
GO(XRenderCompositeTrapezoids, vFpipppiipi)
|
||||
GO(XRenderCompositeTriangles, vFpipppiipi)
|
||||
GO(XRenderCompositeTriFan, vFpipppiipi)
|
||||
GO(XRenderCompositeTriStrip, vFpipppiipi)
|
||||
GO(XRenderCreateAnimCursor, pFpip)
|
||||
GO(XRenderCreateConicalGradient, pFppppi)
|
||||
GO(XRenderCreateCursor, pFppii)
|
||||
GO(XRenderCreateGlyphSet, pFpp)
|
||||
GO(XRenderCreateLinearGradient, pFppppi)
|
||||
GO(XRenderCreatePicture, pFpppup)
|
||||
GO(XRenderCreateRadialGradient, pFppppi)
|
||||
GO(XRenderCreateSolidFill, pFpp)
|
||||
DATA(XRenderExtensionInfo, 4) //B
|
||||
DATA(XRenderExtensionName, 4) //D
|
||||
GO(XRenderFillRectangle, vFpippiiuu)
|
||||
GO(XRenderFillRectangles, vFpipppi)
|
||||
GO(XRenderFindDisplay, pFp)
|
||||
GO(XRenderFindFormat, pFpupi)
|
||||
GO(XRenderFindStandardFormat, pFpi)
|
||||
GO(XRenderFindVisualFormat, pFpp)
|
||||
GO(XRenderFreeGlyphs, vFpppi)
|
||||
GO(XRenderFreeGlyphSet, vFpp)
|
||||
GO(XRenderFreePicture, vFpp)
|
||||
GO(XRenderParseColor, iFppp)
|
||||
GO(XRenderQueryExtension, iFppp)
|
||||
GO(XRenderQueryFilters, pFpp)
|
||||
GO(XRenderQueryFormats, iFp)
|
||||
GO(XRenderQueryPictIndexValues, pFppp)
|
||||
GO(XRenderQuerySubpixelOrder, iFpi)
|
||||
GO(XRenderQueryVersion, iFppp)
|
||||
GO(XRenderReferenceGlyphSet, pFpp)
|
||||
GO(XRenderSetPictureClipRectangles, vFppiipi)
|
||||
GO(XRenderSetPictureClipRegion, vGppp)
|
||||
GO(XRenderSetPictureFilter, vFppppi)
|
||||
GO(XRenderSetPictureTransform, vFppp)
|
||||
GO(XRenderSetSubpixelOrder, iFpii)
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
#include "wrapper.h"
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
|
||||
const char* libxssName = "libXss.so.1";
|
||||
#define LIBNAME libxss
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
|
||||
#error Meh....
|
||||
#endif
|
||||
|
||||
GO(XScreenSaverAllocInfo, pFv)
|
||||
GO(XScreenSaverGetRegistered, uFpipp)
|
||||
GO(XScreenSaverQueryExtension, iFppp)
|
||||
GO(XScreenSaverQueryInfo, iFppp)
|
||||
GO(XScreenSaverQueryVersion, iFppp)
|
||||
GO(XScreenSaverRegister, vFpiup)
|
||||
GO(XScreenSaverSelectInput, vFppu)
|
||||
GO(XScreenSaverSetAttributes, vFppiiuuuiupup)
|
||||
GO(XScreenSaverSuspend, vFpi)
|
||||
GO(XScreenSaverUnregister, iFpi)
|
||||
GO(XScreenSaverUnsetAttributes, vFpp)
|
||||
Regular → Executable
+134
@@ -10,9 +10,143 @@
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
#include "debug.h"
|
||||
#include "callback.h"
|
||||
#include "x86emu_private.h"
|
||||
#include "box86context.h"
|
||||
|
||||
const char* libzName = "libz.so.1";
|
||||
#define LIBNAME libz
|
||||
|
||||
// TODO: put the wrapper type in a dedicate include
|
||||
typedef void* (*pFpi_t)(void*, int32_t);
|
||||
typedef void* (*pFp_t)(void*);
|
||||
typedef void* (*pFpp_t)(void*, void*);
|
||||
typedef int32_t (*iFp_t)(void*);
|
||||
typedef int32_t (*iFppi_t)(void*, void*, int32_t);
|
||||
typedef void* (*pFpippp_t)(void*, int32_t, void*, void*, void*);
|
||||
typedef void (*vFp_t)(void*);
|
||||
typedef void* (*pFpp_t)(void*, void*);
|
||||
typedef uint32_t (*uFp_t)(void*);
|
||||
typedef uint64_t (*UFp_t)(void*);
|
||||
typedef uint32_t (*uFu_t)(uint32_t);
|
||||
typedef int32_t (*iFpp_t)(void*, void*);
|
||||
typedef uint32_t (*uFpW_t)(void*, uint16_t);
|
||||
typedef uint32_t (*uFpu_t)(void*, uint32_t);
|
||||
typedef uint32_t (*uFpU_t)(void*, uint64_t);
|
||||
typedef uint32_t (*uFupp_t)(uint32_t, void*, void*);
|
||||
|
||||
typedef struct libz_my_s {
|
||||
// functions
|
||||
iFppi_t inflateInit_;
|
||||
iFp_t inflateInit;
|
||||
iFp_t inflateEnd;
|
||||
} libz_my_t;
|
||||
|
||||
|
||||
void* getZMy(library_t* lib)
|
||||
{
|
||||
libz_my_t* my = (libz_my_t*)calloc(1, sizeof(libz_my_t));
|
||||
#define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
|
||||
GO(inflateInit_, iFppi_t)
|
||||
GO(inflateInit, iFp_t)
|
||||
GO(inflateEnd, iFp_t)
|
||||
#undef GO
|
||||
return my;
|
||||
}
|
||||
|
||||
void freeZMy(void* lib)
|
||||
{
|
||||
libz_my_t *my = (libz_my_t *)lib;
|
||||
}
|
||||
|
||||
|
||||
typedef struct z_stream_s {
|
||||
void *next_in;
|
||||
uint32_t avail_in;
|
||||
uint32_t total_in;
|
||||
void *next_out;
|
||||
uint32_t avail_out;
|
||||
uint32_t total_out;
|
||||
char *msg;
|
||||
void *state;
|
||||
void* zalloc;
|
||||
void* zfree;
|
||||
void* opaque;
|
||||
int32_t data_type;
|
||||
uint32_t adler;
|
||||
uint32_t reserved;
|
||||
} z_stream;
|
||||
|
||||
static void* my_zlib_alloc(void* opaque, uint32_t items, uint32_t size)
|
||||
{
|
||||
x86emu_t *emu = (x86emu_t*)opaque;
|
||||
SetCallbackNArg(emu, 3);
|
||||
SetCallbackArg(emu, 1, (void*)items);
|
||||
SetCallbackArg(emu, 2, (void*)size);
|
||||
SetCallbackAddress(emu, (uintptr_t)GetCallbackArg(emu, 4));
|
||||
return (void*)RunCallback(emu);
|
||||
}
|
||||
|
||||
static void my_zlib_free(void* opaque, void* address)
|
||||
{
|
||||
x86emu_t *emu = (x86emu_t*)opaque;
|
||||
SetCallbackNArg(emu, 2);
|
||||
SetCallbackArg(emu, 1, address);
|
||||
SetCallbackAddress(emu, (uintptr_t)GetCallbackArg(emu, 5));
|
||||
RunCallback(emu);
|
||||
}
|
||||
|
||||
static void wrapper_stream_z(x86emu_t* emu, void* str)
|
||||
{
|
||||
z_stream *stream = (z_stream*)str;
|
||||
x86emu_t *cb = NULL;
|
||||
if(stream->zalloc || stream->zfree) {
|
||||
cb = AddCallback(emu, 0, 3, stream->opaque, NULL, NULL, NULL); // address will be put later
|
||||
SetCallbackArg(cb, 4, stream->zalloc);
|
||||
SetCallbackArg(cb, 5, stream->zfree);
|
||||
stream->opaque = cb;
|
||||
if(stream->zalloc) stream->zalloc = my_zlib_alloc;
|
||||
if(stream->zfree) stream->zfree = my_zlib_free;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT int32_t my_inflateInit_(x86emu_t* emu, void* str, void* version, int32_t size)
|
||||
{
|
||||
libz_my_t *my = (libz_my_t *)emu->context->zlib->priv.w.p2;
|
||||
wrapper_stream_z(emu, str);
|
||||
return my->inflateInit_(str, version, size);
|
||||
}
|
||||
|
||||
EXPORT int32_t my_inflateInit(x86emu_t* emu, void* str)
|
||||
{
|
||||
libz_my_t *my = (libz_my_t *)emu->context->zlib->priv.w.p2;
|
||||
wrapper_stream_z(emu, str);
|
||||
return my->inflateInit(str);
|
||||
}
|
||||
|
||||
EXPORT int32_t my_inflateEnd(x86emu_t* emu, void* str)
|
||||
{
|
||||
libz_my_t *my = (libz_my_t *)emu->context->zlib->priv.w.p2;
|
||||
z_stream *stream = (z_stream*)str;
|
||||
// check if function need changing...
|
||||
x86emu_t *cb = (x86emu_t*)stream->opaque;
|
||||
int32_t r = my->inflateEnd(str);
|
||||
if(cb) {
|
||||
stream->opaque = GetCallbackArg(cb, 0);
|
||||
FreeCallback(cb); // will do nothing if cb is not a callback emu
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#define CUSTOM_INIT \
|
||||
box86->zlib = lib; \
|
||||
lib->priv.w.p2 = getZMy(lib);
|
||||
|
||||
#define CUSTOM_FINI \
|
||||
freeZMy(lib->priv.w.p2); \
|
||||
free(lib->priv.w.p2); \
|
||||
((box86context_t*)(lib->context))->zlib = NULL;
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
@@ -6,9 +6,9 @@ GO(zlibVersion, pFv)
|
||||
GO(deflateInit, iFpi)
|
||||
GO(deflate, iFpi)
|
||||
GO(deflateEnd, iFp)
|
||||
GO(inflateInit, iFp)
|
||||
GOM(inflateInit, iFEp)
|
||||
GO(inflate, iFpi)
|
||||
GO(inflateEnd, iFp)
|
||||
GOM(inflateEnd, iFEp)
|
||||
GO(deflateInit2, iFpiiiiipi)
|
||||
GO(deflateSetDictionary, iFppu)
|
||||
GO(deflateGetDictionary, iFppp)
|
||||
@@ -72,7 +72,7 @@ GO(crc32, uFupu)
|
||||
GO(crc32_z, uFupu)
|
||||
GO(crc32_combine, uFuui)
|
||||
GO(deflateInit_, iFpipi)
|
||||
GO(inflateInit_, iFppi)
|
||||
GOM(inflateInit_, iFEppi)
|
||||
GO(deflateInit2_, iFpiiiiipi)
|
||||
GO(inflateInit2_, iFpipi)
|
||||
GO(inflateBackInit_, iFpippi)
|
||||
|
||||
+1
-1
@@ -58,5 +58,5 @@ EXPORT void* my_alGetProcAddress(x86emu_t* emu, void* name)
|
||||
printf_log(LOG_INFO, "Warning, no wrapper for %s\n", rname);
|
||||
return NULL;
|
||||
}
|
||||
return (void*)AddBridge(emu->context->system, kh_value(emu->context->alwrappers, k), symbol);
|
||||
return (void*)AddBridge(emu->context->system, kh_value(emu->context->alwrappers, k), symbol, 0);
|
||||
}
|
||||
+49
-1
@@ -46,6 +46,7 @@ typedef struct {
|
||||
|
||||
// TODO: put the wrapper type in a dedicate include
|
||||
typedef void* (*pFpi_t)(void*, int32_t);
|
||||
typedef void* (*pFp_t)(void*);
|
||||
typedef void* (*pFpp_t)(void*, void*);
|
||||
typedef int32_t (*iFppi_t)(void*, void*, int32_t);
|
||||
typedef void* (*pFpippp_t)(void*, int32_t, void*, void*, void*);
|
||||
@@ -90,6 +91,7 @@ typedef struct sdl1_my_s {
|
||||
pFpp_t SDL_CreateThread;
|
||||
vFp_t SDL_KillThread;
|
||||
vFp_t SDL_SetEventFilter;
|
||||
pFp_t SDL_GL_GetProcAddress;
|
||||
// timer map
|
||||
kh_timercb_t *timercb;
|
||||
uint32_t settimer;
|
||||
@@ -132,6 +134,7 @@ void* getSDL1My(library_t* lib)
|
||||
GO(SDL_CreateThread, pFpp_t)
|
||||
GO(SDL_KillThread, vFp_t)
|
||||
GO(SDL_SetEventFilter, vFp_t)
|
||||
GO(SDL_GL_GetProcAddress, pFp_t)
|
||||
#undef GO
|
||||
my->timercb = kh_init(timercb);
|
||||
my->threads = kh_init(timercb);
|
||||
@@ -483,9 +486,54 @@ void EXPORT my_SDL_KillThread(x86emu_t* emu, void* p)
|
||||
}
|
||||
}
|
||||
|
||||
kh_symbolmap_t * fillGLProcWrapper();
|
||||
EXPORT void* my_SDL_GL_GetProcAddress(x86emu_t* emu, void* name)
|
||||
{
|
||||
const char* rname = (const char*)name;
|
||||
printf_log(LOG_DEBUG, "Calling SDL_GL_GetProcAddress(%s)\n", rname);
|
||||
sdl1_my_t *my = (sdl1_my_t *)emu->context->sdl1lib->priv.w.p2;
|
||||
// check if glxprocaddress is filled, and search for lib and fill it if needed
|
||||
if(!emu->context->glwrappers)
|
||||
emu->context->glwrappers = fillGLProcWrapper();
|
||||
// get proc adress using actual glXGetProcAddress
|
||||
void* symbol = my->SDL_GL_GetProcAddress(name);
|
||||
if(!symbol)
|
||||
return NULL; // easy
|
||||
// check if alread bridged
|
||||
uintptr_t ret = CheckBridged(emu->context->system, symbol);
|
||||
if(ret)
|
||||
return (void*)ret; // already bridged
|
||||
// get wrapper
|
||||
khint_t k = kh_get(symbolmap, emu->context->glwrappers, rname);
|
||||
if(k==kh_end(emu->context->glwrappers) && strstr(rname, "ARB")==NULL) {
|
||||
// try again, adding ARB at the end if not present
|
||||
char tmp[200];
|
||||
strcpy(tmp, rname);
|
||||
strcat(tmp, "ARB");
|
||||
k = kh_get(symbolmap, emu->context->glwrappers, tmp);
|
||||
}
|
||||
if(k==kh_end(emu->context->glwrappers) && strstr(rname, "EXT")==NULL) {
|
||||
// try again, adding EXT at the end if not present
|
||||
char tmp[200];
|
||||
strcpy(tmp, rname);
|
||||
strcat(tmp, "EXT");
|
||||
k = kh_get(symbolmap, emu->context->glwrappers, tmp);
|
||||
}
|
||||
if(k==kh_end(emu->context->glwrappers)) {
|
||||
printf_log(LOG_INFO, "Warning, no wrapper for %s\n", rname);
|
||||
return NULL;
|
||||
}
|
||||
return (void*)AddBridge(emu->context->system, kh_value(emu->context->glwrappers, k), symbol, 0);
|
||||
}
|
||||
|
||||
#define CUSTOM_INIT \
|
||||
box86->sdl1lib = lib; \
|
||||
lib->priv.w.p2 = getSDL1My(lib);
|
||||
lib->priv.w.p2 = getSDL1My(lib); \
|
||||
lib->priv.w.needed = 3; \
|
||||
lib->priv.w.neededlibs = (char**)calloc(lib->priv.w.needed, sizeof(char*)); \
|
||||
lib->priv.w.neededlibs[0] = strdup("libm.so.6"); \
|
||||
lib->priv.w.neededlibs[1] = strdup("libdl.so.2"); \
|
||||
lib->priv.w.neededlibs[2] = strdup("librt.so.1");
|
||||
|
||||
#define CUSTOM_FINI \
|
||||
freeSDL1My(lib->priv.w.p2); \
|
||||
|
||||
@@ -47,7 +47,7 @@ GOM(SDL_FreeRW, vFEp)
|
||||
GO(SDL_FreeSurface, vFp)
|
||||
GO(SDL_FreeYUVOverlay, vFp)
|
||||
GO(SDL_GL_GetAttribute, iFup)
|
||||
GO(SDL_GL_GetProcAddress, pFp)
|
||||
GOM(SDL_GL_GetProcAddress, pFEp)
|
||||
GO(SDL_GL_LoadLibrary, iFp)
|
||||
GO(SDL_GL_Lock, vFv)
|
||||
GO(SDL_GL_SetAttribute, iFui)
|
||||
|
||||
+143
-1
@@ -46,8 +46,28 @@ typedef struct {
|
||||
|
||||
KHASH_MAP_INIT_INT(timercb, x86emu_t*)
|
||||
|
||||
typedef struct {
|
||||
uint8_t data[16];
|
||||
} SDL_JoystickGUID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t bindType; // enum
|
||||
union
|
||||
{
|
||||
int button;
|
||||
int axis;
|
||||
struct {
|
||||
int hat;
|
||||
int hat_mask;
|
||||
} hat;
|
||||
} value;
|
||||
} SDL_GameControllerButtonBind;
|
||||
|
||||
|
||||
// TODO: put the wrapper type in a dedicate include
|
||||
typedef void* (*pFpi_t)(void*, int32_t);
|
||||
typedef void* (*pFp_t)(void*);
|
||||
typedef void* (*pFpp_t)(void*, void*);
|
||||
typedef int32_t (*iFppi_t)(void*, void*, int32_t);
|
||||
typedef int32_t (*iFpippi_t)(void*, int32_t, void*, void*, int32_t);
|
||||
@@ -65,10 +85,13 @@ typedef uint32_t (*uFupp_t)(uint32_t, void*, void*);
|
||||
typedef uint64_t (*UFp_t)(void*);
|
||||
typedef int32_t (*iFpi_t)(void*, int32_t);
|
||||
typedef int32_t (*iFpp_t)(void*, void*);
|
||||
typedef int32_t (*iFupp_t)(uint32_t, void*, void*);
|
||||
typedef uint32_t (*uFpC_t)(void*, uint8_t);
|
||||
typedef uint32_t (*uFpW_t)(void*, uint16_t);
|
||||
typedef uint32_t (*uFpu_t)(void*, uint32_t);
|
||||
typedef uint32_t (*uFpU_t)(void*, uint64_t);
|
||||
typedef SDL_JoystickGUID (*SFi_t)(int32_t);
|
||||
typedef SDL_GameControllerButtonBind (*SFpi_t)(void*, int32_t);
|
||||
|
||||
typedef struct sdl2_my_s {
|
||||
iFpp_t SDL_OpenAudio;
|
||||
@@ -104,6 +127,10 @@ typedef struct sdl2_my_s {
|
||||
vFpp_t SDL_SetEventFilter;
|
||||
vFpp_t SDL_LogSetOutputFunction;
|
||||
vFiupp_t SDL_LogMessageV;
|
||||
pFp_t SDL_GL_GetProcAddress;
|
||||
iFupp_t SDL_TLSSet;
|
||||
SFi_t SDL_JoystickGetDeviceGUID;
|
||||
SFpi_t SDL_GameControllerGetBindForAxis;
|
||||
// timer map
|
||||
kh_timercb_t *timercb;
|
||||
uint32_t settimer;
|
||||
@@ -152,6 +179,10 @@ void* getSDL2My(library_t* lib)
|
||||
GO(SDL_SetEventFilter, vFpp_t)
|
||||
GO(SDL_LogSetOutputFunction, vFpp_t)
|
||||
GO(SDL_LogMessageV, vFiupp_t)
|
||||
GO(SDL_GL_GetProcAddress, pFp_t)
|
||||
GO(SDL_TLSSet, iFupp_t)
|
||||
GO(SDL_JoystickGetDeviceGUID, SFi_t)
|
||||
GO(SDL_GameControllerGetBindForAxis, SFpi_t)
|
||||
#undef GO
|
||||
my->timercb = kh_init(timercb);
|
||||
my->threads = kh_init(timercb);
|
||||
@@ -682,9 +713,120 @@ EXPORT void my2_SDL_Log(x86emu_t* emu, void* fmt, void *b) {
|
||||
#endif
|
||||
}
|
||||
|
||||
kh_symbolmap_t * fillGLProcWrapper();
|
||||
EXPORT void* my2_SDL_GL_GetProcAddress(x86emu_t* emu, void* name)
|
||||
{
|
||||
const char* rname = (const char*)name;
|
||||
printf_log(LOG_DEBUG, "Calling SDL_GL_GetProcAddress(%s)\n", rname);
|
||||
sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2;
|
||||
// check if glxprocaddress is filled, and search for lib and fill it if needed
|
||||
if(!emu->context->glwrappers)
|
||||
emu->context->glwrappers = fillGLProcWrapper();
|
||||
// get proc adress using actual glXGetProcAddress
|
||||
void* symbol = my->SDL_GL_GetProcAddress(name);
|
||||
if(!symbol)
|
||||
return NULL; // easy
|
||||
// check if alread bridged
|
||||
uintptr_t ret = CheckBridged(emu->context->system, symbol);
|
||||
if(ret)
|
||||
return (void*)ret; // already bridged
|
||||
// get wrapper
|
||||
khint_t k = kh_get(symbolmap, emu->context->glwrappers, rname);
|
||||
if(k==kh_end(emu->context->glwrappers) && strstr(rname, "ARB")==NULL) {
|
||||
// try again, adding ARB at the end if not present
|
||||
char tmp[200];
|
||||
strcpy(tmp, rname);
|
||||
strcat(tmp, "ARB");
|
||||
k = kh_get(symbolmap, emu->context->glwrappers, tmp);
|
||||
}
|
||||
if(k==kh_end(emu->context->glwrappers) && strstr(rname, "EXT")==NULL) {
|
||||
// try again, adding EXT at the end if not present
|
||||
char tmp[200];
|
||||
strcpy(tmp, rname);
|
||||
strcat(tmp, "EXT");
|
||||
k = kh_get(symbolmap, emu->context->glwrappers, tmp);
|
||||
}
|
||||
if(k==kh_end(emu->context->glwrappers)) {
|
||||
printf_log(LOG_INFO, "Warning, no wrapper for %s\n", rname);
|
||||
return NULL;
|
||||
}
|
||||
return (void*)AddBridge(emu->context->system, kh_value(emu->context->glwrappers, k), symbol, 0);
|
||||
}
|
||||
|
||||
#define nb_once 16
|
||||
typedef void(*sdl2_tls_dtor)(void*);
|
||||
static x86emu_t *dtor_emu[nb_once] = {0};
|
||||
static void tls_dtor_callback(int n, void* a)
|
||||
{
|
||||
if(dtor_emu[n]) {
|
||||
SetCallbackArg(dtor_emu[n], 0, a);
|
||||
RunCallback(dtor_emu[n]);
|
||||
}
|
||||
}
|
||||
#define GO(N) \
|
||||
void tls_dtor_callback_##N(void* a) \
|
||||
{ \
|
||||
tls_dtor_callback(N, a); \
|
||||
}
|
||||
|
||||
const char* sdl2Name = "libSDL2-2.0.so";
|
||||
GO(0)
|
||||
GO(1)
|
||||
GO(2)
|
||||
GO(3)
|
||||
GO(4)
|
||||
GO(5)
|
||||
GO(6)
|
||||
GO(7)
|
||||
GO(8)
|
||||
GO(9)
|
||||
GO(10)
|
||||
GO(11)
|
||||
GO(12)
|
||||
GO(13)
|
||||
GO(14)
|
||||
GO(15)
|
||||
#undef GO
|
||||
static const sdl2_tls_dtor dtor_cb[nb_once] = {
|
||||
tls_dtor_callback_0, tls_dtor_callback_1, tls_dtor_callback_2, tls_dtor_callback_3
|
||||
,tls_dtor_callback_4, tls_dtor_callback_5, tls_dtor_callback_6, tls_dtor_callback_7
|
||||
,tls_dtor_callback_8, tls_dtor_callback_9, tls_dtor_callback_10,tls_dtor_callback_11
|
||||
,tls_dtor_callback_12,tls_dtor_callback_13,tls_dtor_callback_14,tls_dtor_callback_15
|
||||
};
|
||||
EXPORT int32_t my2_SDL_TLSSet(x86emu_t* emu, uint32_t id, void* value, void* dtor)
|
||||
{
|
||||
sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2;
|
||||
|
||||
if(!dtor)
|
||||
return my->SDL_TLSSet(id, value, NULL);
|
||||
int n = 0;
|
||||
while (n<nb_once) {
|
||||
if(!dtor_emu[n] || GetCallbackAddress(dtor_emu[n])==((uintptr_t)dtor)) {
|
||||
if(!dtor_emu[n])
|
||||
dtor_emu[n] = AddCallback(emu, (uintptr_t)dtor, 1, NULL, NULL, NULL, NULL);
|
||||
return my->SDL_TLSSet(id, value, dtor_cb[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
printf_log(LOG_NONE, "Error: SDL2 SDL_TLSSet with destructor: no more slot!\n");
|
||||
//emu->quit = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
EXPORT void* my2_SDL_JoystickGetDeviceGUID(x86emu_t* emu, void* p, int32_t idx)
|
||||
{
|
||||
sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2;
|
||||
*(SDL_JoystickGUID*)p = my->SDL_JoystickGetDeviceGUID(idx);
|
||||
return p;
|
||||
}
|
||||
|
||||
EXPORT void* my2_SDL_GameControllerGetBindForAxis(x86emu_t* emu, void* p, void* controller, int32_t axis)
|
||||
{
|
||||
sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2;
|
||||
*(SDL_GameControllerButtonBind*)p = my->SDL_GameControllerGetBindForAxis(controller, axis);
|
||||
return p;
|
||||
}
|
||||
|
||||
const char* sdl2Name = "libSDL2-2.0.so.0";
|
||||
#define LIBNAME sdl2
|
||||
|
||||
#define CUSTOM_INIT \
|
||||
|
||||
Loaded 100 of 121 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user