shithub: mc

Download patch

ref: c3f597fcf1884f86f69d0d629a2deaef7dae06b2
parent: 6047575d5d08efd7d0f1cd3b837b90d0d1150c30
parent: 6e32479cf6b040766b1788d6f79db4562ca7f05e
author: Ori Bernstein <[email protected]>
date: Mon Jul 23 22:17:49 EDT 2012

Merge branch 'master' of git+ssh://mimir.eigenstate.org/git/ori/libmyr

Conflicts:
	sys-linux.myr

--- a/alloc.myr
+++ b/alloc.myr
@@ -86,11 +86,11 @@
 }
 
 const mkslab = {bkt : bucket*
+	var i
 	var p
 	var s
 	var b
-	var i
-	var bprev
+	var bnext
 	var off /* offset of bin head */
 
 	p = mmap(Zbyte, Pagesz, Mprotrw, Mpriv | Manon, -1, 0)
@@ -104,11 +104,11 @@
 	off = align(sizeof(slab), Align)
 	b = nextbin(s castto(bin*), off)
 	for i = 0; i < bkt.nper; i++
-		b = nextbin(b, bkt.sz)
-		bprev.next = b
-		bprev = b
+		b = bnext
+		bnext = nextbin(b, bkt.sz)
+		b.next = bnext
 	;;
-	bprev.next = Zbin
+	b.next = Zbin
 	-> s
 }
 
--- a/sys-linux.myr
+++ b/sys-linux.myr
@@ -38,10 +38,10 @@
 
 	/* mmap protection */
 	const Mprotnone	: mprot = 0x0
-	const Mprotexec	: mprot = 0x1
-	const Mprotrd	: mprot = 0x2
-	const Mprotwr	: mprot = 0x4
-	const Mprotrw	: mprot = 0x6
+	const Mprotrd	: mprot = 0x1
+	const Mprotwr	: mprot = 0x2
+	const Mprotexec	: mprot = 0x4
+	const Mprotrw	: mprot = 0x3 /* convenience */
 	
 	/* mmap options */
 	const Mshared	: mopt = 0x1
@@ -67,6 +67,7 @@
 	const Sysfstat	: scno = 108
 	const Syskill	: scno = 37
 	const Sysgetpid	: scno = 20
+	const Sysmmap	: scno = 90
 	const Sysmmap2	: scno = 192
 	const Sysmunmap	: scno = 91
 
--- a/syscall-linux.s
+++ b/syscall-linux.s
@@ -1,9 +1,6 @@
 .globl std$syscall
 std$syscall:
 	pushl %ebp
-	movl %esp,%ebp
-	movl 12(%ebp),%eax #count
-        shl  $2,%eax
 	/*
 	   hack: 6 args uses %ebp, so we index
 	   relative to %esp.
@@ -14,14 +11,14 @@
            doesn't use them, it's going to be
            harmless.
 	 */
-	movl 32(%esp),%ebp
-	movl 28(%esp),%edi
-	movl 24(%esp),%esi
-	movl 20(%esp),%edx
-	movl 16(%esp),%ecx
-	movl 12(%esp),%ebx
 	movl 8(%esp),%eax
+	movl 12(%esp),%ebx
+	movl 16(%esp),%ecx
+	movl 20(%esp),%edx
+	movl 24(%esp),%esi
+	movl 28(%esp),%edi
+	movl 32(%esp),%ebp
+
         int $0x80
-	movl %ebp,%esp
 	popl %ebp
 	ret
--- a/syscall.s
+++ b/syscall.s
@@ -1,9 +1,6 @@
 .globl std$syscall
 std$syscall:
 	pushl %ebp
-	movl %esp,%ebp
-	movl 12(%ebp),%eax #count
-        shl  $2,%eax
 	/*
 	   hack: 6 args uses %ebp, so we index
 	   relative to %esp.
@@ -14,15 +11,14 @@
            doesn't use them, it's going to be
            harmless.
 	 */
-	movl 32(%esp),%ebp
-	movl 28(%esp),%edi
-	movl 24(%esp),%esi
-	movl 20(%esp),%edx
-	movl 16(%esp),%ecx
-	movl 12(%esp),%ebx
 	movl 8(%esp),%eax
+	movl 12(%esp),%ebx
+	movl 16(%esp),%ecx
+	movl 20(%esp),%edx
+	movl 24(%esp),%esi
+	movl 28(%esp),%edi
+	movl 32(%esp),%ebp
         int $0x80
-	movl %ebp,%esp
 	popl %ebp
 	ret