paul@50 | 1 | /* |
paul@50 | 2 | * Test dataspace operations. |
paul@50 | 3 | * |
paul@50 | 4 | * Copyright (C) 2020, 2021 Paul Boddie <paul@boddie.org.uk> |
paul@50 | 5 | * |
paul@50 | 6 | * This program is free software; you can redistribute it and/or |
paul@50 | 7 | * modify it under the terms of the GNU General Public License as |
paul@50 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@50 | 9 | * the License, or (at your option) any later version. |
paul@50 | 10 | * |
paul@50 | 11 | * This program is distributed in the hope that it will be useful, |
paul@50 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@50 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@50 | 14 | * GNU General Public License for more details. |
paul@50 | 15 | * |
paul@50 | 16 | * You should have received a copy of the GNU General Public License |
paul@50 | 17 | * along with this program; if not, write to the Free Software |
paul@50 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@50 | 19 | * Boston, MA 02110-1301, USA |
paul@50 | 20 | */ |
paul@50 | 21 | |
paul@50 | 22 | #include <l4/re/env.h> |
paul@50 | 23 | #include <l4/sys/err.h> |
paul@50 | 24 | |
paul@50 | 25 | #include <stdio.h> |
paul@50 | 26 | #include <string.h> |
paul@50 | 27 | #include <stdlib.h> |
paul@50 | 28 | |
paul@72 | 29 | #include "memory_incremental.h" |
paul@50 | 30 | #include "memory_utils.h" |
paul@72 | 31 | #include "page_queue_shared.h" |
paul@50 | 32 | #include "pages.h" |
paul@50 | 33 | #include "resource_server.h" |
paul@50 | 34 | #include "block_file_opener.h" |
paul@50 | 35 | |
paul@50 | 36 | |
paul@50 | 37 | |
paul@50 | 38 | const unsigned int MEMORY_PAGES = 10; |
paul@50 | 39 | |
paul@50 | 40 | int main(void) |
paul@50 | 41 | { |
paul@50 | 42 | /* Some memory plus infrastructure. */ |
paul@50 | 43 | |
paul@72 | 44 | MemoryIncremental mem(MEMORY_PAGES); |
paul@72 | 45 | PageQueueShared queue; |
paul@72 | 46 | Pages pages(&mem, &queue); |
paul@79 | 47 | BlockFileOpener opener(&pages); |
paul@50 | 48 | |
paul@50 | 49 | /* Register a server associating it with the given object. */ |
paul@50 | 50 | |
paul@50 | 51 | ResourceServer server(&opener); |
paul@50 | 52 | long err = server.bind("server"); |
paul@50 | 53 | |
paul@50 | 54 | if (err) |
paul@50 | 55 | { |
paul@50 | 56 | printf("Could not bind server: %s\n", l4sys_errtostr(err)); |
paul@50 | 57 | return 1; |
paul@50 | 58 | } |
paul@50 | 59 | |
paul@50 | 60 | printf("Starting server...\n"); |
paul@50 | 61 | server.start(); |
paul@50 | 62 | return 0; |
paul@50 | 63 | } |
paul@72 | 64 | |
paul@72 | 65 | // vim: tabstop=2 expandtab shiftwidth=2 |