summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-20 11:38:26 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-20 11:38:26 -0700
commit58d89cfed95d30bcd7fdfed4973237121803ad70 (patch)
treefee013ae7f3932b2ba08103e8fe8071954e04970
parentc34f7840a5c1984deb9bedf2817aa0c8d4b09b83 (diff)
downloadmc-58d89cfed95d30bcd7fdfed4973237121803ad70.tar.gz
Update Plan 9 build for new ABI.
-rw-r--r--6/isel.c1
-rw-r--r--6/ra.c1
-rw-r--r--libstd/syscall+plan9-x64.s41
-rw-r--r--libstd/util+plan9-x64.s20
-rw-r--r--mbld/opts.myr9
-rw-r--r--mbld/parse.myr2
-rwxr-xr-xmk/bootstrap/bootstrap+Plan9-amd64.sh4
7 files changed, 21 insertions, 57 deletions
diff --git a/6/isel.c b/6/isel.c
index 9cf81b6..12f3039 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -89,6 +89,7 @@ static Mode mode(Node *n)
return tymode(n->decl.type);
else
die("invalid node type");
+ return ModeNone;
}
static Loc *loc(Isel *s, Node *n)
diff --git a/6/ra.c b/6/ra.c
index 2f76c2a..14750c6 100644
--- a/6/ra.c
+++ b/6/ra.c
@@ -945,7 +945,6 @@ static void selspill(Isel *s)
/* FIXME: pick a better heuristic for spilling */
m = NULL;
_isel = s;
- qsort(s->wlspill, s->nwlspill, sizeof s->wlspill[0], loccmp);
for (i = 0; i < s->nwlspill; i++) {
if (!bshas(s->shouldspill, s->wlspill[i]->reg.id))
continue;
diff --git a/libstd/syscall+plan9-x64.s b/libstd/syscall+plan9-x64.s
index 765a527..4de6502 100644
--- a/libstd/syscall+plan9-x64.s
+++ b/libstd/syscall+plan9-x64.s
@@ -10,39 +10,24 @@ Luckily, the kernel doesn't touch our stack,
and we have 256 bytes of gap if we get a note.
*/
TEXT sys$syscall+0(SB),1,$0
- MOVQ BX,-16(SP)
- MOVQ CX,-24(SP)
- MOVQ DX,-32(SP)
- MOVQ SI,-40(SP)
- MOVQ DI,-48(SP)
+ MOVQ R11,-16(SP)
+ MOVQ R12,-24(SP)
+ MOVQ R13,-32(SP)
+ MOVQ R14,-40(SP)
+ MOVQ R15,-48(SP)
MOVQ BP,-56(SP)
- MOVQ R8,-64(SP)
- MOVQ R9,-72(SP)
- MOVQ R10,-80(SP)
- MOVQ R11,-88(SP)
- MOVQ R12,-104(SP)
- MOVQ R13,-112(SP)
- MOVQ R14,-120(SP)
- MOVQ R15,-128(SP)
MOVQ 8(SP),RARG
- ADDQ $16,SP
+ ADDQ $8,SP
+ MOVQ DI, RARG
SYSCALL
+ SUBQ $8,SP
- SUBQ $16,SP
- MOVQ -16(SP),BX
- MOVQ -24(SP),CX
- MOVQ -32(SP),DX
- MOVQ -40(SP),SI
- MOVQ -48(SP),DI
+ MOVQ -16(SP),R11
+ MOVQ -24(SP),R12
+ MOVQ -32(SP),R13
+ MOVQ -40(SP),R14
+ MOVQ -48(SP),R15
MOVQ -56(SP),BP
- MOVQ -64(SP),R8
- MOVQ -72(SP),R9
- MOVQ -80(SP),R10
- MOVQ -88(SP),R11
- MOVQ -104(SP),R12
- MOVQ -112(SP),R13
- MOVQ -120(SP),R14
- MOVQ -128(SP),R15
RET
diff --git a/libstd/util+plan9-x64.s b/libstd/util+plan9-x64.s
index aff583f..f4b8586 100644
--- a/libstd/util+plan9-x64.s
+++ b/libstd/util+plan9-x64.s
@@ -46,27 +46,15 @@ TEXT sys$cstring+0(SB),$0
TEXT sys$alloca+0(SB),$0
/* save registers */
- MOVQ SP,AX
- SUBQ $32,SP
- MOVQ BP,-8(AX)
- MOVQ R15,-16(AX)
- MOVQ BX,-24(AX)
- MOVQ AX,BP
-
- MOVQ (BP),R15 /* ret addr */
- MOVQ 8(BP),BX /* len */
+ MOVQ (SP),R10 /* ret addr */
/* get stack space */
- SUBQ BX,SP /* get stack space */
+ SUBQ DI,SP /* get stack space */
MOVQ SP,AX /* top of stack (return value) */
- SUBQ $32,SP /* "unpop" the args, and make room for ret addr */
ANDQ $(~15),SP /* align */
+ SUBQ $32,SP /* "unpop" the args, and make room for ret addr */
- MOVQ R15,0(SP) /* place ret addr */
- /* restore registers */
- MOVQ -16(BP),R15
- MOVQ -24(SP),BX
- MOVQ -8(BP),BP
+ MOVQ R10,(SP) /* place ret addr */
RET
GLOBL sys$tosptr+0(SB),$8
diff --git a/mbld/opts.myr b/mbld/opts.myr
index 41aef91..c05c592 100644
--- a/mbld/opts.myr
+++ b/mbld/opts.myr
@@ -42,11 +42,6 @@ var opt_ld = "ld"
var opt_ar = "ar"
var opt_genasm = false
-/* derived */
-var sysarchstr = ""
-var archstr = ""
-var sysstr = ""
-
const initopts = {
var si
@@ -75,9 +70,5 @@ const initopts = {
if opt_runtime.len == 0
opt_runtime = std.pathjoin([opt_instroot, config.Libpath, config.Runtime][:])
;;
-
- sysarchstr = std.fmt("+{}-{}", opt_sys, opt_arch)
- sysstr = std.fmt("+{}", opt_sys)
- archstr = std.fmt("+{}", opt_arch)
}
diff --git a/mbld/parse.myr b/mbld/parse.myr
index befb7d5..27e49e0 100644
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -337,9 +337,9 @@ const myrtarget = {p, targ
failparse(p, "expected '=' after '{} {}'\n", targ, name)
;;
+ fsel = mksyssel(p.fname, p.line, name)
match inputlist(p)
| `std.Some (wl, libs):
- fsel = mksyssel(p.fname, p.line, targ)
libdeps = libs
for w in wl
sysseladd(fsel, w)
diff --git a/mk/bootstrap/bootstrap+Plan9-amd64.sh b/mk/bootstrap/bootstrap+Plan9-amd64.sh
index dedff70..5cc4aee 100755
--- a/mk/bootstrap/bootstrap+Plan9-amd64.sh
+++ b/mk/bootstrap/bootstrap+Plan9-amd64.sh
@@ -96,14 +96,14 @@ echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd opts.myr ; ../6/6.out
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd types.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd types.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd util.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd util.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd deps.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd deps.myr
-echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd fsel.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd fsel.myr
+echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd syssel.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd syssel.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd parse.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd parse.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd build.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd build.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd install.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd install.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd clean.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd clean.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd test.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd test.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd main.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd main.myr
-echo 6l -lo mbld ../rt/_myrrt.6 clean.6 types.6 deps.6 fsel.6 util.6 parse.6 main.6 build.6 opts.6 config.6 install.6 test.6 ../libregex/libregex.a ../libbio/libbio.a ../libstd/libstd.a ../libstd/libsys.a ; 6l -lo mbld ../rt/_myrrt.6 clean.6 types.6 deps.6 fsel.6 util.6 parse.6 main.6 build.6 opts.6 config.6 install.6 test.6 ../libregex/libregex.a ../libbio/libbio.a ../libstd/libstd.a ../libstd/libsys.a
+echo 6l -lo mbld ../rt/_myrrt.6 clean.6 types.6 deps.6 syssel.6 util.6 parse.6 main.6 build.6 opts.6 config.6 install.6 test.6 ../libregex/libregex.a ../libbio/libbio.a ../libstd/libstd.a ../libstd/libsys.a ; 6l -lo mbld ../rt/_myrrt.6 clean.6 types.6 deps.6 syssel.6 util.6 parse.6 main.6 build.6 opts.6 config.6 install.6 test.6 ../libregex/libregex.a ../libbio/libbio.a ../libstd/libstd.a ../libstd/libsys.a
echo cd $pwd; cd $pwd
echo cd $pwd/libregex; cd $pwd/libregex
echo ../6/6.out -I . -I ../libbio -I ../libstd redump.myr ; ../6/6.out -I . -I ../libbio -I ../libstd redump.myr