From ec9b5f5fcda593a6d2810a8c16d2385a1790aa4a Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 17 Jun 2019 19:53:12 +0200 Subject: [PATCH 1/7] Disable rck test on i80, which doesn't support it. --- tests/plat/core/rck_e.e | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/plat/core/rck_e.e b/tests/plat/core/rck_e.e index cd5c581df..577b0b983 100644 --- a/tests/plat/core/rck_e.e +++ b/tests/plat/core/rck_e.e @@ -4,8 +4,6 @@ /* * Uses _rck_ for range checks. Catches the EM trap if a value is out * of range, and continues with the next instruction after _rck_. - * - * Some back ends, like i80, ignore _rck_, so this test fails. */ testnr @@ -19,6 +17,11 @@ caught exp $_m_a_i_n pro $_m_a_i_n,0 +/* These architecture ignore _rck_. */ +#if defined i80 + cal $finished +#endif + lim ; load ignore mask loc 2 and EM_WSIZE ; check bit 1 << ERANGE From 94867d24b71582657de8b32b81c1901bdb27c490 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 17 Jun 2019 22:26:31 +0200 Subject: [PATCH 2/7] Ensure that procedure labels are word aligned (required by the EM spec). --- mach/m68020/ncg/mach.h | 1 + plat/linux68k/boot.s | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/mach/m68020/ncg/mach.h b/mach/m68020/ncg/mach.h index 647a04322..3d37243cd 100644 --- a/mach/m68020/ncg/mach.h +++ b/mach/m68020/ncg/mach.h @@ -21,6 +21,7 @@ You must specify the appropriate word size, then REMOVE tables.c #define newilb(x) fprintf(codefile,"%s:\n",x) #define newdlb(x) fprintf(codefile,"%s:\n",x) +#define newplb(x) fprintf(codefile,".align 4\n%s:\n",x) #define dlbdlb(x,y) fprintf(codefile,"%s = %s\n",x,y) #define newlbss(l,x) fprintf(codefile,".comm %s,%ld\n",l,x); diff --git a/plat/linux68k/boot.s b/plat/linux68k/boot.s index 9d91a6cff..906d5fe96 100644 --- a/plat/linux68k/boot.s +++ b/plat/linux68k/boot.s @@ -44,19 +44,6 @@ begtext: jmp (__m_a_i_n) -#if 0 - mov eax, (esp) ! eax = argc - lea ebx, 4(esp) ! ebx = argv - lea ecx, (esp)(eax*4) - add ecx, 12 ! environ - - push ecx ! environ - push ebx ! argc - push eax ! argv - push eax ! dummy, representing the return argument - xor ebp, ebp -#endif - ! This provides an emergency exit routine used by EM. .define EXIT From c9d14f6c9ec1db8ef85b4c0e837df25921eb4fe7 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 17 Jun 2019 22:27:13 +0200 Subject: [PATCH 3/7] Cause B programs to fail on startup if they detect alignment issues. --- lang/b/lib/b.h | 2 ++ lang/b/lib/main.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lang/b/lib/b.h b/lang/b/lib/b.h index 1125452cd..36d9f38fd 100644 --- a/lang/b/lib/b.h +++ b/lang/b/lib/b.h @@ -14,6 +14,8 @@ #error Unsupported EM_PSIZE #endif +#define MASK ((1<>= SHIFT; } } From 0ecad6c8605dd719b980ce8202005785a979ae50 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 17 Jun 2019 23:29:41 +0200 Subject: [PATCH 4/7] Warning fix. --- plat/cpm/tests/parsefcb_c.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plat/cpm/tests/parsefcb_c.c b/plat/cpm/tests/parsefcb_c.c index 53605e2a4..bad3e14e1 100644 --- a/plat/cpm/tests/parsefcb_c.c +++ b/plat/cpm/tests/parsefcb_c.c @@ -1,4 +1,5 @@ #include +#include #include #include "test.h" From c2f48772e9ed772b376f39038c51bc22552a24f0 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 17 Jun 2019 23:31:16 +0200 Subject: [PATCH 5/7] Correctly emit \r\n when a \n is written to the console, instead of \n\n... Fixes: #198 --- plat/cpm/libsys/write.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plat/cpm/libsys/write.c b/plat/cpm/libsys/write.c index eb2c89a0a..c741dc644 100644 --- a/plat/cpm/libsys/write.c +++ b/plat/cpm/libsys/write.c @@ -12,9 +12,9 @@ void _sys_write_tty(char c) { - cpm_conout(c); if (c == '\n') - cpm_conout(c); + cpm_conout('\r'); + cpm_conout(c); } ssize_t write(int fd, void* buffer, size_t count) From 97e6baa0521cbdc117f012b792d01bc2b1e9231d Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 17 Jun 2019 23:31:54 +0200 Subject: [PATCH 6/7] 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} From ac8edcbfc38e00134058d24646e76a2f4c2fa827 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 17 Jun 2019 23:33:58 +0200 Subject: [PATCH 7/7] Give up trying to make the B tests pass on CP/M. --- plat/cpm/tests/build.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plat/cpm/tests/build.lua b/plat/cpm/tests/build.lua index 1a8488136..8795262ad 100644 --- a/plat/cpm/tests/build.lua +++ b/plat/cpm/tests/build.lua @@ -4,6 +4,9 @@ plat_testsuite { name = "tests", plat = "cpm", method = "plat/cpm/emu+emu", - skipsets = {"floats"}, + skipsets = { + "b", -- B is broken on i80 + "floats" -- floats aren't supported + }, tests = { "./*.c" }, }