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