1 | /* $Id: allocex.h 46739 2013-06-23 16:10:25Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Memory Allocation, Extended Alloc and Free Functions for Ring-3.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 |
|
---|
28 | #ifndef ___r3_allocex_h
|
---|
29 | #define ___r3_allocex_h
|
---|
30 |
|
---|
31 | #include <iprt/types.h>
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Heading for extended memory allocations in ring-3.
|
---|
35 | */
|
---|
36 | typedef struct RTMEMHDRR3
|
---|
37 | {
|
---|
38 | /** Magic (RTMEMHDR_MAGIC). */
|
---|
39 | uint32_t u32Magic;
|
---|
40 | /** Block flags (RTMEMALLOCEX_FLAGS_*). */
|
---|
41 | uint32_t fFlags;
|
---|
42 | /** The actual size of the block, header not included. */
|
---|
43 | uint32_t cb;
|
---|
44 | /** The requested allocation size. */
|
---|
45 | uint32_t cbReq;
|
---|
46 | } RTMEMHDRR3;
|
---|
47 | /** Pointer to a ring-3 extended memory header. */
|
---|
48 | typedef RTMEMHDRR3 *PRTMEMHDRR3;
|
---|
49 |
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Allocate memory in below 64KB.
|
---|
53 | *
|
---|
54 | * @returns IPRT status code.
|
---|
55 | * @param cbAlloc Number of bytes to allocate (including the
|
---|
56 | * header if the caller needs one).
|
---|
57 | * @param fFlags Allocation flags.
|
---|
58 | * @param ppv Where to return the pointer to the memory.
|
---|
59 | */
|
---|
60 | DECLHIDDEN(int) rtMemAllocEx16BitReach(size_t cbAlloc, uint32_t fFlags, void **ppv);
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Allocate memory in below 4GB.
|
---|
64 | *
|
---|
65 | * @returns IPRT status code.
|
---|
66 | * @param cbAlloc Number of bytes to allocate (including the
|
---|
67 | * header if the caller needs one).
|
---|
68 | * @param fFlags Allocation flags.
|
---|
69 | * @param ppv Where to return the pointer to the memory.
|
---|
70 | */
|
---|
71 | DECLHIDDEN(int) rtMemAllocEx32BitReach(size_t cbAlloc, uint32_t fFlags, void **ppv);
|
---|
72 |
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Frees memory allocated by rtMemAllocEx16BitReach and rtMemAllocEx32BitReach.
|
---|
76 | *
|
---|
77 | * @param pv Start of allocation.
|
---|
78 | * @param cb Allocation size.
|
---|
79 | * @param fFlags Allocation flags.
|
---|
80 | */
|
---|
81 | DECLHIDDEN(void) rtMemFreeExYyBitReach(void *pv, size_t cb, uint32_t fFlags);
|
---|
82 |
|
---|
83 | #endif
|
---|
84 |
|
---|