Re: do_page_fault

Linus Torvalds (torvalds@transmeta.com)
17 Aug 1997 05:19:52 GMT


In article <199708170405.VAA16029@connectnet1.connectnet.com>,
Darin Johnson <darin@connectnet.com> wrote:
>
>This is when a kernel accesses a bad page.
>
>However, the two "mk_pte"s seem incorrect. The mk_pte macro assumes
>that kernel virtual memory addresses are passed and will subtract
>0xc0000000 from that address. Thus, pg0[0] will get set to the wrong
>value (0x40000000 | PAGE_SHARED).

Good spotting. Fixed. It might actually make a difference for somebody.

>Also, why is pg0[0] being set anyway? Any access to that location
>would seem to always be an error. In the first case, the mem_init
>code resets pg0[0] to the original value so any change here is
>ignored. In the second case, pg0[0] does not seem to be the correct
>PTE either (swapper_pg_dir[0] is cleared in paging_init).

It's being set because it's being used to test the WP bit - if we don't
set it then we couldn't return to the code that tests it. See the file
arch/i386/mm/init.c (and the "wp_works_ok" variable in particular).

This is all just to support the i386 WP-doesn't-work-in-supervisor-mode
bug,

Linus