Re: Query on mm during initialization phase.

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

 



This is the code snippet, Sent the wrong one last time:

static int do_test_wp_bit(unsigned long vaddr)
{
        char tmp_reg;
        int flag;

        __asm__ __volatile__(
                "       movb %0,%1      \n"
                "1:     movb %1,%0      \n"
                "       xorl %2,%2      \n"
                "2:                     \n"
                ".section __ex_table,\"a\"\n"
                "       .align 4        \n"
                "       .long 1b,2b     \n"
                ".previous              \n"
                :"=m" (*(char *) vaddr),
                 "=q" (tmp_reg),
                 "=r" (flag)
                :"2" (1)
                :"memory");

        return flag;
}


On 6/29/08, Asim <linkasim@xxxxxxxxx> wrote:
> Hi,
>
> I made a custom kernel and it crashes at the below code snippet. Can
> any one explain whats being done in the below code. It comes from
> mm/init.c. The error I get on failure is :
>
> Checking if this processor honours the WP bit even in supervisor
> mode... Starting Phase 0Starting Phase 1.
> general protection fault: bb80 [#1]
> SMP
> Modules linked in:
> CPU:    0
> EIP:    0000:[<00000000>]    Not tainted VLI
> EFLAGS: c014705c   (2.6.18.8-xen #1)
> EIP is at rest_init+0x3fefe000/0x30
> eax: 00000000   ebx: 00030001   ecx: ffffffff   edx: 00000000
> esi: 0000bb80   edi: 00000000   ebp: c03e9d9c   esp: c03e9d90
> ds: 8325   es: 0061   ss: e021
>
> The code segment:
>
> void __init test_wp_bit(void)
> {
> /*
>  * Ok, all PSE-capable CPUs are definitely handling the WP bit right.
>  */
>         const unsigned long vaddr = PAGE_OFFSET;
>         pgd_t *pgd;
>         pmd_t *pmd;
>         pte_t *pte, old_pte;
>
>         printk("Checking if this processor honours the WP bit even in
> supervisor mode... ");
>
>         pgd = swapper_pg_dir + __pgd_offset(vaddr);
>         pmd = pmd_offset(pgd, vaddr);
>         pte = pte_offset(pmd, vaddr);
>         old_pte = *pte;
>         *pte = mk_pte_phys(0, PAGE_READONLY);
>         local_flush_tlb();
>
>         boot_cpu_data.wp_works_ok = do_test_wp_bit(vaddr);
>
>         *pte = old_pte;
>         local_flush_tlb();
>
>         if (!boot_cpu_data.wp_works_ok) {
>                 printk("No.\n");
> #ifdef CONFIG_X86_WP_WORKS_OK
>                 panic("This kernel doesn't support CPU's with broken
> WP. Recompile it for a 386!");
> #endif
>         } else {
>                 printk("Ok.\n");
>         }
> }
>
>
> Regards,
> Asim
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux