2002-08-03 22:40:49

by Brian Gerst

[permalink] [raw]
Subject: [PATCH] Dead code in i386/kernel/process.c

diff -urN linux-2.5.30/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c
--- linux-2.5.30/arch/i386/kernel/process.c Fri Aug 2 10:15:28 2002
+++ linux/arch/i386/kernel/process.c Sat Aug 3 16:41:03 2002
@@ -313,11 +313,6 @@
memcpy (swapper_pg_dir, swapper_pg_dir + USER_PGD_PTRS,
sizeof (swapper_pg_dir [0]) * KERNEL_PGD_PTRS);

- /* Make sure the first page is mapped to the start of physical memory.
- It is normally not mapped, to trap kernel NULL pointer dereferences. */
-
- pg0[0] = _PAGE_RW | _PAGE_PRESENT;
-
/*
* Use `swapper_pg_dir' as our page directory.
*/


Attachments:
pg0-1 (597.00 B)

2002-08-03 23:11:03

by Brian Gerst

[permalink] [raw]
Subject: Re: [PATCH] Dead code in i386/kernel/process.c

Brian Gerst wrote:
> This patch removes an artifact of code left over from the 2.0 days when
> the kernel didn't use flat segments.
>
>
> ------------------------------------------------------------------------
>
> diff -urN linux-2.5.30/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c
> --- linux-2.5.30/arch/i386/kernel/process.c Fri Aug 2 10:15:28 2002
> +++ linux/arch/i386/kernel/process.c Sat Aug 3 16:41:03 2002
> @@ -313,11 +313,6 @@
> memcpy (swapper_pg_dir, swapper_pg_dir + USER_PGD_PTRS,
> sizeof (swapper_pg_dir [0]) * KERNEL_PGD_PTRS);
>
> - /* Make sure the first page is mapped to the start of physical memory.
> - It is normally not mapped, to trap kernel NULL pointer dereferences. */
> -
> - pg0[0] = _PAGE_RW | _PAGE_PRESENT;
> -
> /*
> * Use `swapper_pg_dir' as our page directory.
> */

I should clarify that the dead code does the same thing as the preceding
memcpy.

2002-08-04 15:43:15

by Jamie Lokier

[permalink] [raw]
Subject: Re: [PATCH] Dead code in i386/kernel/process.c

Brian Gerst wrote:
> This patch removes an artifact of code left over from the 2.0 days when
> the kernel didn't use flat segments.

This code dates back to a patch for 1.2.8 :-)
The comment is quite wrong now.

Can we trust that arch/i386/mm/init.c will continue to map the page at
0xc0000000 (PAGE_OFFSET) to physical address 0? I guess so, hence the
patch is fine.

-- Jamie