Some i086 updates.

This commit is contained in:
Markus F.X.J. Oberhumer 2007-02-11 04:52:33 +01:00
parent 50c8860a50
commit 2d3a914aee
6 changed files with 959 additions and 848 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ vpath %.c $(top_srcdir)/src/stub/src/c
STUBS =
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
ifneq ($(wildcard $(WATCOM)/binl/.),)
STUBS += lzma_d_cf.S lzma_d_cs.S
STUBS += lzma_d_cf.S ##lzma_d_cs.S
endif
endif
@ -48,23 +48,65 @@ lzma_d_c%.S : tc_list = method-lzma default
lzma_d_c%.S : tc_bfdname =
c := tc.method-lzma.wcc
$c = $(WATCOM)/binl/wcc -zq -bt=dos -0
$c = $(WATCOM)/binl/wcc -zq -bt=dos
$c += -mc
$c += -zm -zc
$c += -os -s -d0
$c += -os -s -0 -d0
$c += -w5 -we -fr=/dev/null
$c += -D__INT_MAX__=32767
$c += -D_LZMA_UINT32_IS_ULONG=1
$c += -I$(UPX_LZMADIR)
$c += -I$(top_srcdir)/src
ifneq ($(wildcard $(BC502DIR)/bin/.),)
c := tc.method-lzma.bcc
$c = @$(WINEENV) CL='$(CL)' wine cmd.exe /c tmp/bcc.bat
$c += -mc
$c += -O1 -1
$c += -w
$c += -D__INT_MAX__=32767
##$c += -I$(subst \,/,$(shell winepath -s z:$(realpath $(UPX_LZMADIR))))
$c += -I$(subst \,/,$(shell winepath -s z:$(realpath $(UPX_LZMADIR)/C/7zip/Compress/LZMA_C)))
$c += -I$(top_srcdir)/src
endif
ifneq ($(wildcard $(DM847DIR)/bin/.),)
c := tc.method-lzma.dmc
$c = @$(WINEENV) CFLAGS='$(DMC)' wine cmd.exe /c tmp/dmc.bat
$c += -mc
$c += -NS
$c += -w-
DMC := -o -0
DMC += -D__INT_MAX__=32767
DMC += -I$(shell winepath -s z:$(realpath $(UPX_LZMADIR)))
DMC += -I$(shell winepath -s z:$(realpath $(top_srcdir)/src))
endif
ifneq ($(wildcard $(VC152DIR)/bin/.),)
c := tc.method-lzma.cl
$c = @$(WINEENV) CL='$(CL)' wine cmd.exe /c tmp/cl.bat
$c += -AC
$c += -Gy
$c += -O1 -Gf -Gs -G0
$c += -W4
CL := -nologo
CL += -D__INT_MAX__=32767
CL += -I$(shell winepath -s z:$(realpath $(UPX_LZMADIR)))
CL += -I$(shell winepath -s z:$(realpath $(top_srcdir)/src))
endif
tc.method-lzma.dmpobj = $(WATCOM)/binl/dmpobj
tc.method-lzma.wdis = $(WATCOM)/binl/wdis
tc.method-lzma.wdump = $(WATCOM)/binl/wdump
lzma_d_c%.S : lzma_d_c.c
lzma_d_c%.S : lzma_d_c.c $(MAKEFILE_LIST)
$(call tc,wcc) $(PP_FLAGS) -fo=tmp/$T.obj $<
$(call tc,wdis) tmp/$T.obj | $(RTRIM) > tmp/$T.obj.disasm
## $(call tc,dmc) $(PP_FLAGS) -c -otmp/$T.obj $<
## $(call tc,wdis) tmp/$T.obj | $(RTRIM) > tmp/$T.obj.disasm
## $(call tc,cl) $(PP_FLAGS) -c -Fotmp/$T.obj $<
## $(call tc,wdis) tmp/$T.obj | $(RTRIM) > tmp/$T.obj.disasm
## $(call tc,bcc) $(PP_FLAGS) -c -otmp/$T.obj $<
## $(call tc,wdis) tmp/$T.obj | $(RTRIM) > tmp/$T.obj.disasm
FIXME:
$(call tc,f-objstrip,tmp/$T.o)
@ -83,11 +125,57 @@ lzma_d_cs.% : LABEL_PREFIX = .Ls
# // cc_test
# ************************************************************************/
WINEENV = env
WINEENV = env -i DISPLAY='$(DISPLAY)' HOME='$(HOME)' PATH='$(PATH)' USER='$(USER)'
# work around limitations of wine's cmd.exe
define mkbat
echo -E '@set PATH=$3;%PATH%' > $1
echo -E '@set a=%1 %2 %3 %4 %5 %6 %7 %8 %9' >> $1
echo -e '@shift\n@shift\n@shift\n@shift\n@shift' >> $1
echo -e '@shift\n@shift\n@shift\n@shift' >> $1
echo -E '@set b=%1 %2 %3 %4 %5 %6 %7 %8 %9' >> $1
echo -e '@shift\n@shift\n@shift\n@shift\n@shift' >> $1
echo -e '@shift\n@shift\n@shift\n@shift' >> $1
echo -E '$2 %a% %b% %1 %2 %3 %4 %5 %6 %7 %8 %9' >> $1
unix2dos -q $1
endef
ifneq ($(wildcard $(WATCOM)/binl/.),)
cc_test_wcc : tc_list = method-lzma default
cc_test_wcc: cc_test.c
cc_test_wc : tc_list = method-lzma default
cc_test_wc: cc_test.c
$(call tc,wcc) $(PP_FLAGS) -fo=tmp/$T.obj $<
$(call tc,wdis) tmp/$T.obj | $(RTRIM) > tmp/$T.obj.disasm
## cat tmp/$T.obj.disasm
endif
ifneq ($(wildcard $(BC502DIR)/bin/.),)
tmp/bcc.bat: tmp/.tmp-stamp $(MAKEFILE_LIST)
@$(call mkbat,$@,bcc.exe,$(BC502WINDIR)\\bin)
cc_test_bc : tc_list = method-lzma default
cc_test_bc: cc_test.c tmp/bcc.bat
$(call tc,bcc) $(PP_FLAGS) -c -otmp/$T.obj $<
$(call tc,wdis) tmp/$T.obj | $(RTRIM) > tmp/$T.obj.disasm
## cat tmp/$T.obj.disasm
endif
ifneq ($(wildcard $(DM847DIR)/bin/.),)
tmp/dmc.bat: tmp/.tmp-stamp $(MAKEFILE_LIST)
@$(call mkbat,$@,dmc.exe,$(DM847WINDIR)\\bin)
cc_test_dm : tc_list = method-lzma default
cc_test_dm: cc_test.c tmp/dmc.bat
$(call tc,dmc) $(PP_FLAGS) -c -otmp/$T.obj $<
$(call tc,wdis) tmp/$T.obj | $(RTRIM) > tmp/$T.obj.disasm
## cat tmp/$T.obj.disasm
endif
ifneq ($(wildcard $(VC152DIR)/bin/.),)
tmp/cl.bat: tmp/.tmp-stamp $(MAKEFILE_LIST)
@$(call mkbat,$@,cl.exe,$(VC152WINDIR)\\bin)
cc_test_vc : tc_list = method-lzma default
cc_test_vc: cc_test.c tmp/cl.bat
$(call tc,cl) $(PP_FLAGS) -c -Fotmp/$T.obj $<
$(call tc,wdis) tmp/$T.obj | $(RTRIM) > tmp/$T.obj.disasm
## cat tmp/$T.obj.disasm
endif

