diff --git a/CMakeLists.txt b/CMakeLists.txt index e45ff92..0b024bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,11 @@ else() add_definitions(-DRELEASE) endif() +option(LX_LEGACY "Enable OS/2 binary support (vs just native apps)" TRUE) +if(NOT LX_LEGACY) + add_definitions(-DLX_LEGACY=0) +endif() + add_definitions(-std=c99 -Wall -ggdb3) add_definitions(-D_FILE_OFFSET_BITS=64) @@ -68,29 +73,41 @@ endif() include_directories("/usr/local/include/SDL2") add_library(2ine SHARED "lib2ine.c") -set_target_properties(2ine PROPERTIES COMPILE_FLAGS "-m32") -set_target_properties(2ine PROPERTIES LINK_FLAGS "-m32 -ggdb3") +if(LX_LEGACY) + set_target_properties(2ine PROPERTIES COMPILE_FLAGS "-m32") + set_target_properties(2ine PROPERTIES LINK_FLAGS "-m32 -ggdb3") +endif() target_link_libraries(2ine "pthread") foreach(_I doscalls;msg;nls;quecalls;viocalls;kbdcalls;sesmgr;som;pmwin;pmshapi;pmgpi;tcpip32) add_library(${_I} SHARED "native/${_I}.c") - set_target_properties(${_I} PROPERTIES COMPILE_FLAGS "-m32") - set_target_properties(${_I} PROPERTIES LINK_FLAGS "-m32 -ggdb3") + if(LX_LEGACY) + set_target_properties(${_I} PROPERTIES COMPILE_FLAGS "-m32") + set_target_properties(${_I} PROPERTIES LINK_FLAGS "-m32 -ggdb3") + endif() target_link_libraries(${_I} 2ine) endforeach() target_link_libraries(doscalls "pthread") # FIXME target_link_libraries(viocalls ${CURSES_LIBRARIES}) target_link_libraries(viocalls ncursesw) -target_link_libraries(pmwin "${CMAKE_CURRENT_SOURCE_DIR}/libSDL2-2.0.so.0") + +# !!! FIXME: clean this up/ +if(LX_LEGACY) + target_link_libraries(pmwin "${CMAKE_CURRENT_SOURCE_DIR}/libSDL2-2.0.so.0") +else() + target_link_libraries(pmwin "SDL2") +endif() add_executable(lx_dump lx_dump.c) -add_executable(lx_loader lx_loader.c) -target_link_libraries(lx_loader 2ine) -target_link_libraries(lx_loader "dl") -set_target_properties(lx_loader PROPERTIES COMPILE_FLAGS "-m32") -set_target_properties(lx_loader PROPERTIES LINK_FLAGS "-m32 -ggdb3") +if(LX_LEGACY) + add_executable(lx_loader lx_loader.c) + target_link_libraries(lx_loader 2ine) + target_link_libraries(lx_loader "dl") + set_target_properties(lx_loader PROPERTIES COMPILE_FLAGS "-m32") + set_target_properties(lx_loader PROPERTIES LINK_FLAGS "-m32 -ggdb3") +endif() # end of CMakeLists.txt ... diff --git a/native/doscalls.c b/native/doscalls.c index f27d1c5..dd05845 100644 --- a/native/doscalls.c +++ b/native/doscalls.c @@ -463,6 +463,9 @@ APIRET DosUnsetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD rec) return NO_ERROR; } // DosSetExceptionHandler +#if !LX_LEGACY +ULONG DosFlatToSel(VOID) { return 0; } +#else ULONG _DosFlatToSel(PVOID ptr) { TRACE_NATIVE("DosFlatToSel(%p)", ptr); @@ -493,6 +496,7 @@ __asm__ ( " ret \n\t" ".size _DosFlatToSel, .-_DosFlatToSel \n\t" ); +#endif APIRET DosSetSignalExceptionFocus(BOOL32 flag, PULONG pulTimes) { @@ -2710,6 +2714,9 @@ APIRET DosQueryThreadContext(TID tid, ULONG level, PCONTEXTRECORD pcxt) return ERROR_INVALID_PARAMETER; } // DosQueryThreadContext +#if !LX_LEGACY +ULONG DosSelToFlat(VOID) { return 0; } +#else ULONG _DosSelToFlat(void *ptr) { TRACE_NATIVE("DosSelToFlat(%p)", ptr); @@ -2718,6 +2725,7 @@ ULONG _DosSelToFlat(void *ptr) // DosSelToFlat() passes its argument in %eax, so a little asm to bridge that... __asm__ ( + // !!! FIXME: this needs to protect more registers. ".globl DosSelToFlat \n\t" ".type DosSelToFlat, @function \n\t" "DosSelToFlat: \n\t" @@ -2727,6 +2735,7 @@ __asm__ ( " ret \n\t" ".size _DosSelToFlat, .-_DosSelToFlat \n\t" ); +#endif static inline int trySpinLock(int *lock) {