72 lines
1.8 KiB
Diff
72 lines
1.8 KiB
Diff
|
From: Thorsten Glaser <tg@mirbsd.org>
|
||
|
Date: Tue, 8 Nov 2011 22:33:12 +0000
|
||
|
Subject: [PATCH] fix mmap syscall on ARM
|
||
|
|
||
|
several issues found while debugging on the Debian armhf porterbox
|
||
|
on #debian-arm with pbrook (Paul Brook) and lindi- (Timo Juhani Lindfors)
|
||
|
|
||
|
- the comment only applies to the non-EABI part of the function
|
||
|
- "This is ARM code. But you've not maked mmap as a function symbol."
|
||
|
=> use the arm-features.h macros
|
||
|
|
||
|
Index: pkg-dietlibc/arm/mmap.S
|
||
|
===================================================================
|
||
|
--- pkg-dietlibc.orig/arm/mmap.S 2012-03-25 15:07:28.000000000 +0000
|
||
|
+++ pkg-dietlibc/arm/mmap.S 2012-03-25 15:14:00.000000000 +0000
|
||
|
@@ -1,22 +1,13 @@
|
||
|
#include <errno.h>
|
||
|
#include "syscalls.h"
|
||
|
+#include "dietfeatures.h"
|
||
|
+#include "arm-features.h"
|
||
|
|
||
|
.text
|
||
|
|
||
|
-@
|
||
|
-@ mmap takes 6 parameters - ie more than can be passed in registers via the
|
||
|
-@ regular syscall interface. Instead, parameters are passed on the stack.
|
||
|
-@
|
||
|
-@ On entry, the compiler will have already placed the fifth and sixth
|
||
|
-@ parameters on the stack - all we need do here is push the first four and
|
||
|
-@ call the syscall.
|
||
|
-@
|
||
|
-
|
||
|
-.global mmap
|
||
|
+FUNC_START mmap
|
||
|
|
||
|
#ifdef __ARM_EABI__
|
||
|
-
|
||
|
-mmap:
|
||
|
str r5, [sp, #-4]!
|
||
|
ldr r5, [sp, #8]
|
||
|
str r4, [sp, #-4]!
|
||
|
@@ -28,11 +19,19 @@
|
||
|
ldr r4, [sp], #4
|
||
|
ldr r5, [sp], #4
|
||
|
cmn r0, #4096
|
||
|
- mov pc, lr @ return
|
||
|
+ RET
|
||
|
+
|
||
|
+#else
|
||
|
+
|
||
|
+@
|
||
|
+@ mmap takes 6 parameters - ie more than can be passed in registers via the
|
||
|
+@ regular syscall interface. Instead, parameters are passed on the stack.
|
||
|
+@
|
||
|
+@ On entry, the compiler will have already placed the fifth and sixth
|
||
|
+@ parameters on the stack - all we need do here is push the first four and
|
||
|
+@ call the syscall.
|
||
|
+@
|
||
|
|
||
|
-#else
|
||
|
-
|
||
|
-mmap:
|
||
|
stmdb sp!, {r0, r1, r2, r3}
|
||
|
mov r0, sp
|
||
|
swi __NR_mmap
|
||
|
@@ -40,3 +39,5 @@
|
||
|
b __unified_syscall
|
||
|
|
||
|
#endif
|
||
|
+
|
||
|
+FUNC_END mmap
|