[6b781c0] | 1 | /*
|
---|
[4872160] | 2 | * Copyright (c) 2007 Pavel Jancik
|
---|
[6b781c0] | 3 | * Copyright (c) 2007 Michal Kebrt
|
---|
| 4 | * All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * - Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | * documentation and/or other materials provided with the distribution.
|
---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
---|
| 16 | * derived from this software without specific prior written permission.
|
---|
| 17 | *
|
---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /** @addtogroup arm32boot
|
---|
| 31 | * @{
|
---|
| 32 | */
|
---|
| 33 | /** @file
|
---|
[4872160] | 34 | * @brief Memory management used while booting the kernel.
|
---|
| 35 | *
|
---|
| 36 | * So called "section" paging is used while booting the kernel. The term
|
---|
| 37 | * "section" comes from the ARM architecture specification and stands for the
|
---|
| 38 | * following: one-level paging, 1MB sized pages, 4096 entries in the page
|
---|
| 39 | * table.
|
---|
[96e0748d] | 40 | */
|
---|
[6b781c0] | 41 |
|
---|
[4872160] | 42 | #ifndef BOOT_arm32__MM_H
|
---|
| 43 | #define BOOT_arm32__MM_H
|
---|
[6b781c0] | 44 |
|
---|
[4872160] | 45 | #include <typedefs.h>
|
---|
[6b781c0] | 46 |
|
---|
[4872160] | 47 | /** Describe "section" page table entry (one-level paging with 1 MB sized pages). */
|
---|
| 48 | #define PTE_DESCRIPTOR_SECTION 0x02
|
---|
[6b781c0] | 49 |
|
---|
[4872160] | 50 | /** Page table access rights: user - no access, kernel - read/write. */
|
---|
| 51 | #define PTE_AP_USER_NO_KERNEL_RW 0x01
|
---|
[6b781c0] | 52 |
|
---|
[4872160] | 53 | /* Page table level 0 entry - "section" format is used
|
---|
| 54 | * (one-level paging, 1 MB sized pages). Used only while booting the kernel.
|
---|
[6b781c0] | 55 | */
|
---|
[4872160] | 56 | typedef struct {
|
---|
| 57 | unsigned int descriptor_type : 2;
|
---|
| 58 | unsigned int bufferable : 1;
|
---|
| 59 | unsigned int cacheable : 1;
|
---|
| 60 | unsigned int impl_specific : 1;
|
---|
| 61 | unsigned int domain : 4;
|
---|
| 62 | unsigned int should_be_zero_1 : 1;
|
---|
| 63 | unsigned int access_permission : 2;
|
---|
| 64 | unsigned int should_be_zero_2 : 8;
|
---|
| 65 | unsigned int section_base_addr : 12;
|
---|
| 66 | } __attribute__((packed)) pte_level0_section_t;
|
---|
[6b781c0] | 67 |
|
---|
[4872160] | 68 | extern void mmu_start(void);
|
---|
[6b781c0] | 69 |
|
---|
| 70 | #endif
|
---|
| 71 |
|
---|
| 72 | /** @}
|
---|
| 73 | */
|
---|