Commit 50eb14c6 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Add 3GB personality

From: Andi Kleen <ak@muc.de>

Another a bit ugly but necessary patch for 32bit emulation.

Some applications including some versions of java break when the stack is
beyond the i386 standard 3GB boundary.  For these add a 3GB personality
that moves the stack to 3GB and fixes the beginning of the mmap area.  It's
a bit ugly, but better than not running these applications at all (e.g. 
the Oracle installer depends on such a buggy java :-().  It's also not only
Java, but some other programs as well.
parent 688b2251
...@@ -160,7 +160,6 @@ struct ustat32 { ...@@ -160,7 +160,6 @@ struct ustat32 {
char f_fpack[6]; char f_fpack[6];
}; };
#define IA32_PAGE_OFFSET 0xffffe000
#define IA32_STACK_TOP IA32_PAGE_OFFSET #define IA32_STACK_TOP IA32_PAGE_OFFSET
#ifdef __KERNEL__ #ifdef __KERNEL__
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <asm/current.h> #include <asm/current.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/mmsegment.h> #include <asm/mmsegment.h>
#include <linux/personality.h>
#define TF_MASK 0x00000100 #define TF_MASK 0x00000100
#define IF_MASK 0x00000200 #define IF_MASK 0x00000200
...@@ -172,7 +173,8 @@ static inline void clear_in_cr4 (unsigned long mask) ...@@ -172,7 +173,8 @@ static inline void clear_in_cr4 (unsigned long mask)
/* This decides where the kernel will search for a free chunk of vm /* This decides where the kernel will search for a free chunk of vm
* space during mmap's. * space during mmap's.
*/ */
#define TASK_UNMAPPED_32 0xa0000000 #define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000)
#define TASK_UNMAPPED_32 (IA32_PAGE_OFFSET / 3)
#define TASK_UNMAPPED_64 PAGE_ALIGN(TASK_SIZE/3) #define TASK_UNMAPPED_64 PAGE_ALIGN(TASK_SIZE/3)
#define TASK_UNMAPPED_BASE \ #define TASK_UNMAPPED_BASE \
(test_thread_flag(TIF_IA32) ? TASK_UNMAPPED_32 : TASK_UNMAPPED_64) (test_thread_flag(TIF_IA32) ? TASK_UNMAPPED_32 : TASK_UNMAPPED_64)
......
...@@ -34,6 +34,7 @@ enum { ...@@ -34,6 +34,7 @@ enum {
SHORT_INODE = 0x1000000, SHORT_INODE = 0x1000000,
WHOLE_SECONDS = 0x2000000, WHOLE_SECONDS = 0x2000000,
STICKY_TIMEOUTS = 0x4000000, STICKY_TIMEOUTS = 0x4000000,
ADDR_LIMIT_3GB = 0x8000000,
}; };
/* /*
...@@ -56,6 +57,7 @@ enum { ...@@ -56,6 +57,7 @@ enum {
PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
PER_LINUX32 = 0x0008, PER_LINUX32 = 0x0008,
PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */ PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */
PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */ PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */
PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */ PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment