VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c@ 79205

Last change on this file since 79205 was 77662, checked in by vboxsync, 6 years ago

EFI: First step in UDK2018 merge. Does not build yet.

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1/** @file
2 Unaligned Port I/O. This file has compiler specifics for GCC as there is no
3 ANSI C standard for doing IO.
4
5 Based on IoLibGcc.c.
6
7 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available
9 under the terms and conditions of the BSD License which accompanies this
10 distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16**/
17
18
19#include "UnalignedIoInternal.h"
20
21/**
22 Performs a 32-bit write to the specified, possibly unaligned I/O-type
23 address.
24
25 Writes the 32-bit I/O port specified by Port with the value specified by
26 Value and returns Value. This function must guarantee that all I/O read and
27 write operations are serialized.
28
29 If 32-bit unaligned I/O port operations are not supported, then ASSERT().
30
31 @param[in] Port I/O port address
32 @param[in] Value 32-bit word to write
33
34 @return The value written to the I/O port.
35
36**/
37UINT32
38UnalignedIoWrite32 (
39 IN UINTN Port,
40 IN UINT32 Value
41 )
42{
43 __asm__ __volatile__ ( "outl %0, %1" : : "a" (Value), "d" ((UINT16)Port) );
44 return Value;
45}
46
47/**
48 Reads a 32-bit word from the specified, possibly unaligned I/O-type address.
49
50 Reads the 32-bit I/O port specified by Port. The 32-bit read value is
51 returned. This function must guarantee that all I/O read and write operations
52 are serialized.
53
54 If 32-bit unaligned I/O port operations are not supported, then ASSERT().
55
56 @param[in] Port The I/O port to read.
57
58 @return The value read.
59
60**/
61UINT32
62UnalignedIoRead32 (
63 IN UINTN Port
64 )
65{
66 UINT32 Data;
67 __asm__ __volatile__ ( "inl %1, %0" : "=a" (Data) : "d" ((UINT16)Port) );
68 return Data;
69}
70
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