[parisc-linux-cvs] patch to allow ~4Gb user virtual address space

John Marvin jsm@udlkern.fc.hp.com
Fri, 9 Feb 2001 07:49:04 -0700 (MST)


Here is a patch I just committed to allow 4Gb-1Mb of address space for
32 bit user processes. I also removed calls to access_ok in the signal
code, since access_ok is always true on parisc (and one of the
checks was wrong anyway). Finally I added proper definitions for
KSTK_EIP and KSTK_ESP, so that ps can now print the pc and sp of
blocked processes. I looked at implementing get_wchan, but I am
going to wait for a compiler that provides the unwind info, and see
if that provides an easier way of doing that function.

John

--- arch/parisc/kernel/signal.c.old	Fri Feb  9 07:17:17 2001
+++ arch/parisc/kernel/signal.c	Fri Feb  9 07:20:09 2001
@@ -38,8 +38,6 @@ int do_signal(sigset_t *oldset, struct p
 
 int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from)
 {
-	if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
-		return -EFAULT;
 	if (from->si_code < 0)
 		return __copy_to_user(to, from, sizeof(siginfo_t));
 	else {
@@ -184,9 +182,6 @@ sys_rt_sigreturn(struct pt_regs *regs, i
 	printk("in sys_rt_sigreturn, frame is %p\n", frame);
 #endif
 
-	/* Verify that it's a good sigcontext before using it */
-	if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
-		goto give_sigsegv;
 	if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
 		goto give_sigsegv;
 
@@ -297,18 +292,7 @@ setup_rt_frame(int sig, struct k_sigacti
 	int err = 0;
 
 	usp = regs->gr[30];
-	/* access_ok is broken, so do a simplistic "are we stomping on
-           kernel space" assertion. */
-	if (usp > PAGE_OFFSET) {
-		printk("setup_rt_frame: called on kernel space (usp=%#lx),  NOW YOU MUST DIE!!!\n",
-		       usp);
-		show_regs(regs);
-		while(1);
-	}
-		
 	frame = get_sigframe(ka, usp, sizeof(*frame));
-	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
-		goto give_sigsegv;
 
 #if DEBUG_SIG
 	printk("setup_rt_frame 1: frame %p info %p\n", frame, info);
--- include/asm-parisc/processor.h.old	Fri Feb  9 06:43:21 2001
+++ include/asm-parisc/processor.h	Fri Feb  9 07:09:54 2001
@@ -31,8 +31,8 @@
 
 #define current_text_addr() ({ void *pc; __asm__("\n\tblr 0,%0\n\tnop":"=r" (pc)); pc; })
 
-#define TASK_SIZE	    (PAGE_OFFSET)
-#define TASK_UNMAPPED_BASE  (TASK_SIZE / 3)
+#define TASK_SIZE           (0xFFF00000UL)
+#define TASK_UNMAPPED_BASE  (0x40000000UL)
 
 #ifndef __ASSEMBLY__
 
@@ -298,8 +298,8 @@ extern inline unsigned long get_wchan(st
 	return 0xdeadbeef; /* XXX */
 }
 
-#define KSTK_EIP(tsk)	(0xdeadbeef)
-#define KSTK_ESP(tsk)	(0xdeadbeef)
+#define KSTK_EIP(tsk)   ((tsk)->thread.regs.iaoq[0])
+#define KSTK_ESP(tsk)   ((tsk)->thread.regs.gr[30])
 
 #endif /* __ASSEMBLY__ */
 
--- include/asm-parisc/pgalloc.h.old	Fri Feb  9 07:01:49 2001
+++ include/asm-parisc/pgalloc.h	Fri Feb  9 07:02:44 2001
@@ -207,7 +207,7 @@ static inline void flush_tlb_range(struc
 #define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
 #define PGDIR_MASK	(~(PGDIR_SIZE-1))
 #define PTRS_PER_PGD    (1UL << (PAGE_SHIFT - PT_NLEVELS))
-#define USER_PTRS_PER_PGD	(TASK_SIZE/PGDIR_SIZE)
+#define USER_PTRS_PER_PGD       PTRS_PER_PGD
 
 /* Definitions for 2nd level */