[parisc-linux-cvs] (no subject)

Matthew Wilcox willy@ldl.fc.hp.com
Fri, 23 Feb 2001 13:31:54 -0700


 * Add a new ELF_CORE_COPY_REGS to binfmt_elf32

 * Move the native ELF_CORE_COPY_REGS inside the #ifdef

Index: arch/parisc64/kernel/binfmt_elf32.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc64/kernel/binfmt_elf32.c,v
retrieving revision 1.4
diff -u -p -r1.4 binfmt_elf32.c
--- binfmt_elf32.c	2001/02/13 18:12:56	1.4
+++ binfmt_elf32.c	2001/02/23 20:06:04
@@ -61,6 +61,25 @@ typedef unsigned int elf_caddr_t;
 
 #define ELF_PLATFORM  ("PARISC32\0")
 
+#define ELF_CORE_COPY_REGS(dst, pt)	\
+	memset(dst, 0, sizeof(dst));	/* don't leak any "random" bits */ \
+	{	int i; \
+		for (i = 0; i < 32; i++) dst[i] = (elf_greg_t) pt->gr[i]; \
+		for (i = 0; i < 8; i++) dst[32 + i] = (elf_greg_t) pt->sr[i]; \
+	} \
+	dst[40] = (elf_greg_t) pt->iaoq[0]; dst[41] = (elf_greg_t) pt->iaoq[1]; \
+	dst[42] = (elf_greg_t) pt->iasq[0]; dst[43] = (elf_greg_t) pt->iasq[1]; \
+	dst[44] = (elf_greg_t) pt->sar;   dst[45] = (elf_greg_t) pt->iir; \
+	dst[46] = (elf_greg_t) pt->isr;   dst[47] = (elf_greg_t) pt->ior; \
+	dst[48] = (elf_greg_t) mfctl(22); dst[49] = (elf_greg_t) mfctl(0); \
+	dst[50] = (elf_greg_t) mfctl(24); dst[51] = (elf_greg_t) mfctl(25); \
+	dst[52] = (elf_greg_t) mfctl(26); dst[53] = (elf_greg_t) mfctl(27); \
+	dst[54] = (elf_greg_t) mfctl(28); dst[55] = (elf_greg_t) mfctl(29); \
+	dst[56] = (elf_greg_t) mfctl(30); dst[57] = (elf_greg_t) mfctl(31); \
+	dst[58] = (elf_greg_t) mfctl( 8); dst[59] = (elf_greg_t) mfctl( 9); \
+	dst[60] = (elf_greg_t) mfctl(12); dst[61] = (elf_greg_t) mfctl(13); \
+	dst[62] = (elf_greg_t) mfctl(10); dst[63] = (elf_greg_t) mfctl(15);
+
 /*
  * We should probably use this macro to set a flag somewhere to indicate
  * this is a 32 on 64 process. We could use PER_LINUX_32BIT, or we
Index: include/asm-parisc/elf.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/elf.h,v
retrieving revision 1.13
diff -u -p -r1.13 elf.h
--- elf.h	2001/02/13 18:12:57	1.13
+++ elf.h	2001/02/23 20:06:07
@@ -49,18 +49,6 @@ typedef unsigned long elf_greg_t;
 	current->personality = PER_LINUX
 #endif
 
-#endif /* ! ELF_CLASS */
-
-#define ELF_NGREG 80	/* We only need 64 at present, but leave space
-			   for expansion. */
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-#define ELF_NFPREG 32
-typedef double elf_fpreg_t;
-typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
-
-struct pt_regs;	/* forward declaration... */
-
 /*
  * Fill in general registers in a core dump.  This saves pretty
  * much the same registers as hp-ux, although in a different order.
@@ -100,6 +88,18 @@ struct pt_regs;	/* forward declaration..
 	dst[58] = mfctl( 8); dst[59] = mfctl( 9); \
 	dst[60] = mfctl(12); dst[61] = mfctl(13); \
 	dst[62] = mfctl(10); dst[63] = mfctl(15);
+
+#endif /* ! ELF_CLASS */
+
+#define ELF_NGREG 80	/* We only need 64 at present, but leave space
+			   for expansion. */
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+#define ELF_NFPREG 32
+typedef double elf_fpreg_t;
+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+
+struct pt_regs;	/* forward declaration... */
 
 
 #define elf_check_arch(x) ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS)
Index: include/asm-parisc/mmu_context.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/mmu_context.h,v
retrieving revision 1.11
diff -u -p -r1.11 mmu_context.h
--- mmu_context.h	2001/02/07 14:19:50	1.11
+++ mmu_context.h	2001/02/23 20:06:07
@@ -18,6 +18,7 @@ init_new_context(struct task_struct *tsk
 	    BUG();
 
 	mm->context = alloc_sid();
+	printk("init_new_context: pid %d got sid %ld\n", tsk->pid, mm->context);
 	return 0;
 }
 
@@ -52,6 +53,7 @@ static inline void activate_mm(struct mm
 
 	if (next->context == 0)
 	    next->context = alloc_sid();
+	printk("process %d has sid %ld\n", current->pid, next->context);
 
 	switch_mm(prev,next,current,0);
 }
Index: include/asm-parisc/pgalloc.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/pgalloc.h,v
retrieving revision 1.26
diff -u -p -r1.26 pgalloc.h
--- pgalloc.h	2001/02/13 11:46:14	1.26
+++ pgalloc.h	2001/02/23 20:06:07
@@ -136,6 +136,7 @@ static inline void flush_tlb_mm(struct m
 		if (mm->context != 0)
 			free_sid(mm->context);
 		mm->context = alloc_sid();
+		printk("process %d has sid %ld\n", current->pid, mm->context);
 		if (mm == current->active_mm) {
 			mtsp(mm->context, 3);
 			mtctl(mm->context << 1,8);
Index: kernel/sched.c
===================================================================
RCS file: /home/cvs/parisc/linux/kernel/sched.c,v
retrieving revision 1.13
diff -u -p -r1.13 sched.c
--- sched.c	2001/02/02 03:37:17	1.13
+++ sched.c	2001/02/23 20:06:07
@@ -516,6 +516,10 @@ asmlinkage void schedule(void)
 need_resched_back:
 	prev = current;
 	this_cpu = prev->processor;
+	if (current->cpus_allowed == -1) {
+		printk("Tying process %d to cpu %d\n", prev->pid, this_cpu);
+		prev->cpus_allowed = (1 << this_cpu);
+	}
 
 	if (in_interrupt())
 		goto scheduling_in_interrupt;
@@ -568,6 +572,7 @@ repeat_schedule:
 still_running_back:
 	list_for_each(tmp, &runqueue_head) {
 		p = list_entry(tmp, struct task_struct, run_list);
+//		printk("cpu %d: process %d (has_cpu: %d) on run queue\n", this_cpu, p->pid, p->has_cpu);
 		if (can_schedule(p, this_cpu)) {
 			int weight = goodness(p, this_cpu, prev->active_mm);
 			if (weight > c)
@@ -583,6 +588,7 @@ still_running_back:
 	 * switching to the next task, save this fact in
 	 * sched_data.
 	 */
+//	printk("cpu %d: switching to process %d\n", this_cpu, next->pid);
 	sched_data->curr = next;
 #ifdef CONFIG_SMP
  	next->has_cpu = 1;