VirtualBox

source: vbox/trunk/include/iprt/param.h@ 29273

Last change on this file since 29273 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/** @file
2 * IPRT - Parameter Definitions.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Oracle Corporation
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 (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_param_h
27#define ___iprt_param_h
28
29/** @todo Much of the PAGE_* stuff here is obsolete and highly risky to have around.
30 * As for component configs (MM_*), either we gather all in here or we move those bits away! */
31
32/** @defgroup grp_rt_param System Parameter Definitions
33 * @ingroup grp_rt_cdefs
34 * @{
35 */
36
37/* Undefine PAGE_SIZE and PAGE_SHIFT to avoid unnecessary noice when clashing
38 * with system headers. Include system headers before / after iprt depending
39 * on which you wish to take precedence. */
40#undef PAGE_SIZE
41#undef PAGE_SHIFT
42
43/* Undefine PAGE_OFFSET_MASK to avoid the conflict with the-linux-kernel.h */
44#undef PAGE_OFFSET_MASK
45
46/**
47 * i386 Page size.
48 */
49#define PAGE_SIZE 4096
50
51/**
52 * i386 Page shift.
53 * This is used to convert between size (in bytes) and page count.
54 */
55#define PAGE_SHIFT 12
56
57/**
58 * i386 Page offset mask.
59 *
60 * Do NOT one-complement this for whatever purpose. You may get a 32-bit const when you want a 64-bit one.
61 * Use PAGE_BASE_MASK, PAGE_BASE_GC_MASK, PAGE_BASE_HC_MASK, PAGE_ADDRESS() or X86_PTE_PAE_PG_MASK.
62 */
63#define PAGE_OFFSET_MASK 0xfff
64
65/**
66 * Page address mask for the guest context POINTERS.
67 * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
68 */
69#define PAGE_BASE_GC_MASK (~(RTGCUINTPTR)0xfff)
70
71/**
72 * Page address mask for the host context POINTERS.
73 * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
74 */
75#define PAGE_BASE_HC_MASK (~(RTHCUINTPTR)0xfff)
76
77/**
78 * Page address mask for the both context POINTERS.
79 *
80 * Be careful when using this since it may be a size too big!
81 * @remark Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
82 */
83#define PAGE_BASE_MASK (~(RTUINTPTR)0xfff)
84
85/**
86 * Get the page aligned address of a POINTER in the CURRENT context.
87 *
88 * @returns Page aligned address (it's an uintptr_t).
89 * @param pv The virtual address to align.
90 *
91 * @remarks Physical addresses are always masked using X86_PTE_PAE_PG_MASK!
92 * @remarks This only works with POINTERS in the current context.
93 * Do NOT use on guest address or physical address!
94 */
95#define PAGE_ADDRESS(pv) ((uintptr_t)(pv) & ~(uintptr_t)0xfff)
96
97/**
98 * Get the page aligned address of a physical address
99 *
100 * @returns Page aligned address (it's an RTHCPHYS or RTGCPHYS).
101 * @param Phys The physical address to align.
102 */
103#define PHYS_PAGE_ADDRESS(Phys) ((Phys) & X86_PTE_PAE_PG_MASK)
104
105/**
106 * Host max path (the reasonable value).
107 */
108#define RTPATH_MAX (4096 + 4) /* (PATH_MAX + 1) on linux w/ some alignment */
109
110/** @} */
111
112
113/** @} */
114
115#endif
116
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette