parent
0ccb07f008
commit
46cb20e2c0
|
@ -16,6 +16,8 @@ SRC_CC += \
|
||||||
pd_upgrade_ram_quota.cc \
|
pd_upgrade_ram_quota.cc \
|
||||||
io_mem_session_component.cc \
|
io_mem_session_component.cc \
|
||||||
io_mem_session_support.cc \
|
io_mem_session_support.cc \
|
||||||
|
io_port_session_component.cc \
|
||||||
|
io_port_session_support.cc \
|
||||||
thread_start.cc \
|
thread_start.cc \
|
||||||
platform_thread.cc \
|
platform_thread.cc \
|
||||||
platform_pd.cc \
|
platform_pd.cc \
|
||||||
|
@ -55,7 +57,8 @@ vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
|
||||||
vpath region_map_component.cc $(GEN_CORE_DIR)
|
vpath region_map_component.cc $(GEN_CORE_DIR)
|
||||||
vpath io_mem_session_component.cc $(GEN_CORE_DIR)
|
vpath io_mem_session_component.cc $(GEN_CORE_DIR)
|
||||||
vpath io_mem_session_support.cc $(GEN_CORE_DIR)
|
vpath io_mem_session_support.cc $(GEN_CORE_DIR)
|
||||||
vpath platform_services.cc $(GEN_CORE_DIR)
|
vpath io_port_session_component.cc $(GEN_CORE_DIR)/spec/x86
|
||||||
|
vpath platform_services.cc $(GEN_CORE_DIR)/spec/x86
|
||||||
vpath signal_source_component.cc $(GEN_CORE_DIR)
|
vpath signal_source_component.cc $(GEN_CORE_DIR)
|
||||||
vpath trace_session_component.cc $(GEN_CORE_DIR)
|
vpath trace_session_component.cc $(GEN_CORE_DIR)
|
||||||
vpath dataspace_component.cc $(GEN_CORE_DIR)
|
vpath dataspace_component.cc $(GEN_CORE_DIR)
|
||||||
|
|
103
repos/base-sel4/src/core/io_port_session_support.cc
Normal file
103
repos/base-sel4/src/core/io_port_session_support.cc
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* \brief Core implementation of the IO_PORT session interface
|
||||||
|
* \author Alexander Boettcher
|
||||||
|
* \date 2016-07-17
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
|
#include <base/log.h>
|
||||||
|
|
||||||
|
/* core includes */
|
||||||
|
#include <io_port_session_component.h>
|
||||||
|
|
||||||
|
#include <sel4/sel4.h>
|
||||||
|
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
|
/**************
|
||||||
|
** Port API **
|
||||||
|
**************/
|
||||||
|
unsigned char Io_port_session_component::inb(unsigned short address)
|
||||||
|
{
|
||||||
|
/* check boundaries */
|
||||||
|
if (!_in_bounds(address, sizeof(unsigned char))) return 0;
|
||||||
|
|
||||||
|
seL4_X86_IOPort_In8_t v = seL4_X86_IOPort_In8(seL4_CapIOPort, address);
|
||||||
|
if (v.error == seL4_NoError)
|
||||||
|
return v.result;
|
||||||
|
|
||||||
|
Genode::error(__PRETTY_FUNCTION__, " failed ", v.error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned short Io_port_session_component::inw(unsigned short address)
|
||||||
|
{
|
||||||
|
/* check boundaries */
|
||||||
|
if (!_in_bounds(address, sizeof(unsigned short))) return 0;
|
||||||
|
|
||||||
|
seL4_X86_IOPort_In16_t v = seL4_X86_IOPort_In16(seL4_CapIOPort, address);
|
||||||
|
if (v.error == seL4_NoError)
|
||||||
|
return v.result;
|
||||||
|
|
||||||
|
Genode::error(__PRETTY_FUNCTION__, " failed ", v.error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned Io_port_session_component::inl(unsigned short address)
|
||||||
|
{
|
||||||
|
/* check boundaries */
|
||||||
|
if (!_in_bounds(address, sizeof(unsigned))) return 0;
|
||||||
|
|
||||||
|
seL4_X86_IOPort_In32_t v = seL4_X86_IOPort_In32(seL4_CapIOPort, address);
|
||||||
|
if (v.error == seL4_NoError)
|
||||||
|
return v.result;
|
||||||
|
|
||||||
|
Genode::error(__PRETTY_FUNCTION__, " failed ", v.error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Io_port_session_component::outb(unsigned short address, unsigned char value)
|
||||||
|
{
|
||||||
|
/* check boundaries */
|
||||||
|
if (!_in_bounds(address, sizeof(unsigned char))) return;
|
||||||
|
|
||||||
|
int error = seL4_X86_IOPort_Out8(seL4_CapIOPort, address, value);
|
||||||
|
|
||||||
|
if (error != seL4_NoError)
|
||||||
|
Genode::error(__PRETTY_FUNCTION__, " failed ", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Io_port_session_component::outw(unsigned short address, unsigned short value)
|
||||||
|
{
|
||||||
|
/* check boundaries */
|
||||||
|
if (!_in_bounds(address, sizeof(unsigned short))) return;
|
||||||
|
|
||||||
|
int error = seL4_X86_IOPort_Out16(seL4_CapIOPort, address, value);
|
||||||
|
|
||||||
|
if (error != seL4_NoError)
|
||||||
|
Genode::error(__PRETTY_FUNCTION__, " failed ", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Io_port_session_component::outl(unsigned short address, unsigned value)
|
||||||
|
{
|
||||||
|
/* check boundaries */
|
||||||
|
if (!_in_bounds(address, sizeof(unsigned))) return;
|
||||||
|
|
||||||
|
int error = seL4_X86_IOPort_Out32(seL4_CapIOPort, address, value);
|
||||||
|
|
||||||
|
if (error != seL4_NoError)
|
||||||
|
Genode::error(__PRETTY_FUNCTION__, " failed ", error);
|
||||||
|
}
|
|
@ -384,6 +384,9 @@ Platform::Platform()
|
||||||
Core_cspace::CORE_VM_ID,
|
Core_cspace::CORE_VM_ID,
|
||||||
_core_page_table_registry)
|
_core_page_table_registry)
|
||||||
{
|
{
|
||||||
|
/* I/O port allocator (only meaningful for x86) */
|
||||||
|
_io_port_alloc.add_range(0, 0x10000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Log statistics about allocator initialization
|
* Log statistics about allocator initialization
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user