source: rtems/c/src/lib/libcpu/powerpc/shared/include/page.h @ d3d9ef37

4.104.114.84.95
Last change on this file since d3d9ef37 was a859df85, checked in by Ralf Corsepius <ralf.corsepius@…>, on Feb 13, 2005 at 5:00:15 AM

New header guards.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 * page.h
3 *
4 *      PowerPC memory management structures
5 *
6 * It is a stripped down version of linux ppc file...
7 *
8 * Copyright (C) 1999  Eric Valette (valette@crf.canon.fr)
9 *                     Canon Centre Recherche France.
10 *
11 *  The license and distribution terms for this file may be
12 *  found in found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  $Id$
16 */
17
18#ifndef _LIBCPU_PAGE_H
19#define _LIBCPU_PAGE_H
20
21/* PAGE_SHIFT determines the page size */
22#define PAGE_SHIFT      12
23#define PAGE_SIZE       (1UL << PAGE_SHIFT)
24#define PAGE_MASK       (~(PAGE_SIZE-1))
25
26#define PAGE_OFFSET     0xc0000000
27
28
29#ifndef ASM
30/*
31 * .. while these make it easier on the compiler
32 */
33typedef unsigned long pte_t;
34typedef unsigned long pmd_t;
35typedef unsigned long pgd_t;
36typedef unsigned long pgprot_t;
37
38#define pte_val(x)      (x)
39#define pmd_val(x)      (x)
40#define pgd_val(x)      (x)
41#define pgprot_val(x)   (x)
42
43#define __pte(x)        (x)
44#define __pmd(x)        (x)
45#define __pgd(x)        (x)
46#define __pgprot(x)     (x)
47
48
49/* align addr on a size boundry - adjust address up if needed -- Cort */
50#define _ALIGN(addr,size)       (((addr)+size-1)&(~(size-1)))
51
52/* to align the pointer to the (next) page boundary */
53#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
54
55
56#define clear_page(page)        memset((void *)(page), 0, PAGE_SIZE)
57#define copy_page(to,from)      memcpy((void *)(to), (void *)(from), PAGE_SIZE)
58/* map phys->virtual and virtual->phys for RAM pages */
59
60#define __pa(x)                 ((unsigned long)(x)-PAGE_OFFSET)
61#define __va(x)                 ((void *)((unsigned long)(x)+PAGE_OFFSET))
62
63#define MAP_NR(addr)            (((unsigned long)addr-PAGE_OFFSET) >> PAGE_SHIFT)
64#define MAP_PAGE_RESERVED       (1<<15)
65
66extern unsigned long get_zero_page_fast(void);
67#endif /* ASM */
68#endif /* _LIBCPU_PAGE_H */
Note: See TracBrowser for help on using the repository browser.