Skip to contentSkip to conversation

s390 bits for remap-file-pages-prot.

PATCH In review Martin Schwidefsky 2 participants 2 messages Mar 11, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390 bits for remap-file-pages-prot.

Hi Andrew,
I tried 2.6.4-mm1 and found that it wouldn't even compile because of the remap-file-pages-prot changes. After some bit moving in the definition of the s390 ptes I got it to work. Please add to -mm and send it with the remap-file-pages-prot patch when it goes into the mainline.

blue skies,
Martin.

---
s390 memory management changes for remap-file-pages-prot patch:
- Add pgoff_prot_to_pte/pte_to_pgprot, remove pgoff_to_pte (required for 'prot' parameteter in shared-writeable mappings).
- Handle VM_FAULT_SIGSEGV from handle_mm_fault in do_exception.
- Add sys_remap_file_pages system call.
- Add MAP_INHERIT.

diffstat:

 arch/s390/kernel/compat_wrapper.S |   10 +++
 arch/s390/kernel/syscalls.S       |    1 
 arch/s390/mm/fault.c              |    2 
 include/asm-s390/mman.h           |    1 
 include/asm-s390/pgtable.h        |  122 +++++++++++++++++++++++---------------
 include/asm-s390/unistd.h         |    3 
 6 files changed, 90 insertions(+), 49 deletions(-)
arch/s390/kernel/compat_wrapper.S +10 -0
diff -urN linux-2.6-orig/arch/s390/kernel/compat_wrapper.S linux-2.6/arch/s390/kernel/compat_wrapper.S
@@ -1338,3 +1338,13 @@
 	llgtr	%r3,%r3			# struct iocb *
 	llgtr	%r4,%r4			# struct io_event *
 	jg	sys_io_cancel
+
+	.globl  sys32_remap_file_pages_wrapper
+sys32_remap_file_pages_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# unsigned long
+	llgfr	%r4,%r4			# unsigned long
+	llgfr	%r5,%r5			# unsigned long
+	llgfr	%r6,%r6			# unsigned long
+	jg	sys_remap_file_pages
+
arch/s390/kernel/syscalls.S +1 -0
diff -urN linux-2.6-orig/arch/s390/kernel/syscalls.S linux-2.6/arch/s390/kernel/syscalls.S
@@ -273,3 +273,4 @@
 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
 NI_SYSCALL							/* reserved for vserver */
 SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
+SYSCALL(sys_remap_file_pages,sys_remap_file_pages,sys32_remap_file_pages_wrapper)
arch/s390/mm/fault.c +2 -0
diff -urN linux-2.6-orig/arch/s390/mm/fault.c linux-2.6/arch/s390/mm/fault.c
@@ -256,6 +256,8 @@
 		goto do_sigbus;
 	case VM_FAULT_OOM:
 		goto out_of_memory;
+	case VM_FAULT_SIGSEGV:
+		goto bad_area;
 	default:
 		BUG();
 	}
include/asm-s390/mman.h +1 -0
diff -urN linux-2.6-orig/include/asm-s390/mman.h linux-2.6/include/asm-s390/mman.h
@@ -30,6 +30,7 @@
 #define MAP_NORESERVE	0x4000		/* don't check for reservations */
 #define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
 #define MAP_NONBLOCK	0x10000		/* do not block on IO */
+#define MAP_INHERIT	0x20000		/* inherit the protection bits of the underlying vma*/
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */
include/asm-s390/pgtable.h +74 -48

207 lines not on this page · raw message

include/asm-s390/unistd.h +2 -1
diff -urN linux-2.6-orig/include/asm-s390/unistd.h linux-2.6/include/asm-s390/unistd.h
@@ -260,8 +260,9 @@
  * Number 263 is reserved for vserver
  */
 #define __NR_fadvise64_64	264
+#define __NR_remap_file_pages	265
 
-#define NR_syscalls 265
+#define NR_syscalls 266
 
 /* 
  * There are some system calls that are not present on 64 bit, some
#1 lore raw
Quoted 3 lines · Martin Schwidefsky

I tried 2.6.4-mm1 and found that it wouldn't even compile because
of the remap-file-pages-prot changes.

Yup, sorry. Actually, if you look inside

ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.4/2.6.4-mm1/broken-out/remap-file-pages-prot-ia64-2.6.4-rc2-mm1-A0.patch

There's a little test app to check the functionality of the new syscall. You'll need to tweak the syscall slot number.