1 | /** @file
|
---|
2 | * innotek Portable Runtime - Parameter Definitions.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License as published by the Free Software Foundation,
|
---|
12 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
13 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
14 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * If you received this file as part of a commercial VirtualBox
|
---|
17 | * distribution, then only the terms of your commercial VirtualBox
|
---|
18 | * license agreement apply instead of the previous paragraph.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef ___iprt_param_h
|
---|
22 | #define ___iprt_param_h
|
---|
23 |
|
---|
24 | /** @todo Much of the PAGE_* stuff here is obsolete and highly risky to have around.
|
---|
25 | * As for component configs (MM_*), either we gather all in here or we move those bits away! */
|
---|
26 |
|
---|
27 | /** @defgroup grp_rt_param System Parameter Definitions
|
---|
28 | * @ingroup grp_rt_cdefs
|
---|
29 | * @{
|
---|
30 | */
|
---|
31 |
|
---|
32 | /* Undefine PAGE_SIZE and PAGE_SHIFT to avoid unnecessary noice when clashing
|
---|
33 | with system headers. Include system headers before / after iprt depending
|
---|
34 | on which you wish to take precedence. */
|
---|
35 | #undef PAGE_SIZE
|
---|
36 | #undef PAGE_SHIFT
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * i386 Page size.
|
---|
40 | */
|
---|
41 | #define PAGE_SIZE 4096
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * i386 Page shift.
|
---|
45 | * This is used to convert between size (in bytes) and page count.
|
---|
46 | */
|
---|
47 | #define PAGE_SHIFT 12
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * i386 Page offset mask.
|
---|
51 | *
|
---|
52 | * Do NOT one-complement this for whatever purpose. You may get a 32-bit const when you want a 64-bit one.
|
---|
53 | * Use PAGE_BASE_MASK, PAGE_BASE_GC_MASK, PAGE_BASE_HC_MASK, PAGE_ADDRESS() or X86_PTE_PAE_PG_MASK.
|
---|
54 | */
|
---|
55 | #define PAGE_OFFSET_MASK 0xfff
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Page address mask for the guest context POINTERS.
|
---|
59 | * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
|
---|
60 | */
|
---|
61 | #define PAGE_BASE_GC_MASK (~(RTGCUINTPTR)0xfff)
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Page address mask for the host context POINTERS.
|
---|
65 | * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
|
---|
66 | */
|
---|
67 | #define PAGE_BASE_HC_MASK (~(RTHCUINTPTR)0xfff)
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Page address mask for the both context POINTERS.
|
---|
71 | *
|
---|
72 | * Be careful when using this since it may be a size too big!
|
---|
73 | * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
|
---|
74 | */
|
---|
75 | #define PAGE_BASE_MASK (~(RTUINTPTR)0xfff)
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Get the page aligned address of a POINTER in the CURRENT context.
|
---|
79 | *
|
---|
80 | * @returns Page aligned address (it's an uintptr_t).
|
---|
81 | * @param pv The address to align.
|
---|
82 | *
|
---|
83 | * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
|
---|
84 | */
|
---|
85 | #define PAGE_ADDRESS(pv) ((uintptr_t)(pv) & ~(uintptr_t)0xfff)
|
---|
86 |
|
---|
87 | #if 1 /** @todo remove this! Use X86_PAGE_* defines. */
|
---|
88 | /**
|
---|
89 | * i386 Page directory shift.
|
---|
90 | * This is used to convert between PDR index and virtual address.
|
---|
91 | * @deprecated Use X86_*.
|
---|
92 | */
|
---|
93 | #define PGDIR_SHIFT 22
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * i386 Page table mask.
|
---|
97 | * This is used together with PAGE_SHIFT to get the page table
|
---|
98 | * index from a virtual address.
|
---|
99 | * @deprecated Use X86_*.
|
---|
100 | */
|
---|
101 | #define PTE_MASK 0x3ff
|
---|
102 |
|
---|
103 | /**
|
---|
104 | * i386 Page table and page directory entry count for the default
|
---|
105 | * paging mode.
|
---|
106 | * @deprecated Use X86_*.
|
---|
107 | */
|
---|
108 | #define PAGE_ENTRIES 1024
|
---|
109 |
|
---|
110 | /**
|
---|
111 | * i386 4MB Page offset mask.
|
---|
112 | * @deprecated Use X86_*.
|
---|
113 | */
|
---|
114 | #define PAGE_OFFSET_MASK_BIG 0x3fffff
|
---|
115 | #endif /* obsolete */
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Host max path (the reasonable value).
|
---|
119 | */
|
---|
120 | #define RTPATH_MAX (4096 + 4) /* (PATH_MAX + 1) on linux w/ some alignment */
|
---|
121 |
|
---|
122 | /** @} */
|
---|
123 |
|
---|
124 |
|
---|
125 | /** @} */
|
---|
126 |
|
---|
127 | #endif
|
---|
128 |
|
---|