Commit Graph
128 Commits
Author SHA1 Message Date
Ryan C. Gordon cdaf533140 Fixed typo in Dos16Write's TRACE_NATIVE line. 2018-06-14 12:24:57 -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 c659bb083a lx_dump: report NE application type and some other previously-missing flags. 2018-06-13 01:08:10 -04:00
Ryan C. Gordon ab60f82c43 lx_dump: report OS/2 EXE flags for NE modules. 2018-06-13 01:00:12 -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 d82dd93262 Update testargv.c to work on older compilers, added 16-bit .exe of it. 2018-06-07 23:41:42 -04:00
Ryan C. Gordon 085b1c7ec7 Implement some 16-bit APIs that our hello16.exe needs. 2018-06-06 17:27:37 -04:00
Ryan C. Gordon bd2a9bf249 lxapigen.pl: show full diffs when changing things. 2018-06-06 17:26:20 -04:00
Ryan C. Gordon fbe6aaf432 Added a 16-bit Hello World app. 2018-06-06 17:25:47 -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 bdc285797c lx_dump: Don't fail for extremely small (but valid) binaries.
Although strictly speaking, it looks like the final OS/2 releases
will fail if the OS/2 .EXE is less than ~320 bytes, choosing to
launch it as a DOS program instead (giving you the "This is an
OS/2 executable" message from the DOS stub, comically).
2018-06-06 17:20:30 -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 8b695647db lxapigen.pl: Don't overwrite files that didn't change.
This prevents a full rebuild every time you add an API.
2018-06-06 16:19:24 -04:00
Ryan C. Gordon b1217b7fe0 Added docs on NE format that I found on the web. 2018-05-28 12:57:50 -04:00
Ryan C. Gordon c19db82bc8 Added script that takes a pipe from lx_dump and reports all needed symbols.
This, with its fairly large (but incomplete) dictionary of system APIs, is
useful when you want to know that a module wants "VioWrtNCell" and not
"ordinal 52 in VIOCALLS.DLL".  :)
2018-05-28 05:03:07 -04:00
Ryan C. Gordon 537b81f460 lx_dump: 16-bit modules should list imported modules starting at 1. 2018-05-28 03:29:40 -04:00
Ryan C. Gordon 3bde50a716 lx_dump: Finished 16-bit fixup output. 2018-05-28 02:36:50 -04:00
Ryan C. Gordon 8e2c1449ab Initial work on parsing NE (16-bit) executables.
This is just lx_dump for now, but if some work proves out, we can load these
with lx_loader, too, and bridge the 16-bit APIs to 32-bits the same as we
do anyhow, giving us access to 16-bit OS/2 binaries.
2018-03-07 15:54:01 -05:00
Ryan C. Gordon c4ba0aaa12 Forgot to add lib2ine.c to revision control. :/ 2018-02-28 00:28:59 -05:00
Ryan C. Gordon 312b87ca53 Let the libraries build as native binaries without 32-bit x86 dependencies.
Obviously, this disables lx_loader, but you can compile a C program that
uses OS/2 APIs as a native 64-bit Linux app and run them.

So now we can do 2ine and 2inelib.  :)
2018-02-27 23:42:17 -05: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 12204217cc hgignore: don't look at several separate build directories I'm using. 2018-02-27 15:17:16 -05:00
Ryan C. Gordon a1af09c108 Hacked up tcpip32.h to allow including from native apps outside of 2ine. 2018-02-27 15:16:17 -05:00
Ryan C. Gordon 6821de5ed7 Automate handling of support code for OS/2 binaries.
Now a perl script parses our headers and generates glue code, export tables,
etc. This automates all the macro nonsense and bridge code, and separates
out all the stuff you need for binary compat with OS/2, so you can remove it
all from the build if you want to just build native libraries that supply
the OS/2 API to native apps (like Winelib vs Wine).

This makes upkeep details less nasty, and easier to build native binaries
when implementing and improving APIs, so you can debug directly without
a lot of drama.
2018-02-27 03:25:21 -05:00
Ryan C. Gordon dcf40e843b Added header comments to everything. 2018-02-26 12:54:16 -05:00
Ryan C. Gordon ce72cbfe63 Updated README. 2018-01-28 10:37:53 -05:00
Ryan C. Gordon 98dabed0a6 Updated copyright date. 2018-01-28 10:36:43 -05:00
Ryan C. Gordon 6604f3c169 Added DosWaitThread() to LX export table. 2018-02-26 09:57:31 -05:00
Ryan C. Gordon b6795ed5f6 Add in some stub libraries.
These don't do anything but exist and export no symbols for now, but if you
have something that links against, say, SOM.DLL, you can at least start it
up and have it fail when it calls into that library instead of failing to
start at all.
2018-02-24 16:50:05 -05:00
Ryan C. Gordon cec77df5d6 Implemented DosSetFileSize().
Info-ZIP's unzip for OS/2 can now unpack .zip files!  :)
2018-01-20 02:03:35 -05:00
Ryan C. Gordon efbc04419f Commented out some debug printf()s. 2018-01-20 02:02:31 -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 84e1191db9 Don't close Unix's stdio handles when unloading doscalls library. 2018-01-19 19:12:40 -05:00
Ryan C. Gordon 644d0558bd Minor tweaks. 2018-01-19 19:12:16 -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 612773c635 Fixed DosExit() to work with thread termination. 2018-01-19 01:36:43 -05:00
Ryan C. Gordon c523c36f5e Moved doscalls export tables to bottom of sources, like everyone else. 2018-01-19 00:56:40 -05:00
Ryan C. Gordon 33870fc221 DosCreateThread should reserve some stack for 2ine's use.
Fixes crash in FTP.EXE's background thread.
2018-01-18 21:58:52 -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 40b9b9e141 Filled in enough of tcpip32 and doscalls to run OS/2's TCPIP/bin/FTP.EXE.
It crashes right after a completed download, but otherwise seems to
fully work!
2018-01-04 02:50:26 -05:00
Ryan C. Gordon c2e43984c2 Fixed calling of KbdCharIn.
It was just seven kinds of wrong before. Now it's gone from a stub to
barely-usable.  :)
2018-01-04 00:27:59 -05:00
Ryan C. Gordon 185a983b3c DosFlatToSel() needs to save off registers.
It's not syscall calling convention, and CSet/2 generates thunks that call
this function but expect %ecx to not be altered by it. Save off a bunch,
just in case.
2018-01-04 00:26:52 -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 44565f529b Move the 16-bit bridge heavy-lifting to the 32-bit code segment.
Now we save off the stack pointer and immediately jmp back to 32-bit. This is
slightly easier to debug (gdb doesn't get confused by addresses, registers or
disassembly), and puts all the 32-bit registers in a 32-bit code segment, to
keep things sane.

Also: doesn't write duplicate instructions to update %ds and %es if they are
the same values in Linux land.
2018-01-04 00:15:31 -05:00
Ryan C. Gordon b72ccd6e5a Implemented just enough of tcpip32.dll and dependencies to run FINGER.EXE.
Finger (etc) also rely on MPTN\DLL\tnls32.dll, which I pulled out a copy of
OS/2 Warp 4.52, which loads and limps along enough to not be a problem.
Reimplementing that library is going to be a pain, so that's a job for another
day. Inexplicably, tnls32 references pmgpi.dll's GpiQueryTextBox(), so I put a
stub for that in, too, but we're nowhere near really implementing GPI yet.

This is enough to run "finger.exe icculus@icculus.org" and see my .plan file,
which I consider a victory. A few more TCP/IP command line tools aren't far
behind.
2017-12-21 17:53:05 -05:00
Ryan C. Gordon fabd3be3e6 Some minor build fixes. 2017-12-21 17:44:50 -05:00
Ryan C. Gordon 3864bc9d61 DosAllocMem() promises that allocated memory will be zeroed out, apparently.
Fixes lots of stuff.  :)
2017-12-21 17:44:12 -05:00