Re: [PATCH 6/7] setup.c: clean up initrd related code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Atsushi Nemoto wrote:
> On Fri, 13 Oct 2006 14:39:05 +0200, Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> wrote:
>> +sanitize:
>> +		/*
>> +		 * Sanitize initrd addresses. For example firmware
>> +		 * can't guess if they need to pass them through
>> +		 * 64-bits values if the kernel has been built in pure
>> +		 * 32-bit. We need also to switch from KSEG0 to XKPHYS
>> +		 * addresses now, so the code can now safely use __pa().
>> +		 */
>> +		end = __pa(initrd_end);
>> +		initrd_end = (unsigned long)__va(end);
>> +		initrd_start = (unsigned long)__va(__pa(initrd_start));
> 
> At last I tested whole patchset on 64-bit and see this is not enough.
> 
> If I passed 0x000000008XXXXXXX instead of 0xffffffff8XXXXXXX to
> initrd_start and initrd_end, the result of __pa() is not what I
> wanted.  This is a proposal fix.
> 
> --- arch/mips/kernel/setup.c.orig	2006-10-19 11:31:12.000000000 +0900
> +++ arch/mips/kernel/setup.c	2006-10-19 13:06:39.000000000 +0900
> @@ -199,6 +199,14 @@
>  		 * 32-bit. We need also to switch from KSEG0 to XKPHYS
>  		 * addresses now, so the code can now safely use __pa().
>  		 */
> +#ifdef CONFIG_64BIT
> +		/* HACK: Guess if the sign extension was forgotten */
> +		if (initrd_start < XKPHYS) {
> +			initrd_end -= initrd_start;
> +			initrd_start = (int)initrd_start;
> +			initrd_end += initrd_start;
> +		}
> +#endif
 
BTW, what about this condition:

		if (initrd_start < PAGE_OFFSET) {
			...;
		}

that would work even on 32 bits kernel.

		Franck



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux