2022-08-09 16:44:30 +02:00
|
|
|
/**
|
|
|
|
* PROJECT: ExectOS
|
|
|
|
* COPYRIGHT: See COPYING.md in the top level directory
|
2022-08-30 23:22:38 +02:00
|
|
|
* FILE: xtoskrnl/hl/i686/cpufunc.c
|
2022-08-09 16:44:30 +02:00
|
|
|
* DESCRIPTION: Routines to provide access to special i686 CPU instructions
|
|
|
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "xtkmapi.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads the data from the specified I/O port.
|
|
|
|
*
|
|
|
|
* @param Port
|
|
|
|
* Specifies the port number in the range of 0-0xFFFF.
|
|
|
|
*
|
|
|
|
* @return The value read from the port.
|
|
|
|
*
|
|
|
|
* @since XT 1.0
|
|
|
|
*/
|
|
|
|
XTAPI
|
2022-09-01 22:04:07 +02:00
|
|
|
UCHAR
|
2022-08-09 16:44:30 +02:00
|
|
|
HlIoPortInByte(IN USHORT Port)
|
|
|
|
{
|
|
|
|
UCHAR Value;
|
|
|
|
asm volatile("inb %1, %0"
|
|
|
|
: "=a"(Value)
|
|
|
|
: "Nd"(Port));
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes the data to the specified I/O port.
|
|
|
|
*
|
|
|
|
* @param Port
|
|
|
|
* Specifies the port number in the range of 0-0xFFFF.
|
|
|
|
*
|
|
|
|
* @param Value
|
|
|
|
* Supplies the value to write.
|
|
|
|
*
|
|
|
|
* @return This routine does not return any value.
|
|
|
|
*
|
|
|
|
* @since XT 1.0
|
|
|
|
*/
|
|
|
|
XTAPI
|
2022-09-01 22:04:07 +02:00
|
|
|
VOID
|
2022-08-09 16:44:30 +02:00
|
|
|
HlIoPortOutByte(IN USHORT Port,
|
|
|
|
IN UCHAR Value)
|
|
|
|
{
|
|
|
|
asm volatile("outb %0, %1"
|
|
|
|
:
|
|
|
|
:
|
|
|
|
"a"(Value),
|
|
|
|
"Nd"(Port));
|
|
|
|
}
|