ref: e3ada3da7e9e7681e86b3f837071e21b499f857a
parent: 5131214c8ddbd9a4f3a4b6c9acef575985ff867d
author: Ori Bernstein <[email protected]>
date: Mon Oct 6 14:08:32 EDT 2014
Update other systems for the libstd/libsys split.
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -84,7 +84,7 @@
%.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
--- 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,7 +64,6 @@
types.myr
units.myr
utf.myr
- util.s
varargs.myr
# platform specific files
@@ -57,15 +70,6 @@
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
--- 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
--- 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
--- 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 @@
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 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))}
--- 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 @@
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 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)}
--- 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