1.1 --- a/Makefile Wed Jan 20 01:37:12 2021 +0100
1.2 +++ b/Makefile Thu Jan 21 00:05:50 2021 +0100
1.3 @@ -22,7 +22,7 @@
1.4 SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC))
1.5
1.6 PLAIN_SRC_CC = \
1.7 - dstest_server.cc flexpage.cc \
1.8 + dstest_server.cc flexpage.cc ipc.cc \
1.9 memory.cc memory_map.cc memory_utils.cc \
1.10 region.cc resource.cc simple_pager.cc
1.11
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/ipc.cc Thu Jan 21 00:05:50 2021 +0100
2.3 @@ -0,0 +1,22 @@
2.4 +#include <l4/re/c/dataspace.h>
2.5 +
2.6 +#include "ipc.h"
2.7 +#include "send_flexpage.h"
2.8 +
2.9 +
2.10 +
2.11 +/* Make a representation of the flexpage for the IPC system. */
2.12 +
2.13 +void ipc_prepare_flexpage(Flexpage *flexpage, unsigned long offset,
2.14 + l4_addr_t hot_spot, unsigned long flags,
2.15 + l4_snd_fpage_t *region)
2.16 +{
2.17 + SendFlexpage send_flexpage = flexpage->to_send(offset, hot_spot);
2.18 +
2.19 + region->fpage = l4_fpage(send_flexpage.base_addr, send_flexpage.order,
2.20 + (flags & L4RE_DS_MAP_FLAG_RW) ? L4_FPAGE_RW
2.21 + : L4_FPAGE_RO);
2.22 + region->snd_base = hot_spot;
2.23 +}
2.24 +
2.25 +// vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/ipc.h Thu Jan 21 00:05:50 2021 +0100
3.3 @@ -0,0 +1,13 @@
3.4 +#pragma once
3.5 +
3.6 +#include <l4/sys/ipc.h>
3.7 +
3.8 +#include "flexpage.h"
3.9 +
3.10 +
3.11 +
3.12 +void ipc_prepare_flexpage(Flexpage *flexpage, unsigned long offset,
3.13 + l4_addr_t hot_spot, unsigned long flags,
3.14 + l4_snd_fpage_t *region);
3.15 +
3.16 +// vim: tabstop=4 expandtab shiftwidth=4
4.1 --- a/simple_pager.cc Wed Jan 20 01:37:12 2021 +0100
4.2 +++ b/simple_pager.cc Thu Jan 21 00:05:50 2021 +0100
4.3 @@ -1,6 +1,7 @@
4.4 #include <l4/re/c/dataspace.h>
4.5
4.6 #include "dataspace_server.h"
4.7 +#include "ipc.h"
4.8 #include "simple_pager.h"
4.9
4.10
4.11 @@ -33,16 +34,9 @@
4.12
4.13 flexpage.reset(offset);
4.14
4.15 - /* Issue the flexpage via the IPC system. */
4.16 -
4.17 - SendFlexpage send_flexpage = flexpage.to_send(offset, hot_spot);
4.18 -
4.19 /* Send the flexpage explicitly. */
4.20
4.21 - region->fpage = l4_fpage(send_flexpage.base_addr, send_flexpage.order,
4.22 - (flags & L4RE_DS_MAP_FLAG_RW) ? L4_FPAGE_RW
4.23 - : L4_FPAGE_RO);
4.24 - region->snd_base = hot_spot;
4.25 + ipc_prepare_flexpage(&flexpage, offset, hot_spot, flags, region);
4.26
4.27 long err = complete_Dataspace_map(*region);
4.28