View File

@ -85,5 +85,10 @@ int16_t __cdecl i2m(int16_t a, int16_t b) { return a * b; }
uint32_t __cdecl u2m4(uint16_t a, uint16_t b) { return a * b; }
int32_t __cdecl i2m4(int16_t a, int16_t b) { return a * b; }
uint16_t __cdecl u2shl12(uint16_t a) { return a << 12; }
uint32_t __cdecl u4shl14(uint32_t a) { return a << 12; }
uint16_t __cdecl u2shlv(uint16_t a, unsigned v) { return a << v; }
uint32_t __cdecl u4shlv(uint32_t a, unsigned v) { return a << v; }
/* vim:set ts=4 et: */

View File

@ -142,7 +142,7 @@
.macro M_WCC_PIA_086
add ax, bx
adc cx, 0
xchg cx, bx
mov cx, bx
mov cl, _AHSHIFT
shl bx, cl
add dx, bx
@ -159,7 +159,7 @@
.macro M_WCC_PIS_086
sub ax, bx
adc cx, 0
xchg cx, bx
mov cx, bx
mov cl, _AHSHIFT
shl bx, cl
sub dx, bx
@ -174,12 +174,17 @@
// huge pointer diff: dx:ax = dx:ax - cx:bx
.macro M_WCC_PTS
// normalize
// FIXME
// subtract
sub ax, bx
sbb dx, cx
.endm
// huge pointer compare: set zero and carry flags: dx:ax cmp cx:bx
.macro M_WCC_PTC
// FIXME: should we normalize the pointers ???
local L1
cmp dx, cx
jnes L1

