summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-10-06 18:08:32 -0400
committerOri Bernstein <ori@eigenstate.org>2014-10-06 18:08:32 -0400
commite3ada3da7e9e7681e86b3f837071e21b499f857a (patch)
tree5fc7ebc1add93366b38fb759515b91215b63a5ad
parent5131214c8ddbd9a4f3a4b6c9acef575985ff867d (diff)
downloadmc-e3ada3da7e9e7681e86b3f837071e21b499f857a.tar.gz
Update other systems for the libstd/libsys split.
-rw-r--r--libstd/Makefile2
-rw-r--r--libstd/bldfile24
-rw-r--r--libstd/ifreq+linux.myr2
-rw-r--r--libstd/ifreq+osx.myr2
-rw-r--r--libstd/sys+freebsd.myr15
-rw-r--r--libstd/sys+osx.myr15
-rw-r--r--libstd/syscall+freebsd-x64.s18
7 files changed, 34 insertions, 44 deletions
diff --git a/libstd/Makefile b/libstd/Makefile
index 20e6a13..c981516 100644
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -84,7 +84,7 @@ all: lib$(STDLIB).a $(MYRBIN)
%.s: %+$(ARCH).s
cp $< $@
-lib$(STDLIB).a: $(STDSRC) $(ASMSRC) $(SYSLIB) lib$(SYSLIB).a ../6/6m
+lib$(STDLIB).a: $(STDSRC) $(ASMSRC) lib$(SYSLIB).a ../6/6m
../myrbuild/myrbuild -I. -C../6/6m -M../muse/muse -l $(STDLIB) $(STDSRC) $(STDASMSRC)
lib$(SYSLIB).a: $(SYSSRC) $(SYSASMSRC) ../6/6m
diff --git a/libstd/bldfile b/libstd/bldfile
index 8f601e4..1db94c2 100644
--- a/libstd/bldfile
+++ b/libstd/bldfile
@@ -1,3 +1,17 @@
+lib sys =
+ sys+freebsd.myr
+ sys+linux.myr
+ sys+osx.myr
+ syscall+freebsd-x64.s
+ syscall+linux-x64.s
+ syscall+osx-x64.s
+ systypes.myr
+ ifreq+freebsd.myr
+ ifreq+linux.myr
+ ifreq+osx.myr
+ util.s
+;;
+
lib std =
# portable files
alloc.myr
@@ -50,22 +64,12 @@ lib std =
types.myr
units.myr
utf.myr
- util.s
varargs.myr
# platform specific files
dir+freebsd.myr
dir+linux.myr
dir+osx.myr
- ifreq+freebsd.myr
- ifreq+linux.myr
- ifreq+osx.myr
- syscall+freebsd-x64.s
- syscall+linux-x64.s
- syscall+osx-x64.s
- sys+freebsd.myr
- sys+linux.myr
- sys+osx.myr
waitstatus+freebsd.myr
waitstatus+linux.myr
waitstatus+osx.myr
diff --git a/libstd/ifreq+linux.myr b/libstd/ifreq+linux.myr
index b9c5ee1..62be8ee 100644
--- a/libstd/ifreq+linux.myr
+++ b/libstd/ifreq+linux.myr
@@ -1,6 +1,6 @@
use "sys.use"
-pkg std =
+pkg sys =
const Ifnamesz = 16
type ifreq_addr = struct
diff --git a/libstd/ifreq+osx.myr b/libstd/ifreq+osx.myr
index 93ec177..f5205bf 100644
--- a/libstd/ifreq+osx.myr
+++ b/libstd/ifreq+osx.myr
@@ -1,6 +1,6 @@
use "sys.use"
-pkg std =
+pkg sys =
const Ifnamesz = 16
type ifreq_addr = struct
diff --git a/libstd/sys+freebsd.myr b/libstd/sys+freebsd.myr
index 1fde0b0..34a754a 100644
--- a/libstd/sys+freebsd.myr
+++ b/libstd/sys+freebsd.myr
@@ -1,7 +1,6 @@
-use "types.use"
-use "varargs.use"
+use "systypes.use"
-pkg std =
+pkg sys =
type scno = int64 /*syscall*/
type fdopt = int64 /* fd options */
type fd = int64 /* fd */
@@ -620,7 +619,7 @@ pkg std =
const lstat : (path:byte[:], sb:statbuf# -> int64)
const fstat : (fd:fd, sb:statbuf# -> int64)
const mkdir : (path : byte[:], mode : int64 -> int64)
- const ioctl : (fd:fd, req : int64, args:... -> int64)
+ generic ioctl : (fd:fd, req : int64, arg:@a# -> int64)
const getdirentries64 : (fd : fd, buf : byte[:], basep : uint64# -> int64)
/* networking */
@@ -721,13 +720,7 @@ const stat = {path, sb; -> syscall(Sysstat, cstring(path), a(sb))}
const lstat = {path, sb; -> syscall(Syslstat, cstring(path), a(sb))}
const fstat = {fd, sb; -> syscall(Sysfstat, a(fd), a(sb))}
const mkdir = {path, mode; -> syscall(Sysmkdir, cstring(path), a(mode)) castto(int64)}
-const ioctl = {fd, req, args
- var arg : byte#
- var ap
-
- ap = vastart(&args)
- (arg, ap) = vanext(ap)
- -> syscall(Sysioctl, a(fd), a(req), a(arg)) castto(int64)
+generic ioctl = {fd, req, arg; -> syscall(Sysioctl, a(fd), a(req), a(arg)) castto(int64)
}
const getdirentries64 = {fd, buf, basep; -> syscall(Sysgetdirentries, a(fd), buf castto(byte#), a(buf.len), a(basep))}
diff --git a/libstd/sys+osx.myr b/libstd/sys+osx.myr
index 0bb4cbb..29a00ac 100644
--- a/libstd/sys+osx.myr
+++ b/libstd/sys+osx.myr
@@ -1,7 +1,6 @@
-use "types.use"
-use "varargs.use"
+use "systypes.use"
-pkg std =
+pkg sys =
type scno = int64 /* syscall */
type fdopt = int64 /* fd options */
type fd = int32 /* fd */
@@ -575,7 +574,7 @@ pkg std =
const lstat : (path:byte[:], sb:statbuf# -> int64)
const fstat : (fd:fd, sb:statbuf# -> int64)
const mkdir : (path : byte[:], mode : int64 -> int64)
- const ioctl : (fd:fd, req : int64, args:... -> int64)
+ generic ioctl : (fd:fd, req : int64, arg : @a# -> int64)
const getdirentries64 : (fd : fd, buf : byte[:], basep : int64# -> int64)
const chdir : (p : byte[:] -> int64)
@@ -706,14 +705,8 @@ const stat = {path, sb; -> syscall(Sysstat64, cstring(path), a(sb))}
const lstat = {path, sb; -> syscall(Syslstat64, cstring(path), a(sb))}
const fstat = {fd, sb; -> syscall(Sysfstat64, a(fd), a(sb))}
const mkdir = {path, mode; -> syscall(Sysmkdir, cstring(path), a(mode)) castto(int64)}
-const ioctl = {fd, req, args
- var arg : byte#
- var ap
+generic ioctl = {fd, req, arg; -> syscall(Sysioctl, a(fd), a(req), a(arg)) castto(int64)}
- ap = vastart(&args)
- (arg, ap) = vanext(ap)
- -> syscall(Sysioctl, a(fd), a(req), a(arg)) castto(int64)
-}
const getdirentries64 = {fd, buf, basep; -> syscall(Sysgetdirentries64, a(fd), buf castto(byte#), a(buf.len), a(basep))}
const chdir = {dir; -> syscall(Syschdir, dir)}
diff --git a/libstd/syscall+freebsd-x64.s b/libstd/syscall+freebsd-x64.s
index c810945..680971e 100644
--- a/libstd/syscall+freebsd-x64.s
+++ b/libstd/syscall+freebsd-x64.s
@@ -1,14 +1,14 @@
-.globl std$syscall
-std$syscall:
- pushq %rbp
- pushq %rdi
- pushq %rsi
- pushq %rdx
- pushq %r10
+.globl sys$syscall
+sys$syscall:
+ pushq %rbp
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %r10
pushq %r8
pushq %r9
- pushq %rcx
- pushq %r11
+ pushq %rcx
+ pushq %r11
/*
hack: We load 6 args regardless of
how many we actually have. This may