00001
00002
00003 #ifndef map_util_h
00004 #define map_util_h
00005
00006 #include "l4_types.h"
00007 #include "mapdb.h"
00008 #include "std_macros.h"
00009
00010
00011
00012
00013
00014
00015 class Space;
00016
00017 Ipc_err
00018 io_map (Space *from, Address fp_from_iopage, Mword fp_from_size,
00019 bool fp_from_grant, bool fp_from_is_whole_space,
00020 Space *to, Address fp_to_iopage, Mword fp_to_size,
00021 bool fp_to_is_iopage, bool fp_to_is_whole_space);
00022
00023 void
00024 io_fpage_unmap(Space *space, L4_fpage fp, bool me_too);
00025
00026
00027
00028 inline void handle_sigma0_adapter_address(Address &phys, unsigned &page_flags);
00029
00033 Mapdb * mapdb_instance();
00034
00035 inline void update_lipc_kip(Space *, Address, Mword, Space *, Address, Mword, Address);
00036
00055 Ipc_err mem_map(Space *from, Address fp_from_page, Mword fp_from_size, bool fp_from_write, bool fp_from_grant, Space *to, Address fp_to_page, Mword fp_to_size, Address offs, bool flush = false);
00056
00069 void mem_fpage_unmap(Space *space, L4_fpage fp, bool me_too, bool only_read_only);
00070
00083 inline void fpage_unmap(Space *space, L4_fpage fp, bool me_too, bool only_read_only);
00084
00098 inline Ipc_err fpage_map(Space *from, L4_fpage fp_from, Space *to, L4_fpage fp_to, Address offs, bool grant);
00099
00100
00101
00102
00103
00104
00105 #include "config.h"
00106
00107
00108
00109
00110
00111
00112
00113
00127 inline void
00128 fpage_unmap(Space *space, L4_fpage fp, bool me_too, bool only_read_only)
00129 {
00130 if(Config::enable_io_protection && (fp.is_iopage() || fp.is_whole_space()))
00131 io_fpage_unmap(space, fp, me_too);
00132
00133 if(!Config::enable_io_protection || !fp.is_iopage())
00134 mem_fpage_unmap (space, fp, me_too, only_read_only);
00135 }
00136
00137
00152 inline Ipc_err
00153 fpage_map(Space *from, L4_fpage fp_from, Space *to,
00154 L4_fpage fp_to, Address offs, bool grant)
00155 {
00156 Ipc_err result(0);
00157
00158 if (Config::enable_io_protection &&
00159 (fp_from.is_iopage() || fp_from.is_whole_space()))
00160 {
00161 result.combine(io_map(from,
00162 fp_from.iopage(),
00163 fp_from.size(),
00164 grant,
00165 fp_from.is_whole_space(),
00166 to,
00167 fp_to.iopage(),
00168 fp_to.size(),
00169 fp_to.is_iopage(),
00170 fp_to.is_whole_space()));
00171 }
00172
00173 if (!fp_from.is_iopage())
00174 {
00175 result.combine (mem_map (from,
00176 fp_from.page(),
00177 fp_from.size(),
00178 fp_from.write(),
00179 grant, to,
00180 fp_to.page(),
00181 fp_to.size(), offs));
00182 }
00183
00184 return result;
00185 }
00186
00187 #endif // map_util_h