From 97e6baa0521cbdc117f012b792d01bc2b1e9231d Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 17 Jun 2019 23:31:54 +0200 Subject: [PATCH] Fix register corruption when incrementing locals; attempt to solve the alignment issue. --- mach/i80/ncg/mach.h | 3 ++- mach/i80/ncg/table | 1 + plat/cpm/boot.s | 10 ++++++---- plat/pc86/descr | 14 +++++++------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/mach/i80/ncg/mach.h b/mach/i80/ncg/mach.h index 409c8608b..7da12274f 100644 --- a/mach/i80/ncg/mach.h +++ b/mach/i80/ncg/mach.h @@ -7,7 +7,8 @@ #define in_ap(y) /* nothing */ #define newilb(x) fprintf(codefile,"%s:\n",x) -#define newdlb(x) fprintf(codefile,"%s:\n",x) +#define newdlb(x) fprintf(codefile,".align 2\n%s:\n",x) +#define newplb(x) fprintf(codefile,".align 2\n%s:\n", x) #define dlbdlb(x,y) fprintf(codefile,"%s = %s\n",x,y) #define newlbss(l,x) fprintf(codefile,".comm %s,%u\n",l,x); diff --git a/mach/i80/ncg/table b/mach/i80/ncg/table index 783500195..e75bdb6f1 100644 --- a/mach/i80/ncg/table +++ b/mach/i80/ncg/table @@ -1089,6 +1089,7 @@ with hl_or_de gen dcx %1 yields %1 pat del + kills dereg, hlreg uses hlreg={const2,$1} gen dad lb diff --git a/plat/cpm/boot.s b/plat/cpm/boot.s index 4b33dbfab..e13e4e76a 100644 --- a/plat/cpm/boot.s +++ b/plat/cpm/boot.s @@ -10,10 +10,10 @@ .sect .data .sect .bss -MAX_ARGV = 8 +MAX_ARGV = 10 .sect .bss -STACKSIZE = 2*1024 +STACKSIZE = 512 .comm stack, STACKSIZE .sect .text @@ -140,6 +140,7 @@ __exit: saved_sp = . + 1 lxi sp, 0 ! patched on startup ret + .align 2 ! Emergency exit routine. @@ -181,7 +182,8 @@ _cpm_cmdline = 0x0081 ! Used to store the argv array. -argc: .space 1 ! number of args +.sect .bss +argc: .space 2 ! number of args argv0: .space 2 ! always points at progname argv: .space 2*MAX_ARGV ! argv array (must be after argv0) envp: .space 2 ! envp array (always empty, must be after argv) @@ -195,7 +197,7 @@ envp: .space 2 ! envp array (always empty, must be after argv) .comm .retadr, 2 ! used to save return address .comm .retadr1, 2 ! reserve .comm .bcreg, 2 -.comm .areg, 1 +.comm .areg, 2 .comm .tmp1, 2 .comm .fra, 8 ! 8 bytes function return area block1: .space 4 ! used by 32 bits divide and diff --git a/plat/pc86/descr b/plat/pc86/descr index 9b54410ff..4f0823c0e 100644 --- a/plat/pc86/descr +++ b/plat/pc86/descr @@ -3,19 +3,19 @@ # $Revision$ var w=2 -var wa=1 +var wa=2 var p=2 -var pa=1 +var pa=2 var s=2 -var sa=1 +var sa=2 var l=4 -var la=1 +var la=2 var f=4 -var fa=1 +var fa=2 var d=8 -var da=1 +var da=2 var x=8 -var xa=1 +var xa=2 var ARCH=i86 var PLATFORM=pc86 var PLATFORMDIR={EM}/share/ack/{PLATFORM}