debuggers.hg

diff xen/include/asm-x86/page.h @ 3632:fec8b1778268

bitkeeper revision 1.1159.212.60 (41febc4bKKSkh9u-Zes9v2CmBuLZxA)

More bootstrap fixes for x86/64. Next thing to do is sort out the IDT and
get traps.c working; then we can get rid of a bunch of dummy labels from
end of boot/x86_64.S. We're also going to need some kind of entry.S before
we can safely enable interrupts. Also bear in mind that not all of physical
RAM may be mapped (only first 1GB) and no m2p table is yet allocated or
mapped. Plenty to be done!
author kaf24@viper.(none)
date Mon Jan 31 23:16:27 2005 +0000 (2005-01-31)
parents d1e0d9a8fde0
children bbe8541361dd 253e8e10e986
line diff
     1.1 --- a/xen/include/asm-x86/page.h	Sat Jan 29 22:42:20 2005 +0000
     1.2 +++ b/xen/include/asm-x86/page.h	Mon Jan 31 23:16:27 2005 +0000
     1.3 @@ -46,7 +46,6 @@ typedef struct { unsigned long l1_lo; } 
     1.4  typedef struct { unsigned long l2_lo; } l2_pgentry_t;
     1.5  typedef struct { unsigned long l3_lo; } l3_pgentry_t;
     1.6  typedef struct { unsigned long l4_lo; } l4_pgentry_t;
     1.7 -typedef struct { unsigned long pt_lo; } pagetable_t;
     1.8  #endif /* !__ASSEMBLY__ */
     1.9  
    1.10  /* Strip type from a table entry. */
    1.11 @@ -54,14 +53,12 @@ typedef struct { unsigned long pt_lo; } 
    1.12  #define l2_pgentry_val(_x) ((_x).l2_lo)
    1.13  #define l3_pgentry_val(_x) ((_x).l3_lo)
    1.14  #define l4_pgentry_val(_x) ((_x).l4_lo)
    1.15 -#define pagetable_val(_x)  ((_x).pt_lo)
    1.16  
    1.17  /* Add type to a table entry. */
    1.18  #define mk_l1_pgentry(_x)  ( (l1_pgentry_t) { (_x) } )
    1.19  #define mk_l2_pgentry(_x)  ( (l2_pgentry_t) { (_x) } )
    1.20  #define mk_l3_pgentry(_x)  ( (l3_pgentry_t) { (_x) } )
    1.21  #define mk_l4_pgentry(_x)  ( (l4_pgentry_t) { (_x) } )
    1.22 -#define mk_pagetable(_x)   ( (pagetable_t) { (_x) } )
    1.23  
    1.24  /* Turn a typed table entry into a page index. */
    1.25  #define l1_pgentry_to_pagenr(_x) (l1_pgentry_val(_x) >> PAGE_SHIFT) 
    1.26 @@ -91,11 +88,23 @@ typedef struct { unsigned long pt_lo; } 
    1.27    ((_a) >> L2_PAGETABLE_SHIFT)
    1.28  #elif defined(__x86_64__)
    1.29  #define l2_table_offset(_a) \
    1.30 -  (((_a) >> L2_PAGETABLE_SHIFT) & (ENTRIES_PER_L2_PAGETABLE -1))
    1.31 +  (((_a) >> L2_PAGETABLE_SHIFT) & (ENTRIES_PER_L2_PAGETABLE - 1))
    1.32  #define l3_table_offset(_a) \
    1.33 -  (((_a) >> L3_PAGETABLE_SHIFT) & (ENTRIES_PER_L3_PAGETABLE -1))
    1.34 +  (((_a) >> L3_PAGETABLE_SHIFT) & (ENTRIES_PER_L3_PAGETABLE - 1))
    1.35  #define l4_table_offset(_a) \
    1.36 -  ((_a) >> L4_PAGETABLE_SHIFT)
    1.37 +  (((_a) >> L4_PAGETABLE_SHIFT) & (ENTRIES_PER_L4_PAGETABLE - 1))
    1.38 +#endif
    1.39 +
    1.40 +#if defined(__i386__)
    1.41 +#define pagetable_t l2_pgentry_t
    1.42 +#define pagetable_val(_x)  ((_x).l2_lo)
    1.43 +#define mk_pagetable(_x)   ( (l2_pgentry_t) { (_x) } )
    1.44 +#define ENTRIES_PER_PAGETABLE ENTRIES_PER_L2_PAGETABLE
    1.45 +#elif defined(__x86_64__)
    1.46 +#define pagetable_t l4_pgentry_t
    1.47 +#define pagetable_val(_x)  ((_x).l4_lo)
    1.48 +#define mk_pagetable(_x)   ( (l4_pgentry_t) { (_x) } )
    1.49 +#define ENTRIES_PER_PAGETABLE ENTRIES_PER_L4_PAGETABLE
    1.50  #endif
    1.51  
    1.52  #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
    1.53 @@ -131,11 +140,7 @@ typedef struct { unsigned long pt_lo; } 
    1.54  
    1.55  #define va_to_l1mfn(_va) (l2_pgentry_val(linear_l2_table[_va>>L2_PAGETABLE_SHIFT]) >> PAGE_SHIFT)
    1.56  
    1.57 -#ifdef __i386__
    1.58 -extern l2_pgentry_t idle_pg_table[ENTRIES_PER_L2_PAGETABLE];
    1.59 -#else
    1.60 -extern l4_pgentry_t idle_pg_table[ENTRIES_PER_L4_PAGETABLE];
    1.61 -#endif
    1.62 +extern pagetable_t idle_pg_table[ENTRIES_PER_PAGETABLE];
    1.63  
    1.64  extern void paging_init(void);
    1.65  
    1.66 @@ -191,6 +196,7 @@ extern void paging_init(void);
    1.67  #define PAGE_HYPERVISOR_NOCACHE MAKE_GLOBAL(__PAGE_HYPERVISOR_NOCACHE)
    1.68  
    1.69  #ifndef __ASSEMBLY__
    1.70 +
    1.71  static __inline__ int get_order(unsigned long size)
    1.72  {
    1.73      int order;
    1.74 @@ -205,6 +211,16 @@ static __inline__ int get_order(unsigned
    1.75  }
    1.76  
    1.77  extern void zap_low_mappings(void);
    1.78 -#endif
    1.79 +
    1.80 +/* Map physical byte range (@p, @p+@s) at virt address @v in pagetable @pt. */
    1.81 +extern int
    1.82 +map_pages(
    1.83 +    pagetable_t *pt,
    1.84 +    unsigned long v,
    1.85 +    unsigned long p,
    1.86 +    unsigned long s,
    1.87 +    unsigned long flags);
    1.88 +
    1.89 +#endif /* !__ASSEMBLY__ */
    1.90  
    1.91  #endif /* __I386_PAGE_H__ */