VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxFsDxe/fsw_efi_base.h

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: fsw_efi_base.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * fsw_efi_base.h - Base definitions for the EFI host environment.
4 */
5
6/*
7 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 * ---------------------------------------------------------------------------
36 * This code is based on:
37 *
38 * Copyright (c) 2006 Christoph Pfisterer
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions are
42 * met:
43 *
44 * * Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 *
47 * * Redistributions in binary form must reproduce the above copyright
48 * notice, this list of conditions and the following disclaimer in the
49 * documentation and/or other materials provided with the
50 * distribution.
51 *
52 * * Neither the name of Christoph Pfisterer nor the names of the
53 * contributors may be used to endorse or promote products derived
54 * from this software without specific prior written permission.
55 *
56 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
57 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
59 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
60 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
61 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
62 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
64 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
66 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67 */
68
69#ifndef _FSW_EFI_BASE_H_
70#define _FSW_EFI_BASE_H_
71
72#ifndef VBOX
73#include <efi.h>
74#include <efilib.h>
75#define PROTO_NAME(x) x
76#endif
77
78#define FSW_LITTLE_ENDIAN (1)
79
80
81// types, reuse EFI types
82
83typedef INT8 fsw_s8;
84typedef UINT8 fsw_u8;
85typedef INT16 fsw_s16;
86typedef UINT16 fsw_u16;
87typedef INT32 fsw_s32;
88typedef UINT32 fsw_u32;
89typedef INT64 fsw_s64;
90typedef UINT64 fsw_u64;
91
92
93// allocation functions
94
95#define fsw_alloc(size, ptrptr) (((*(ptrptr) = AllocatePool(size)) == NULL) ? FSW_OUT_OF_MEMORY : FSW_SUCCESS)
96#define fsw_free(ptr) FreePool(ptr)
97
98// memory functions
99
100#define fsw_memzero(dest,size) ZeroMem(dest,size)
101#define fsw_memcpy(dest,src,size) CopyMem(dest,src,size)
102#define fsw_memeq(p1,p2,size) (CompareMem(p1,p2,size) == 0)
103
104// message printing
105
106#define FSW_MSGSTR(s) DEBUG_INFO, s
107#define FSW_MSGFUNC DebugPrint
108
109// 64-bit hooks
110
111#define FSW_U64_SHR(val,shiftbits) RShiftU64((val), (shiftbits))
112#define FSW_U64_DIV(val,divisor) DivU64x32((val), (divisor), NULL)
113
114
115#endif
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use