shithub: mc

Download patch

ref: c5a41d7c6bb10c1f384cce78953355b1c0c1e6f2
parent: 0f8acbf5559d4710faa41fdb81a5bc892f1a753f
author: Ori Bernstein <[email protected]>
date: Sat Dec 5 23:25:11 EST 2015

Add missing files.

	Fixes FreeBSD support.

--- a/configure
+++ b/configure
@@ -83,7 +83,7 @@
     *)
         echo ''
         echo '********************************'
-        echo 'Unknown system'
+        echo 'Unknown system '$OS
         echo 'Cannot build'
         echo '********************************'
         rm -f config.h config.mk
@@ -92,14 +92,14 @@
 esac
 
 case $MACH in
-    *x86_64*)
-        echo 'export ARCH=x64' >> config.mk
+    *x86_64* | *amd64*)
+	echo 'export ARCH=x64' >> config.mk
         echo 'const Arch = "x64"' >> mbld/config.myr
         ;;
     *)
         echo ''
         echo '********************************'
-        echo 'Unknown system'
+        echo 'Unknown arch '$MACH
         echo 'Cannot build'
         echo '********************************'
 esac
--- /dev/null
+++ b/rt/abort-freebsd.s
@@ -1,0 +1,42 @@
+.text
+
+.globl _rt$abort_oob
+.globl __rt$abort_oob
+_rt$abort_oob:
+__rt$abort_oob:
+	/* format pc */
+	movq	(%rsp),%rax
+	movq	$15,%rdx
+	leaq	.digitchars(%rip),%r8
+        leaq    .pcstr(%rip),%r9
+.loop:
+	movq	%rax, %rcx
+	andq	$0xf, %rcx
+        movb    (%r8,%rcx),%r10b
+	movb	%r10b,(%r9,%rdx)
+	subq	$1, %rdx
+	shrq	$4, %rax
+	jnz .loop
+	/* write abort message */
+	movq	$4, %rax 	/* write(fd=%rdi, msg=%rsi, len=%rdx) */
+	movq	$2, %rdi		/* fd */
+	leaq	.msg(%rip), %rsi	/* msg */
+	movq	$(.msgend-.msg), %rdx	/* length */
+	syscall
+	/* kill self */
+	movq	$20,%rax 	/* getpid */
+	syscall	
+	movq	%rax, %rdi	/* save pid */
+	movq	$37, %rax	/* kill(pid=%rdi, sig=%rsi) */
+	movq	$6, %rsi
+	syscall
+.data
+.msg: 	/* pc name:  */
+	.ascii "0x"
+.pcstr:
+	.ascii "0000000000000000"
+	.ascii ": out of bounds access\n"
+.msgend:
+
+.digitchars:
+	.ascii "0123456789abcdef"