Skip to contentSkip to conversation

linux-2.6 jejb

parisc-linux James Bottomley 3 participants 4 messages Sep 19, 2003 1 message not in the archive PA-RISC architecture

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 9 lines · James Bottomley

CVSROOT: /var/cvs
Module name: linux-2.6
Changes by: jejb 03/09/18 19:03:56

Modified files:
. : Makefile
arch/parisc/kernel: module.c signal.c
include/asm-parisc: elf.h

Quoted 7 lines

Log message:
Clean up signal handling code:

- remove the less than helpful comments (and replace them with meaningful ones
- get rid of the HACK macros
- Unify the PLABEL function descriptor handling with modules.c

===== arch/parisc/kernel/module.c 1.8 vs edited =====

arch/parisc/kernel/module.c +7 -14
@@ -73,10 +73,7 @@
 	Elf32_Addr addr;
 };
 
-struct fdesc_entry {
-	Elf32_Addr addr;
-	Elf32_Addr gp;
-};
+#define Elf_Fdesc	Elf32_Fdesc
 
 struct stub_entry {
 	Elf32_Word insns[2]; /* each stub entry has two insns */
@@ -86,11 +83,7 @@
 	Elf64_Addr addr;
 };
 
-struct fdesc_entry {
-	Elf64_Addr dummy[2];
-	Elf64_Addr addr;
-	Elf64_Addr gp;
-};
+#define Elf_Fdesc	Elf64_Fdesc
 
 struct stub_entry {
 	Elf64_Word insns[4]; /* each stub entry has four insns */
@@ -276,7 +269,7 @@
 
 	me->core_size = ALIGN(me->core_size, 16);
 	me->arch.fdesc_offset = me->core_size;
-	me->core_size += fdescs * sizeof(struct fdesc_entry);
+	me->core_size += fdescs * sizeof(Elf_Fdesc);
 
 	me->core_size = ALIGN(me->core_size, 16);
 	me->arch.stub_offset = me->core_size;
@@ -322,7 +315,7 @@
 #ifdef __LP64__
 static Elf_Addr get_fdesc(struct module *me, unsigned long value)
 {
-	struct fdesc_entry *fdesc = me->module_core + me->arch.fdesc_offset;
+	Elf_Fdesc *fdesc = me->module_core + me->arch.fdesc_offset;
 
 	if (!value) {
 		printk(KERN_ERR "%s: zero OPD requested!\n", me->name);
@@ -664,7 +657,7 @@
 				*loc64 = get_fdesc(me, val+addend);
 				DEBUGP("FDESC for %s at %p points to %lx\n",
 				       strtab + sym->st_name, *loc64,
-				       ((struct fdesc_entry *)*loc64)->addr);
+				       ((Elf_Fdesc *)*loc64)->addr);
 			} else {
 				/* if the symbol is not local to this
 				 * module then val+addend is a pointer
@@ -696,10 +689,10 @@
 	Elf_Sym *newptr, *oldptr;
 	Elf_Shdr *symhdr = NULL;
 #ifdef DEBUG
-	struct fdesc_entry *entry;
+	Elf_Fdesc *entry;
 	u32 *addr;
 
-	entry = (struct fdesc_entry *)me->init;
+	entry = (Elf_Fdesc *)me->init;
 	printk("FINALIZE, ->init FPTR is %p, GP %lx ADDR %lx\n", entry,
 	       entry->gp, entry->addr);
 	addr = (u32 *)entry->addr;

===== arch/parisc/kernel/signal.c 1.13 vs edited =====

arch/parisc/kernel/signal.c +26 -35

111 lines not on this page · raw message

===== include/asm-parisc/elf.h 1.8 vs edited =====

include/asm-parisc/elf.h +24 -0
@@ -144,6 +144,30 @@
 #define R_PARISC_LTOFF_TP16DF	231	/* 16 bits LT-TP-rel. address.  */
 #define R_PARISC_HIRESERVE	255
 
+#define PA_PLABEL_FDESC		0x02	/* bit set if PLABEL points to
+					 * a function descriptor, not
+					 * an address */
+
+/* The following are PA function descriptors 
+ *
+ * addr:	the absolute address of the function
+ * gp:		either the data pointer (r27) for non-PIC code or the
+ *		the PLT pointer (r19) for PIC code */
+
+/* Format for the Elf32 Function descriptor */
+typedef struct elf32_fdesc {
+	__u32	addr;
+	__u32	gp;
+} Elf32_Fdesc;
+
+/* Format for the Elf64 Function descriptor */
+typedef struct elf64_fdesc {
+	__u64	dummy[2]; /* FIXME: nothing uses these, why waste
+			   * the space */
+	__u64	addr;
+	__u64	gp;
+} Elf64_Fdesc;
+
 /* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr.  */
 
 #define PT_HP_TLS		(PT_LOOS + 0x0)
#2 lore raw

arch/parisc/kernel/signal.c line 319

Quoted 6 lines
arch/parisc/kernel/signal.c +2 -2
-#undef CACHE_FLUSHING_IS_NOT_BROKEN
-#ifdef CACHE_FLUSHING_IS_NOT_BROKEN
+	flush_user_dcache_range((unsigned long) &frame->tramp[0],
+			   (unsigned long) &frame->tramp[4]);
 	flush_user_icache_range((unsigned long) &frame->tramp[0],
 			   (unsigned long) &frame->tramp[4]);

we also have a flush_icache_user_range range macro that does this (flush dcache + icache). The kernel seems to use both.....

randolph

Signature · 3 lines
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
#3 lore raw
Quoted 2 lines · Randolph Chung

we also have a flush_icache_user_range range macro that does this (flush dcache + icache). The kernel seems to use both.....

Well, I just took the least line of resistance.

But it does beg the question: I think all of the PA arch docs require the dcache to be flushed before the icache for all icache flushing, so is there any point exporting an API that only flushes the icache?

James

#4 lore raw
Quoted 3 lines · James Bottomley

But it does beg the question: I think all of the PA arch docs require the dcache to be flushed before the icache for all icache flushing, so is there any point exporting an API that only flushes the icache?

Not true. If you know that the line can't be in the d-cache, then flushing the i-cache is sufficient (and vice-versa). See "Data Cache Move-In", "Instruction Cache Move-In", and "Cache Flushing" in Appendix F of "PA-RISC 2.0 Architecture" (aka, "The Kane Book"), for details.

Now, whether pa-linux keeps track of whether a line could be in only the d- or i-cache, with sufficient accuracy to avoid the other flush, I have no idea. HP-UX does attempt to track this, but doing so in every case can be really tricky, and tracking down the data (or instruction) corruption bugs when you miss some obscure case is a nightmare (and I have the scars to prove it :).

-- Jim
HP PA-RISC/Itanium Processor Architect