Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/include/mm/page.h

    rdc0b964 r98000fb  
    2727 */
    2828
    29 /** @addtogroup ia32mm
     29/** @addtogroup ia32mm 
    3030 * @{
    3131 */
     
    3737
    3838#include <arch/mm/frame.h>
    39 #include <trace.h>
    4039
    41 #define PAGE_WIDTH  FRAME_WIDTH
    42 #define PAGE_SIZE   FRAME_SIZE
     40#define PAGE_WIDTH      FRAME_WIDTH
     41#define PAGE_SIZE       FRAME_SIZE
    4342
    4443#ifdef KERNEL
    4544
    4645#ifndef __ASM__
    47 
    48 #define KA2PA(x)  (((uintptr_t) (x)) - UINT32_C(0x80000000))
    49 #define PA2KA(x)  (((uintptr_t) (x)) + UINT32_C(0x80000000))
    50 
    51 #else /* __ASM__ */
    52 
    53 #define KA2PA(x)  ((x) - 0x80000000)
    54 #define PA2KA(x)  ((x) + 0x80000000)
    55 
    56 #endif /* __ASM__ */
     46#       define KA2PA(x) (((uintptr_t) (x)) - 0x80000000)
     47#       define PA2KA(x) (((uintptr_t) (x)) + 0x80000000)
     48#else
     49#       define KA2PA(x) ((x) - 0x80000000)
     50#       define PA2KA(x) ((x) + 0x80000000)
     51#endif
    5752
    5853/*
     
    6257
    6358/* Number of entries in each level. */
    64 #define PTL0_ENTRIES_ARCH  1024
    65 #define PTL1_ENTRIES_ARCH  0
    66 #define PTL2_ENTRIES_ARCH  0
    67 #define PTL3_ENTRIES_ARCH  1024
     59#define PTL0_ENTRIES_ARCH       1024
     60#define PTL1_ENTRIES_ARCH       0
     61#define PTL2_ENTRIES_ARCH       0
     62#define PTL3_ENTRIES_ARCH       1024
    6863
    6964/* Page table sizes for each level. */
    70 #define PTL0_SIZE_ARCH  ONE_FRAME
    71 #define PTL1_SIZE_ARCH  0
    72 #define PTL2_SIZE_ARCH  0
    73 #define PTL3_SIZE_ARCH  ONE_FRAME
     65#define PTL0_SIZE_ARCH          ONE_FRAME
     66#define PTL1_SIZE_ARCH          0
     67#define PTL2_SIZE_ARCH          0
     68#define PTL3_SIZE_ARCH          ONE_FRAME
    7469
    7570/* Macros calculating indices for each level. */
    76 #define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ffU)
    77 #define PTL1_INDEX_ARCH(vaddr)  0
    78 #define PTL2_INDEX_ARCH(vaddr)  0
    79 #define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ffU)
     71#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ff)
     72#define PTL1_INDEX_ARCH(vaddr)  0
     73#define PTL2_INDEX_ARCH(vaddr)  0
     74#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ff)
    8075
    8176/* Get PTE address accessors for each level. */
     
    110105
    111106/* Set PTE flags accessors for each level. */
    112 #define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
     107#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
    113108        set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
    114109#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
     
    126121#define PTE_WRITABLE_ARCH(p) \
    127122        ((p)->writeable != 0)
    128 #define PTE_EXECUTABLE_ARCH(p)  1
     123#define PTE_EXECUTABLE_ARCH(p)                  1
    129124
    130125#ifndef __ASM__
     
    132127#include <mm/mm.h>
    133128#include <arch/interrupt.h>
     129#include <arch/types.h>
    134130#include <typedefs.h>
    135131
     
    148144
    149145/** When bit on this position is 1, a reserved bit was set in page directory. */
    150 #define PFERR_CODE_RSVD         (1 << 3)
     146#define PFERR_CODE_RSVD         (1 << 3)       
    151147
    152 /** Page Table Entry. */
    153 typedef struct {
    154         unsigned present : 1;
    155         unsigned writeable : 1;
    156         unsigned uaccessible : 1;
    157         unsigned page_write_through : 1;
    158         unsigned page_cache_disable : 1;
    159         unsigned accessed : 1;
    160         unsigned dirty : 1;
    161         unsigned pat : 1;
    162         unsigned global : 1;
    163         unsigned soft_valid : 1;        /**< Valid content even if the present bit is not set. */
    164         unsigned avl : 2;
    165         unsigned frame_address : 20;
    166 } __attribute__ ((packed)) pte_t;
    167 
    168 NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
     148static inline int get_pt_flags(pte_t *pt, size_t i)
    169149{
    170150        pte_t *p = &pt[i];
     
    179159}
    180160
    181 NO_TRACE static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
     161static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
    182162{
    183163        pte_t *p = &pt[i];
     
    197177
    198178extern void page_arch_init(void);
    199 extern void page_fault(unsigned int, istate_t *);
     179extern void page_fault(int n, istate_t *istate);
    200180
    201181#endif /* __ASM__ */
Note: See TracChangeset for help on using the changeset viewer.