Fork us on GitHub Follow us on Facebook Follow us on Twitter

Ignore:
Timestamp:
2012-07-14T09:27:31Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial
Children:
97c7682
Parents:
ee685630
Message:

arm32: Move common definitions to common header.

Restrict including of arch specific headers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/mm/page_armv7.h

    ree685630 r0747468  
    3737#define KERN_arm32_PAGE_armv7_H_
    3838
    39 #include <arch/mm/frame.h>
    40 #include <mm/mm.h>
    41 #include <arch/exception.h>
    42 #include <trace.h>
    43 
    44 #define PAGE_WIDTH      FRAME_WIDTH
    45 #define PAGE_SIZE       FRAME_SIZE
    46 
    47 /* Number of entries in each level. */
    48 #define PTL0_ENTRIES_ARCH       (1 << 12)       /* 4096 */
    49 #define PTL1_ENTRIES_ARCH       0
    50 #define PTL2_ENTRIES_ARCH       0
    51 /* coarse page tables used (256 * 4 = 1KB per page) */
    52 #define PTL3_ENTRIES_ARCH       (1 << 8)        /* 256 */
    53 
    54 /* Page table sizes for each level. */
    55 #define PTL0_SIZE_ARCH          FOUR_FRAMES
    56 #define PTL1_SIZE_ARCH          0
    57 #define PTL2_SIZE_ARCH          0
    58 #define PTL3_SIZE_ARCH          ONE_FRAME
    59 
    60 /* Macros calculating indices into page tables for each level. */
    61 #define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 20) & 0xfff)
    62 #define PTL1_INDEX_ARCH(vaddr)  0
    63 #define PTL2_INDEX_ARCH(vaddr)  0
    64 #define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x0ff)
    65 
    66 /* Get PTE address accessors for each level. */
    67 #define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
    68         ((pte_t *) ((((pte_t *)(ptl0))[(i)].l0).coarse_table_addr << 10))
    69 #define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
    70         (ptl1)
    71 #define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
    72         (ptl2)
    73 #define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
    74         ((uintptr_t) ((((pte_t *)(ptl3))[(i)].l1).frame_base_addr << 12))
    75 
    76 /* Set PTE address accessors for each level. */
    77 #define SET_PTL0_ADDRESS_ARCH(ptl0) \
    78         (set_ptl0_addr((pte_t *) (ptl0)))
    79 #define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
    80         (((pte_t *) (ptl0))[(i)].l0.coarse_table_addr = (a) >> 10)
    81 #define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
    82 #define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
    83 #define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
    84         (((pte_t *) (ptl3))[(i)].l1.frame_base_addr = (a) >> 12)
    85 
    86 /* Get PTE flags accessors for each level. */
    87 #define GET_PTL1_FLAGS_ARCH(ptl0, i) \
    88         get_pt_level0_flags((pte_t *) (ptl0), (size_t) (i))
    89 #define GET_PTL2_FLAGS_ARCH(ptl1, i) \
    90         PAGE_PRESENT
    91 #define GET_PTL3_FLAGS_ARCH(ptl2, i) \
    92         PAGE_PRESENT
    93 #define GET_FRAME_FLAGS_ARCH(ptl3, i) \
    94         get_pt_level1_flags((pte_t *) (ptl3), (size_t) (i))
    95 
    96 /* Set PTE flags accessors for each level. */
    97 #define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
    98         set_pt_level0_flags((pte_t *) (ptl0), (size_t) (i), (x))
    99 #define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
    100 #define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
    101 #define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
    102         set_pt_level1_flags((pte_t *) (ptl3), (size_t) (i), (x))
     39#ifndef KERN_arm32_PAGE_H_
     40#error "Do not include arch specific page.h directly use generic page.h instead"
     41#endif
    10342
    10443/* Macros for querying the last-level PTE entries. */
Note: See TracChangeset for help on using the changeset viewer.