Commit Graph
74 Commits
Author SHA1 Message Date
Ryan C. Gordon 490702cc45 Implemented DosBeep in doscalls and a simple audio mixer in lib2ine. 2018-07-10 01:33:11 -04:00
Ryan C. Gordon 0894e3d69d More work on mapping OS/2 drive letters to the Unix filesystem. 2018-07-10 01:19:37 -04:00
Ryan C. Gordon afc9e0846f Fixed exepack2 decompression.
Now 4os2.exe runs without a weird crash during startup (but still fails on a
missing API call a little later).
2018-06-29 22:05:06 -04:00
Ryan C. Gordon ec49615ef3 Fixed incorrect stack setup in NE loader. 2018-06-27 18:52:42 -04:00
Ryan C. Gordon fcbedae5d1 Fixed comment. 2018-06-17 00:23:53 -04:00
cracyc 1b885afc0b Deal better with proc lookup into 16-bit bridge entry points. 2018-06-16 23:46:42 -04:00
cracyc 38ae18c0fe Accept NE EXE type 0 or 1 (really old 16-bit OS/2 apps use 0). 2018-06-16 21:48:31 -04:00
Ryan C. Gordon 4ab1d427b7 lx_loader: deal with iterated segments in NE executables. 2018-06-13 01:46:41 -04:00
Ryan C. Gordon 37c3cc5a0a Bunch more work on 16-bit entry points.
Can run testargv16.exe now. This means Watcom C startup code, and Watcom's
printf(), both work.
2018-06-07 23:48:39 -04:00
Ryan C. Gordon 36dedda17c Deal with NE binaries with a stack size of zero.
Microsoft C 5.1's CL.EXE does this. This is valid in the NE spec.
2018-06-07 23:44:54 -04:00
Ryan C. Gordon 0148811a0c lx_loader: Load 16-bit NE binaries!
This currently only works with a simple Hello World program, but this is the
bulk of the work to 16-bit program support.

