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 to avoid unnecessary noice when clashing with
|
---|
33 | system headers. Include system headers before / after iprt depending
|
---|
34 | on which you wish to take precedence. */
|
---|
35 | #undef PAGE_SIZE
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * i386 Page size.
|
---|
39 | */
|
---|
40 | #define PAGE_SIZE 4096
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * i386 Page shift.
|
---|
44 | * This is used to convert between size (in bytes) and page count.
|
---|
45 | */
|
---|
46 | #define PAGE_SHIFT 12
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * i386 Page offset mask.
|
---|
50 | *
|
---|
51 | * Do NOT one-complement this for whatever purpose. You may get a 32-bit const when you want a 64-bit one.
|
---|
52 | * Use PAGE_BASE_MASK, PAGE_BASE_GC_MASK, PAGE_BASE_HC_MASK, PAGE_ADDRESS() or X86_PTE_PAE_PG_MASK.
|
---|
53 | */
|
---|
54 | #define PAGE_OFFSET_MASK 0xfff
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Page address mask for the guest context POINTERS.
|
---|
58 | * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
|
---|
59 | */
|
---|
60 | #define PAGE_BASE_GC_MASK (~(RTGCUINTPTR)0xfff)
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Page address mask for the host context POINTERS.
|
---|
64 | * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
|
---|
65 | */
|
---|
66 | #define PAGE_BASE_HC_MASK (~(RTHCUINTPTR)0xfff)
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Page address mask for the both context POINTERS.
|
---|
70 | *
|
---|
71 | * Be careful when using this since it may be a size too big!
|
---|
72 | * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
|
---|
73 | */
|
---|
74 | #define PAGE_BASE_MASK (~(RTUINTPTR)0xfff)
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Get the page aligned address of a POINTER in the CURRENT context.
|
---|
78 | *
|
---|
79 | * @returns Page aligned address (it's an uintptr_t).
|
---|
80 | * @param pv The address to align.
|
---|
81 | *
|
---|
82 | * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
|
---|
83 | */
|
---|
84 | #define PAGE_ADDRESS(pv) ((uintptr_t)(pv) & ~(uintptr_t)0xfff)
|
---|
85 |
|
---|
86 | #if 1 /** @todo remove this! Use X86_PAGE_* defines. */
|
---|
87 | /**
|
---|
88 | * i386 Page directory shift.
|
---|
89 | * This is used to convert between PDR index and virtual address.
|
---|
90 | * @deprecated Use X86_*.
|
---|
91 | */
|
---|
92 | #define PGDIR_SHIFT 22
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * i386 Page table mask.
|
---|
96 | * This is used together with PAGE_SHIFT to get the page table
|
---|
97 | * index from a virtual address.
|
---|
98 | * @deprecated Use X86_*.
|
---|
99 | */
|
---|
100 | #define PTE_MASK 0x3ff
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * i386 Page table and page directory entry count for the default
|
---|
104 | * paging mode.
|
---|
105 | * @deprecated Use X86_*.
|
---|
106 | */
|
---|
107 | #define PAGE_ENTRIES 1024
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * i386 4MB Page offset mask.
|
---|
111 | * @deprecated Use X86_*.
|
---|
112 | */
|
---|
113 | #define PAGE_OFFSET_MASK_BIG 0x3fffff
|
---|
114 | #endif /* obsolete */
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * Host max path (the reasonable value).
|
---|
118 | */
|
---|
119 | #define RTPATH_MAX (4096 + 4) /* (PATH_MAX + 1) on linux w/ some alignment */
|
---|
120 |
|
---|
121 | /** @} */
|
---|
122 |
|
---|
123 |
|
---|
124 | /** @} */
|
---|
125 |
|
---|
126 | #endif
|
---|
127 |
|
---|