1 /* 2 * A region mapper for deployment in a new task. 3 * 4 * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #include <l4/re/env.h> 23 24 #include <exec/common.h> 25 #include <exec/internal_pager.h> 26 #include <exec/stack.h> 27 #include <ipc/server.h> 28 29 #include "pager_object_server.h" 30 31 32 33 static InternalPager exec_pager; 34 35 36 37 int main(int argc, char *argv[]) 38 { 39 /* Initialise pager regions from region descriptions obtained via the 40 auxiliary data. */ 41 42 l4re_aux_t *l4re_aux = exec_get_l4re_aux(argc, argv); 43 44 /* Skip past the auxiliary structure itself. */ 45 46 struct exec_region *region = (struct exec_region *) (l4re_aux + 1); 47 48 if (!region) 49 { 50 printf("Could not find regions.\n"); 51 return 1; 52 } 53 54 for (; region && (region->ds != L4_INVALID_CAP); region++) 55 { 56 printf("Adding region: %lx\n", region->start); 57 exec_pager.add(*region); 58 } 59 60 /* Start the pager. */ 61 62 printf("Starting pager...\n"); 63 ipc_server_loop_for(PagerObject, &exec_pager, "server"); 64 65 return 0; 66 } 67 68 /* vim: tabstop=2 expandtab shiftwidth=2 69 */