Google
  Web www.spinics.net

Page table

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


Hello all,

Can anyone point me in the correct direction to figure out how the page
table works?

I'm trying to modify the Cirrus EP93xx bootloader code to use a
different chip-select for the flash memory. I haven't been able to find
any information to describe what the following code actually does (this
is from the init.S used by the second-stage bootloader).

I understand the logic of the code and what it's supposed to do. I just
don't understand what the meaning of the values are that are actually
stored in the table. I assume that it's some sort of bit-mask that
defines the various regions of memory that are being mapped by the MMU
but don't know what the bits mean.

--------

reset _LABEL_
    //
    // Set the stack pointer to 0x00600000
    //
    ldr     r13, = 0x00600000

    //
    // Load a pointer to the page table
    //
    mov     r11, pc
    and     r11, r11, _CONST_ 0xf0000000
    orr     r0, r11, _CONST_ 0x000040000

    //
    // Clear out the page table
    //
clear _LABEL_
        str     r3, [r1], _CONST_ 4
        subs    r2, r2, _CONST_ 4
        bne     clear

    //
    // Create a non-cacheable/non-bufferable mapping of SDRAM
    // at 0x0000_0000, only map 8M for this program
    //
    mov     r1, r0
    mov     r2, _CONST_ 0x00000020
    orr     r3, r11, _CONST_ 0x00000012
    orr     r3, r3, _CONST_ 0x00000c00
map_sdram _LABEL_
        str     r3, [r1], _CONST_ 4
        add     r3, r3, _CONST_ 0x00100000
        subs    r2, r2, _CONST_ 4
        bne     map_sdram

    //
    // Create a read-write mapping of FLASH nCS6
    // at virtual address 0x6000_0000
    //
    add     r1, r0, _CONST_ 0x00001800
    mov     r2, _CONST_ 0x00000400
    ldr     r3, =0x60000c12
map_flash_6 _LABEL_
        str     r3, [r1], _CONST_ 4
        add     r3, r3, _CONST_ 0x00100000
        subs    r2, r2, _CONST_ 4
        bne     map_flash_6

    //
    // Create a read-write mapping of the hardware registers
    // at virtual address 0x8000_0000
    //
    add     r1, r0, _CONST_ 0x000020000
    mov     r2, _CONST_ 0x00000400
    ldr     r3, =0x80000c12
map_hw _LABEL_
        str     r3, [r1], _CONST_ 4
        add     r3, r3, _CONST_ 0x00100000
        subs    r2, r2, _CONST_ 4
        bne     map_hw

    //
    // Setup the MMU
    //
    orr     r0, r11, _CONST_ 0x000040000
    mcr     p15, 0, r0, c2, c0, 0
    mov     r0, _CONST_ 0x00000003
    mcr     p15, 0, r0, c3, c0, 0

    //
    // Enable the MMU and branch to out equivalent virtual address
    //
    ldr     r0, =0xc0000079
    ldr     r1, =go_virtual
    mov     r2, r11
    sub     r1, r1, r2
    bic     r1, r1, _CONST_ 0xf0000000
    mcr     p15, 0, r0, c1, c0, 0
    mov     pc, r1
go_virtual _LABEL_
    nop

    //
    // Switch to C entry
    //
    bl      main

    _END_

--------

Thanks for any help,
Hartley Sweeten

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Site Home]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux ARM Kernel]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Tools]     [DDR & Rambus]     [Monitors]

Powered by Linux

Google PageRank Checking tool