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.
26 lines
567 B
Perl
Executable File
26 lines
567 B
Perl
Executable File
#!/usr/bin/perl -w
|
|
|
|
# run this on the output from ndisasm.
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
while (<>) {
|
|
chomp;
|
|
my ($bytes, $asm) = /\A.*?\s+(.*?)\s+(.*)\Z/;
|
|
my $first = 1;
|
|
while ($bytes ne '') {
|
|
$bytes =~ s/\A(..)//;
|
|
my $hex = $1;
|
|
if ($first and ($bytes eq '')) {
|
|
print(" *(ptr++) = 0x$hex; /* $asm */\n");
|
|
} elsif ($first) {
|
|
print(" *(ptr++) = 0x$hex; /* $asm... */\n");
|
|
} else {
|
|
print(" *(ptr++) = 0x$hex; /* ...$asm */\n");
|
|
}
|
|
$first = 0;
|
|
}
|
|
}
|
|
|