1.1 --- a/test_files/Control Sun Jun 12 18:56:25 2022 +0200
1.2 +++ b/test_files/Control Sun Jun 12 23:08:19 2022 +0200
1.3 @@ -1,3 +1,3 @@
1.4 provides: fstest_files
1.5 -requires: libc
1.6 +requires: libc libstdc++ libexec libipc
1.7 maintainer: paul@boddie.org.uk
2.1 --- a/test_files/programs/Makefile Sun Jun 12 18:56:25 2022 +0200
2.2 +++ b/test_files/programs/Makefile Sun Jun 12 23:08:19 2022 +0200
2.3 @@ -1,12 +1,47 @@
2.4 PKGDIR ?= ..
2.5 L4DIR ?= $(PKGDIR)/../../..
2.6
2.7 -TARGET = dstest_exec_payload
2.8 +TARGET = dstest_exec_payload dstest_region_mapper
2.9
2.10 MODE = static
2.11
2.12 -SRC_C_dstest_exec_payload = exec_payload.c
2.13 +# Locations for interface input and generated output.
2.14 +
2.15 +IDL_DIR = $(PKGDIR)/../libsystypes/idl
2.16 +IDL_MK_DIR = $(L4DIR)/idl4re/mk
2.17 +IDL_BUILD_DIR = .
2.18 +IDL_EXPORT_DIR = .
2.19 +
2.20 +include $(IDL_MK_DIR)/idl.mk
2.21 +
2.22 +# Compound interfaces.
2.23 +
2.24 +pager_object_NAME = PagerObject
2.25 +pager_object_INTERFACES = region_mapper system_pager
2.26 +
2.27 +COMP_INTERFACES_CC = pager_object
2.28 +
2.29 +# Individual interfaces.
2.30
2.31 -REQUIRES_LIBS = libc
2.32 +SERVER_INTERFACES_CC = $(call common_interfaces,$(COMP_INTERFACES_CC))
2.33 +
2.34 +# Generated and plain source files.
2.35 +
2.36 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC) $(COMP_INTERFACES_CC))
2.37 +
2.38 +# Normal source files.
2.39 +
2.40 +SRC_C_dstest_exec_payload = exec_payload.c
2.41 +
2.42 +PLAIN_SRC_CC_dstest_region_mapper = region_mapper.cc
2.43 +SRC_CC_dstest_region_mapper = \
2.44 + $(PLAIN_SRC_CC_dstest_region_mapper) \
2.45 + $(SERVER_INTERFACES_SRC_CC)
2.46 +
2.47 +REQUIRES_LIBS = libc libstdc++ libexec libipc
2.48 +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR)
2.49
2.50 include $(L4DIR)/mk/prog.mk
2.51 +include $(IDL_MK_DIR)/interface_rules.mk
2.52 +
2.53 +$(PLAIN_SRC_CC_dstest_region_mapper): $(SERVER_INTERFACES_SRC_CC)
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test_files/programs/region_mapper.cc Sun Jun 12 23:08:19 2022 +0200
3.3 @@ -0,0 +1,69 @@
3.4 +/*
3.5 + * A region mapper for deployment in a new task.
3.6 + *
3.7 + * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk>
3.8 + *
3.9 + * This program is free software; you can redistribute it and/or
3.10 + * modify it under the terms of the GNU General Public License as
3.11 + * published by the Free Software Foundation; either version 2 of
3.12 + * the License, or (at your option) any later version.
3.13 + *
3.14 + * This program is distributed in the hope that it will be useful,
3.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.17 + * GNU General Public License for more details.
3.18 + *
3.19 + * You should have received a copy of the GNU General Public License
3.20 + * along with this program; if not, write to the Free Software
3.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
3.22 + * Boston, MA 02110-1301, USA
3.23 + */
3.24 +
3.25 +#include <l4/re/env.h>
3.26 +
3.27 +#include <exec/common.h>
3.28 +#include <exec/internal_pager.h>
3.29 +#include <exec/stack.h>
3.30 +#include <ipc/server.h>
3.31 +
3.32 +#include "pager_object_server.h"
3.33 +
3.34 +
3.35 +
3.36 +static InternalPager exec_pager;
3.37 +
3.38 +
3.39 +
3.40 +int main(int argc, char *argv[])
3.41 +{
3.42 + /* Initialise pager regions from region descriptions obtained via the
3.43 + auxiliary data. */
3.44 +
3.45 + l4re_aux_t *l4re_aux = exec_get_l4re_aux(argc, argv);
3.46 +
3.47 + /* Skip past the auxiliary structure itself. */
3.48 +
3.49 + struct exec_region *region = (struct exec_region *) (l4re_aux + 1);
3.50 +
3.51 + if (!region)
3.52 + {
3.53 + printf("Could not find regions.\n");
3.54 + return 1;
3.55 + }
3.56 +
3.57 + for (; region && (region->ds != L4_INVALID_CAP); region++)
3.58 + {
3.59 + printf("Adding region: %lx\n", region->start);
3.60 + exec_pager.add(*region);
3.61 + }
3.62 +
3.63 + /* Start the pager. */
3.64 +
3.65 + printf("Starting pager...\n");
3.66 + ipc_server_loop_for(PagerObject, &exec_pager, "server");
3.67 +
3.68 + return 0;
3.69 +}
3.70 +
3.71 +/* vim: tabstop=2 expandtab shiftwidth=2
3.72 +*/