shithub: mc

Download patch

ref: a1967102750788b8f1f8632d82c098becdc46aa9
parent: 1b3aab8fc6ba53376a2eff03ca08eea379b79734
author: Ori Bernstein <[email protected]>
date: Thu Apr 23 19:47:36 EDT 2015

Stub out enough crud to get plan9 working.

--- a/6/gengas.c
+++ b/6/gengas.c
@@ -591,7 +591,7 @@
     }
 }
 
-void gentype(FILE *fd, Type *ty)
+static void gentype(FILE *fd, Type *ty)
 {
     char buf[512];
 
--- a/6/genp9.c
+++ b/6/genp9.c
@@ -39,6 +39,7 @@
 
 static size_t writeblob(FILE *fd, char *name, size_t off, Htab *globls, Htab *strtab, Node *blob);
 static void locprint(FILE *fd, Loc *l, char spec);
+static void gentydesc(FILE *fd, Type *ty);
 
 static void fillglobls(Stab *st, Htab *globls)
 {
@@ -442,7 +443,6 @@
     }
 }
 
-
 static void writeasm(FILE *fd, Isel *s, Func *fn)
 {
     size_t i, j;
@@ -498,6 +498,15 @@
     writeasm(fd, &is, fn);
 }
 
+static void gentype(FILE *fd, Type *ty)
+{
+    char buf[512];
+	/* FIXME: this generates dummy data. */
+    tydescid(buf, sizeof buf, ty);
+	fprintf(fd, "GLOBL %s%s<>+0(SB),$1\n", Symprefix, buf);
+    fprintf(fd, "DATA %s%s<>+0(SB)/1,$0\n", Symprefix, buf);
+}
+
 void genp9(Node *file, char *out)
 {
     Htab *globls, *strtab;
@@ -549,6 +558,11 @@
         genblob(fd, blob[i], globls, strtab);
     for (i = 0; i < nfn; i++)
         genfunc(fd, fn[i], globls, strtab);
+    for (i = 0; i < ntypes; i++)
+        if (types[i]->isreflect && !types[i]->isimport)
+            gentype(fd, types[i]);
+    fprintf(fd, "\n");
     genstrings(fd, strtab);
+
     fclose(fd);
 }
--- a/libstd/syscall+plan9-x64.s
+++ b/libstd/syscall+plan9-x64.s
@@ -25,11 +25,11 @@
 	MOVQ	R14,-120(SP)
 	MOVQ	R15,-128(SP)
 	MOVQ	8(SP),RARG
-	ADDQ	$8,SP
+	ADDQ	$16,SP
 
 	SYSCALL
 
-	SUBQ	$8,SP
+	SUBQ	$16,SP
 	MOVQ	-16(SP),BX
 	MOVQ	-24(SP),CX
 	MOVQ	-32(SP),DX