patch-2.4.5 linux/include/asm-ppc/bootinfo.h

Next file: linux/include/asm-ppc/bootx.h
Previous file: linux/include/asm-ppc/board.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/include/asm-ppc/bootinfo.h linux/include/asm-ppc/bootinfo.h
@@ -1,11 +1,13 @@
 /*
+ * BK Id: SCCS/s.bootinfo.h 1.7 05/23/01 00:38:42 cort
+ */
+/*
  * Non-machine dependent bootinfo structure.  Basic idea
  * borrowed from the m68k.
  *
  * Copyright (C) 1999 Cort Dougan <cort@ppc.kernel.org>
  */
 
-
 #ifdef __KERNEL__
 #ifndef _PPC_BOOTINFO_H
 #define _PPC_BOOTINFO_H
@@ -32,6 +34,27 @@
 
 #endif /* CONFIG_APUS */
 
-#endif /* _PPC_BOOTINFO_H */
+/*
+ * prom_init() is called very early on, before the kernel text
+ * and data have been mapped to KERNELBASE.  At this point the code
+ * is running at whatever address it has been loaded at, so
+ * references to extern and static variables must be relocated
+ * explicitly.  The procedure reloc_offset() returns the address
+ * we're currently running at minus the address we were linked at.
+ * (Note that strings count as static variables.)
+ *
+ * Because OF may have mapped I/O devices into the area starting at
+ * KERNELBASE, particularly on CHRP machines, we can't safely call
+ * OF once the kernel has been mapped to KERNELBASE.  Therefore all
+ * OF calls should be done within prom_init(), and prom_init()
+ * and all routines called within it must be careful to relocate
+ * references as necessary.
+ */
+#define PTRRELOC(x)   ((typeof(x))((unsigned long)(x) + offset))
+#define PTRUNRELOC(x) ((typeof(x))((unsigned long)(x) - offset))
+#define RELOC(x)      (*PTRRELOC(&(x)))
 
+#endif /* _PPC_BOOTINFO_H */
 #endif /* __KERNEL__ */
+
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)