shithub: mc

Download patch

ref: 5fa601f9a5d241468d975aa2b531ed7c49980741
parent: 6095d59f1bcd58c59ad3ac4271172c7037c6bda0
author: Ori Bernstein <[email protected]>
date: Wed Aug 1 10:43:03 EDT 2012

64 bit syscall. Untested.

--- a/bld.sh
+++ b/bld.sh
@@ -5,7 +5,7 @@
 # testing purposes on every run as things stand.
 
 export PATH=.:$PATH
-export MC=8m
+export MC=6m
 export MU=muse
 export CC=cc
 export ASOPT="-g"
@@ -35,7 +35,7 @@
 
 function assem {
     for i in $@; do
-        $CC $ASOPT -m32 -c $i
+        $CC $ASOPT -c $i
     done
 }
 
--- /dev/null
+++ b/hello.myr
@@ -1,0 +1,19 @@
+use "sys.use"
+use "alloc.use"
+extern const printf : (str:byte*, ap:... -> void)
+const main = {
+	var x : byte*[1024]
+	var sz
+	var i
+
+	for sz = 1; sz < 65536; sz *= 2
+		for i = 0; i < 1024; i++
+			x[i] = std.bytealloc(sz)
+		;;
+		for i = 0; i < 1024; i++
+			std.bytefree(x[i], sz)
+		;;
+	;;
+	std.write(1, "Hello world\n")
+	printf("some string %d %d \n" castto(byte*), 123, 456)
+}
--- a/syscall-linux.s
+++ b/syscall-linux.s
@@ -1,24 +1,21 @@
 .globl std$syscall
 std$syscall:
-	pushl %ebp
+	pushq %rbp
 	/*
-	   hack: 6 args uses %ebp, so we index
-	   relative to %esp.
-
-           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.
+	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.
 	 */
-	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
+	movq 16(%rsp),%rax
+	movq 24(%rsp),%rdi
+	movq 32(%rsp),%rsi
+	movq 40(%rsp),%rdx
+	movq 48(%rsp),%r10
+	movq 56(%rsp),%r8
+	movq 64(%rsp),%r9
 
-        int $0x80
-	popl %ebp
+	int $0x80
+	popq %rbp
 	ret