iospace_default_handler.hpp
00001 #if !defined(__IOSPACE_DEFAULT_HANDLER_HPP__)
00002 #define __IOSPACE_DEFAULT_HANDLER_HPP__
00003
00004
00005
00006
00007 #include "core/machine/resources/resources.hpp"
00008 #include "core/machine/machine_config.hpp"
00009 #include "iospace_handler.hpp"
00010
00016 struct iospace_default_handler : public iospace_handler
00017 {
00021 const machine_config &config;
00022
00023
00024
00025
00026 inline iospace_default_handler(const machine_config &config)
00027 : config(config)
00028 {}
00029
00030
00031
00032
00033
00034
00035 virtual inline uint32_t read_ioport(l4_port_t port, access_size access_size)
00036 {
00037 if ((port != 0x80) && config.is(L4VMM_UNUSED_PORT_WARNING)) {
00038 const resource_descriptor *descriptor=resource_descriptor::get(port);
00039 log::warn("reading %s from unused port "l4_port_fmt" (%s)\n",
00040 access_size.string(), port, descriptor ? descriptor->name : "?");
00041 }
00042
00043 return INVALID;
00044 }
00045
00046 virtual inline int write_ioport(l4_port_t port, uint32_t data, access_size access_size)
00047 {
00048 if ((port != 0x80) && config.is(L4VMM_UNUSED_PORT_WARNING)) {
00049 const resource_descriptor *descriptor=resource_descriptor::get(port);
00050 log::warn("writing %s %s to unused port "l4_port_fmt" (%s)\n",
00051 access_size.string(), format_hex<uint32_t>(data, access_size*2).c_str(),
00052 port, descriptor ? descriptor->name : "?");
00053 }
00054
00055 return -L4_ENOTSUPP;
00056 }
00057 };
00058
00059 #endif
00060
00061
00062