Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@debian.org>
To: ralf@linux-mips.org
Cc: linux-mips@linux-mips.org
Subject: Patch for o32/n32 mmap on 64-bit kernel
Date: Mon, 8 Mar 2004 16:46:30 -0500	[thread overview]
Message-ID: <20040308214629.GA2568@nevyn.them.org> (raw)

As discussed.  Applies to linux-2.4 cleanly, to linux-2.6 also but you'll
need to add:

#if CONFIG_MIPS32
	task_size = TASK_SIZE;
#else


Index: syscall.c
===================================================================
RCS file: /cvsdev/mvl-kernel/linux/arch/mips64/kernel/syscall.c,v
retrieving revision 1.4.8.1
diff -u -p -r1.4.8.1 syscall.c
--- syscall.c	17 Nov 2003 16:29:20 -0000	1.4.8.1
+++ syscall.c	8 Mar 2004 21:43:06 -0000
@@ -61,6 +61,9 @@ unsigned long arch_get_unmapped_area(str
 {
 	struct vm_area_struct * vmm;
 	int do_color_align;
+	unsigned long task_size;
+	
+	task_size = (current->thread.mflags & MF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE;
 
 	if (flags & MAP_FIXED) {
 		/*
@@ -72,7 +75,7 @@ unsigned long arch_get_unmapped_area(str
 		return addr;
 	}
 
-	if (len > TASK_SIZE)
+	if (len > task_size)
 		return -ENOMEM;
 	do_color_align = 0;
 	if (filp || (flags & MAP_SHARED))
@@ -83,7 +86,7 @@ unsigned long arch_get_unmapped_area(str
 		else
 			addr = PAGE_ALIGN(addr);
 		vmm = find_vma(current->mm, addr);
-		if (TASK_SIZE - len >= addr &&
+		if (task_size - len >= addr &&
 		    (!vmm || addr + len <= vmm->vm_start))
 			return addr;
 	}
@@ -95,7 +98,7 @@ unsigned long arch_get_unmapped_area(str
 
 	for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
 		/* At this point:  (!vmm || addr < vmm->vm_end). */
-		if (TASK_SIZE - len < addr)
+		if (task_size - len < addr)
 			return -ENOMEM;
 		if (!vmm || addr + len <= vmm->vm_start)
 			return addr;


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

             reply	other threads:[~2004-03-08 21:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08 21:46 Daniel Jacobowitz [this message]
2004-03-09  4:21 ` Patch for o32/n32 mmap on 64-bit kernel Ralf Baechle
2004-03-17 16:22   ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040308214629.GA2568@nevyn.them.org \
    --to=dan@debian.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox