[PATCH] Re: pre2.3.6-2 PAGE_OFFSET_RAW & pcmcia

Jakub Jelinek (jj@sunsite.ms.mff.cuni.cz)
Thu, 10 Jun 1999 14:23:56 +0200


On Thu, Jun 10, 1999 at 03:09:44AM +0100, Alan Cox wrote:
> > Two problems here. The first is that the new constant is not propagated
> > to vmlinux.lds
>
> It should be. vmlinux.lds is generated from vmlinux.lds.S. If that didn't
> occur can you rm vmlinux.lds and repeat
>
> > The second is that, for reasons I don't see, PAGE_OFFSET_RAW causes
> > undeclared variable errors compiling pcmcia-cs-3.0.12.
>
> Quite possibly. It relies on CONFIG_1G/CONFIG_2G being defined , I would
> guess that PCMCIA CS doesn't pull that define out of the kernel .config.
> Fixing it to extract this ought to sort that out.

Hi!

What about doing something like this:
Then pcmcia nor any other module should have any problems, plus (that is
more important in my eyes) the same binary modules should work with 1G and
2G kernels. All the dirty work will be done by modutils automagically.
I hope it won't have any performance penalty, at least PAGE_OFFSET+const
should be optimized into the R_I386_32 reloc + const addend, PAGE_OFFSET+var
will be normal addition, var-PAGE_OFFSET will be normal subtraction (I
wonder whether const-PAGE_OFFSET is common), etc. Shifting PAGE_OFFSET down
should not happen IMHO in modules in the common case, if somebody sees it,
then some similar macro for modules can be added for ELF_ET_DYN_BASE and
TASK_UNMAPPED_BASE if needed, maybe USER_PTRS_PER_PGD but IMHO that is
really limited to the core kernel.
Anyway, this patch is untested (sorry, no ia32 around me), so if anyone
would like to actually test this and say to l-k if it works and does not
bring any optimization penalties, I'd be very happy.

--- ./include/asm-i386/page.h.jj Wed Jun 9 08:03:39 1999
+++ ./include/asm-i386/page.h Thu Jun 10 14:07:58 1999
@@ -82,7 +82,13 @@ typedef unsigned long pgprot_t;

#include <asm/page_offset.h>

+extern unsigned long __page_offset_raw[1];
+
+#ifdef __MODULE__
+#define __PAGE_OFFSET (&__page_offset_raw)
+#else
#define __PAGE_OFFSET (PAGE_OFFSET_RAW)
+#endif

#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
--- ./arch/i386/kernel/i386_ksyms.c.jj Mon May 10 19:32:45 1999
+++ ./arch/i386/kernel/i386_ksyms.c Thu Jun 10 14:05:07 1999
@@ -60,6 +60,8 @@ EXPORT_SYMBOL_NOVERS(__put_user_1);
EXPORT_SYMBOL_NOVERS(__put_user_2);
EXPORT_SYMBOL_NOVERS(__put_user_4);

+EXPORT_SYMBOL_NOVERS(__page_offset_raw);
+
EXPORT_SYMBOL(strtok);
EXPORT_SYMBOL(strpbrk);
EXPORT_SYMBOL(strstr);
--- ./arch/i386/vmlinux.lds.S.jj Tue Jun 8 02:02:23 1999
+++ ./arch/i386/vmlinux.lds.S Thu Jun 10 14:03:50 1999
@@ -6,6 +6,7 @@ OUTPUT_ARCH(i386)
ENTRY(_start)
SECTIONS
{
+ __page_offset_raw = PAGE_OFFSET_RAW;
. = PAGE_OFFSET_RAW + 0x100000;
_text = .; /* Text and read-only data */
.text : {
--- ./arch/i386/vmlinux.lds.jj Wed Jun 9 08:03:37 1999
+++ ./arch/i386/vmlinux.lds Thu Jun 10 14:05:58 1999
@@ -6,6 +6,7 @@ OUTPUT_ARCH(i386)
ENTRY(_start)
SECTIONS
{
+ __page_offset_raw = 0xC0000000;
. = 0xC0000000 + 0x100000;
_text = .; /* Text and read-only data */
.text : {

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.3.6 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/