View File

@ -39,10 +39,15 @@
#undef _LZMA_PROB32
#undef _LZMA_LOC_OPT
#endif
#if (ACC_ARCH_I086) && (ACC_CC_WATCOMC)
typedef unsigned char __huge Byte;
#if (ACC_ARCH_I086)
# define Byte unsigned char
# define _7ZIP_BYTE_DEFINED 1
#endif
#if !defined(_LZMA_UINT32_IS_ULONG)
# if defined(__INT_MAX__) && ((__INT_MAX__)+0 == 32767)
# define _LZMA_UINT32_IS_ULONG 1
# endif
#endif
#if 0
@ -58,7 +63,11 @@ ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(CLzmaDecoderState) == 16)
#define CLzmaDecoderState CLzmaDecoderState_dummy
#define LzmaDecodeProperties LzmaDecodeProperties_dummy
#define LzmaDecode LzmaDecode_dummy
#if (ACC_CC_BORLANDC)
#include "LzmaDecode.h"
#else
#include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
#endif
#undef CLzmaDecoderState
#undef LzmaDecodeProperties
#undef LzmaDecode
@ -70,10 +79,10 @@ typedef struct {
CProb Probs[16382];
#endif
} CLzmaDecoderState;
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(CLzmaDecoderState) == 32768)
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(CLzmaDecoderState) == 32768u)
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(SizeT) >= 4)
#if (ACC_ARCH_I086) && (ACC_CC_WATCOMC)
#if (ACC_ARCH_I086)
# if (ACC_MM_HUGE)
typedef unsigned short __far MyCProb;
# undef CProb
@ -84,7 +93,11 @@ ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(SizeT) >= 4)
#else
#define CLzmaDecoderState const CLzmaDecoderState
#endif
#if (ACC_CC_BORLANDC)
#include "LzmaDecode.c"
#else
#include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
#endif
#endif

View File

@ -63,9 +63,9 @@ Idx Name Size VMA LMA File off Algn Flags
58 wcc_pia_286 0000000b 00000000 00000000 0000031d 2**0 CONTENTS, READONLY
59 wcc_pis_086 0000000e 00000000 00000000 00000328 2**0 CONTENTS, READONLY
60 wcc_pis_286 0000000b 00000000 00000000 00000336 2**0 CONTENTS, READONLY
61 wcc_pts 00000001 00000000 00000000 00000341 2**0 CONTENTS, READONLY
62 wcc_ptc 00000007 00000000 00000000 00000342 2**0 CONTENTS, READONLY
63 wcc_u4m 00000003 00000000 00000000 00000349 2**0 CONTENTS, READONLY
61 wcc_pts 00000005 00000000 00000000 00000341 2**0 CONTENTS, READONLY
62 wcc_ptc 00000007 00000000 00000000 00000346 2**0 CONTENTS, READONLY
63 wcc_u4m 00000003 00000000 00000000 0000034d 2**0 CONTENTS, READONLY
SYMBOL TABLE:
00000000 l d DEVICEENTRY 00000000 DEVICEENTRY
00000000 l d EXEENTRY 00000000 EXEENTRY