diff options
-rw-r--r-- | 6/isel.c | 2 | ||||
-rw-r--r-- | 6/simp.c | 6 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | libstd/Makefile | 2 | ||||
-rw-r--r-- | libstd/dir-freebsd.myr | 0 | ||||
-rw-r--r-- | libstd/ifreq-freebsd.myr | 0 | ||||
-rw-r--r-- | libstd/start-freebsd.s | 2 | ||||
-rw-r--r-- | libstd/sys-freebsd.myr | 32 | ||||
-rw-r--r-- | libstd/syscall-freebsd.s | 39 | ||||
-rw-r--r-- | libstd/waitstatus-freebsd.myr | 0 | ||||
-rwxr-xr-x | test/runtest.sh | 2 |
12 files changed, 75 insertions, 18 deletions
@@ -951,7 +951,7 @@ static void writeasm(FILE *fd, Isel *s, Func *fn) { size_t i, j; - if (fn->isexport || !strcmp(fn->name, Symprefix "main")) + if (fn->isexport || !strcmp(fn->name, symprefix "main")) fprintf(fd, ".globl %s\n", fn->name); fprintf(fd, "%s:\n", fn->name); for (j = 0; j < s->cfg->nbb; j++) { @@ -292,7 +292,7 @@ static char *asmname(Node *n) char *s; int len; - len = strlen(Symprefix); + len = strlen(symprefix); if (n->name.ns) len += strlen(n->name.ns) + 1; /* +1 for separator */ len += strlen(n->name.name) + 1; @@ -300,11 +300,11 @@ static char *asmname(Node *n) s = xalloc(len + 1); s[0] = '\0'; if (n->name.ns) - snprintf(s, len, "%s%s$%s", Symprefix, n->name.ns, n->name.name); + snprintf(s, len, "%s%s$%s", symprefix, n->name.ns, n->name.name); else if (n->name.name[0] == '.') snprintf(s, len, "%s", n->name.name); else - snprintf(s, len, "%s%s", Symprefix, n->name.name); + snprintf(s, len, "%s%s", symprefix, n->name.name); return s; } @@ -10,4 +10,4 @@ include mk/c.mk include config.mk check: all - make -C test check + $(MAKE) -C test check @@ -37,17 +37,17 @@ echo '#define Instroot "'$prefix'"' > config.h case $OS in *Linux*) echo '#define Asmcmd "as -g -o %s %s"' >> config.h - echo '#define Symprefix ""' >> config.h + echo '#define symprefix ""' >> config.h echo 'export SYS=linux' >> config.mk ;; *Darwin*) echo '#define Asmcmd "as -g -o %s %s"' >> config.h - echo '#define Symprefix "_"' >> config.h + echo '#define symprefix "_"' >> config.h echo 'export SYS=osx' >> config.mk ;; *FreeBSD*) echo '#define Asmcmd "as -g -o %s %s"' >> config.h - echo '#define Fprefix ""' >> config.h + echo '#define symprefix ""' >> config.h echo 'export SYS=freebsd' >> config.mk ;; *) diff --git a/libstd/Makefile b/libstd/Makefile index e6b77df..5a1469a 100644 --- a/libstd/Makefile +++ b/libstd/Makefile @@ -92,4 +92,4 @@ uninstall: rm -f $(abspath $(DESTDIR)/$(INST_ROOT)/lib/myr/std) ../6/6m: - cd ..; make + cd ..; $(MAKE) diff --git a/libstd/dir-freebsd.myr b/libstd/dir-freebsd.myr new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libstd/dir-freebsd.myr diff --git a/libstd/ifreq-freebsd.myr b/libstd/ifreq-freebsd.myr new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libstd/ifreq-freebsd.myr diff --git a/libstd/start-freebsd.s b/libstd/start-freebsd.s index 5e49c1f..d81d242 100644 --- a/libstd/start-freebsd.s +++ b/libstd/start-freebsd.s @@ -115,7 +115,7 @@ _start: pushq %rdx /* enter the main program */ - call xmain + call main /* exit(0) */ xorq %rdi,%rdi movq $1,%rax diff --git a/libstd/sys-freebsd.myr b/libstd/sys-freebsd.myr index 15d3292..6e777d3 100644 --- a/libstd/sys-freebsd.myr +++ b/libstd/sys-freebsd.myr @@ -78,11 +78,11 @@ pkg std = ;; type utsname = struct - sysname : byte[256] - nodename : byte[256] - release : byte[256] - version : byte[256] - machine : byte[256] + system : byte[256] + node : byte[256] + release : byte[256] + version : byte[256] + machine : byte[256] ;; type sockaddr = struct @@ -95,7 +95,7 @@ pkg std = len : byte fam : sockfam port : uint16 - addr : uint32 /* should this be byte[4]? */ + addr : byte[4] zero : byte[8] ;; @@ -740,7 +740,7 @@ const clock_gettime = {clk, ts; -> syscall(Sysclock_gettime, clockid(clk), ts) c const clock_settime = {clk, ts; -> syscall(Sysclock_settime, clockid(clk), ts) castto(int32)} /* system information */ -const uname = {buf; -> syscall(Sysuname, buf) castto(int)} +const uname = {buf; -> syscall(Sysfreebsd4_uname, buf) castto(int)} const sysctl = {mib, old, new var mibp @@ -765,3 +765,21 @@ const sysctl = {mib, old, new old# = o[:oldsz] -> ret } + +const clockid = {clk + match clk + | `Clockrealtime: -> 0 + | `Clockvirtual: -> 1 + | `Clockprof: -> 2 + | `Clockmonotonic: -> 4 + | `Clockuptime: -> 5 + | `Clockuptime_precise: -> 7 + | `Clockuptime_fast: -> 8 + | `Clockrealtime_precise: -> 9 + | `Clockrealtime_fast: -> 10 + | `Clockmonotonic_precise: -> 11 + | `Clockmonotonic_fast: -> 12 + | `Clocksecond: -> 13 + ;; + -> -1 +} diff --git a/libstd/syscall-freebsd.s b/libstd/syscall-freebsd.s new file mode 100644 index 0000000..c810945 --- /dev/null +++ b/libstd/syscall-freebsd.s @@ -0,0 +1,39 @@ +.globl std$syscall +std$syscall: + pushq %rbp + pushq %rdi + pushq %rsi + pushq %rdx + pushq %r10 + pushq %r8 + pushq %r9 + pushq %rcx + pushq %r11 + /* + hack: We load 6 args regardless of + how many we actually have. This may + load junk values, but if the syscall + doesn't use them, it's going to be + harmless. + */ + movq 80 (%rsp),%rax + movq 88 (%rsp),%rdi + movq 96 (%rsp),%rsi + movq 104(%rsp),%rdx + movq 112(%rsp),%r10 + movq 120(%rsp),%r8 + movq 128(%rsp),%r9 + + syscall + + popq %r11 + popq %rcx + popq %r9 + popq %r8 + popq %r10 + popq %rdx + popq %rsi + popq %rdi + popq %rbp + ret + diff --git a/libstd/waitstatus-freebsd.myr b/libstd/waitstatus-freebsd.myr new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libstd/waitstatus-freebsd.myr diff --git a/test/runtest.sh b/test/runtest.sh index a8a1b39..420ad41 100755 --- a/test/runtest.sh +++ b/test/runtest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash export PATH=.:$PATH export MC=../6/6m export MU=../muse/muse |