Still need some minor effort to get 16-bit DLLs working, and of course we
need to implement a ton of missing 16-bit API calls.
2018-06-06 17:25:22 -04:00
Ryan C. Gordon 4cbda8515b Changed asm for 16-bit missing trampolines to escape 16-bit mode first. 2018-06-06 17:17:12 -04:00
Ryan C. Gordon aa8f842232 Work to make OS/2 API available to native apps, not just OS/2 binaries.
GLoaderState is moved to a new lib2ine library, which everything links
to and sets up what it can in a DLL constructor, so your app can just
link to doscalls or whatever and it'll have what it needs without
something like lx_loader doing a lot of heavy lifting before your
main() runs.
2018-02-27 23:18:51 -05:00
Ryan C. Gordon dcf40e843b Added header comments to everything. 2018-02-26 12:54:16 -05:00
Ryan C. Gordon 4be33b8ae0 Free process modules in correct (?) order during termination.
Fixes crash when ending FTP.EXE, where real TNLS32.DLL suddenly doesn't have
access to unloaded-too-soon doscalls module.
2018-01-19 21:41:10 -05:00
Ryan C. Gordon 2e7657aa19 DosLoadModule("x.dll") wants to find X.DLL in the libpath, like a module name.
(I think.)
2018-01-19 19:11:46 -05:00
Ryan C. Gordon b6c47ee91d Implemented enough of the Presentation Manager API to draw a blank window. 2018-01-15 02:33:27 -05:00
Ryan C. Gordon aa06257218 Minor cleanup. 2018-01-04 00:25:04 -05:00
Ryan C. Gordon 21fcb16ae1 Fixup code that explicitly references Code Segment 0x5B.
This is the ring-3 32-bit linear address space's code segment, and it is
hardcoded on OS/2. Generally it isn't explicitly referenced, but things
like CSet/2 would generate thunks that hardcode jmps to it when returning
to 32-bit mode, so you have to patch those out (Linux also hardcodes a
code segment number, but doesn't promise the value won't change, and indeed,
it's different between x86, x86-64, and x86-on-x86-64 apps).
2018-01-04 00:24:53 -05:00
Ryan C. Gordon b302f0ff38 Fixes for LDT manipulation.
- Let allocateSelector() specify number of pages to allocate.
- Let findSelector() specify if this is a code or data segment.
- Let findSelector() choose if this is a code or data segment
  if the caller doesn't know (DosFlatToSel(), etc).
2018-01-04 00:20:16 -05:00
Ryan C. Gordon fabd3be3e6 Some minor build fixes. 2017-12-21 17:44:50 -05:00
Ryan C. Gordon 2ee12b66a3 16-bit bridging code now protects %es register.
Fixes crash with Info-Zip's unzip.exe blowing up calling into ncurses
via VioGetMode().
2016-11-01 21:37:57 -04:00
Ryan C. Gordon c4d2d5ee15 Some initial VIOCALLS support via ncurses, other 16-bit updates. 2016-10-29 02:05:01 -04:00
Ryan C. Gordon d26519332f Deal more correctly with process termination politics.
Now shared libraries run their termination entry points and deallocate,
the DosExitList functions can run, we free our stack selectors, etc.
2016-10-28 02:32:05 -04:00
Ryan C. Gordon 137ba61ecb Generate missing-function-called trampolines for 16-bit APIs.
Much better than crashing out in arbitrary 16-bit application code!
2016-10-27 11:19:24 -04:00
Ryan C. Gordon 2481f59a28 Bunch of work on getting java.exe to start up. Not there yet.
Lots of fixes, improvements, and a few more APIs implemented.
2016-10-27 03:20:02 -04:00
Ryan C. Gordon 970cbbc0c2 Fixed lookups into the non-resident name table.
It uses a different base offset than the resident one.
2016-10-27 02:26:20 -04:00
Ryan C. Gordon 26a52988a6 16-bit support!
This gets us everything we need (I hope!) to support 16-bit code in LX
binaries and call into 16-bit OS/2 APIs. This is just enough to call
into VioGetMode() (which isn't otherwise implemented yet) as an example.

If this is ever used Winelib-style to provide an OS/2 API to native Linux
binaries, the 16-bit system APIs are 32-bit clean and C callable, as one
might expect them to be. All the tapdancing is to support existing LX
binaries in the loader and bridge between the 32-bit clean APIs and
existing 16-bit code that expects to call 16-bit APIs.

This was a staggering amount of effort, but yay!

Other fixes and improvements probably leaked into this commit, as a
lot of code got touched and a lot of research and debugging took place.
2016-10-27 01:44:26 -04:00
Ryan C. Gordon 29696db8b3 Implemented Thread Local Storage support.
This is still rough, but the basic idea seems to work!
2016-10-19 03:21:15 -04:00
Ryan C. Gordon e8c5bc119e Implemented support for "iterated" data pages.
Fixes initial load of jv12mi36.dll (Java 1.3 that ships with OS/2 Warp 4.52).
2016-10-18 01:06:31 -04:00
Ryan C. Gordon 460e454ff3 runLx* don't need to adjust the stack for the TIB space any more. 2016-10-17 21:55:20 -04:00
Ryan C. Gordon c4a784b9dc Whoops, unbroke my EMX hack. 2016-10-17 21:45:11 -04:00
Ryan C. Gordon 60e62a1306 Moved the path conversion code to lx_loader.c, and use it.
Fixes loading "emx.dll" when the loader asked for "EMX.dll", etc.
2016-10-17 21:10:29 -04:00
Ryan C. Gordon 2016af81a2 Added support for import-by-name fixup records.
Fixes Watcom C's wlink.exe not loading at all.
(...and now it actually links binaries!).
2016-10-17 20:06:52 -04:00
Ryan C. Gordon cbffb2ff60 Initialize the PIB at startup.
Otherwise, it won't be available to DLL init code when run before the
main executable starts.

Fixes Watcom C's wlink.exe crashing because it gets a NULL command line.
2016-10-17 17:00:32 -04:00
Ryan C. Gordon 8047d55bcb Wire up loading of LX name tables. Fixes DosQueryProcAddr() with strings. 2016-10-17 15:43:08 -04:00
Ryan C. Gordon 2c2526abe1 Fixed some details of DLL loading. 2016-10-17 12:00:57 -04:00
Ryan C. Gordon e011e5cec1 Implemented more APIs; a little further into Watcom C's wcc386.exe now... 2016-10-17 10:56:50 -04:00
Ryan C. Gordon b2e32aeb37 Separate TIB from OS/2 stack. 2016-10-16 12:24:38 -04:00
Ryan C. Gordon ef4d529544 Pass actual selector (without shifting) so we deinit the segment correctly. 2016-10-16 12:23:24 -04:00
Ryan C. Gordon d8f62859c7 Library init passes the library module handle on the stack, as it should. 2016-10-16 12:21:32 -04:00
Ryan C. Gordon af2e92fa73 Pass the exe's module handle to the OS/2 process entry point. 2016-10-15 22:10:29 -04:00
Ryan C. Gordon 6454917556 Fixed environment/command line tables passed in at OS/2 process entry.
This worked before on EMX-based binaries, but this fix makes it also work
on binaries compiled with Watcom C.
2016-10-15 22:09:56 -04:00
Ryan C. Gordon ea0a7618b1 Turned some error output back on. 2016-10-14 03:40:24 -04:00
Ryan C. Gordon 68aa18c5a1 Consolidate and turn off all the debug logging for now. 2016-10-14 02:51:37 -04:00
Ryan C. Gordon 0349122bd7 Bunch More Work: more APIs, subprocesses, multithreading.
EMX's GCC compiler can now build hello.c when run from lx_loader!
2016-10-14 02:39:17 -04:00
Ryan C. Gordon ccad3a0dbb Hooked up the FS register and TIB support. 2016-10-08 16:34:59 -04:00
Ryan C. Gordon b04f032caa Fixed passing of command lines to LX program. 2016-10-06 16:37:46 -04:00
Ryan C. Gordon 95d666c01b Add native modules to the loaded modules list.
Otherwise we'd reload/reinit libdoscalls.so (etc) for every module!
2016-10-05 15:52:11 -04:00
Ryan C. Gordon fae99dc048 Turn off some debug output. I'm sure I'll regret this soon. :) 2016-10-05 15:45:23 -04:00