diff --git a/hake/menu.lst.armv8_a57_qemu b/hake/menu.lst.armv8_a57_qemu index 49d5b1e..033c294 100644 --- a/hake/menu.lst.armv8_a57_qemu +++ b/hake/menu.lst.armv8_a57_qemu @@ -7,5 +7,6 @@ cpudriver /armv8/sbin/cpu_a57_qemu loglevel=3 serial=0x9000000 logmask=128 module /armv8/sbin/init module /armv8/sbin/hello spawn module /armv8/sbin/memeater +module /armv8/sbin/mallocator # End of file, this needs to have a certain length... diff --git a/hake/menu.lst.armv8_imx8x b/hake/menu.lst.armv8_imx8x index 3906821..68a2824 100644 --- a/hake/menu.lst.armv8_imx8x +++ b/hake/menu.lst.armv8_imx8x @@ -7,3 +7,4 @@ cpudriver /armv8/sbin/cpu_imx8x module /armv8/sbin/init module /armv8/sbin/hello spawn module /armv8/sbin/memeater +module /armv8/sbin/mallocator diff --git a/lib/grading/test_threads.c b/lib/grading/test_threads.c index 2836cde..dfa3d5c 100644 --- a/lib/grading/test_threads.c +++ b/lib/grading/test_threads.c @@ -4,5 +4,10 @@ void do_test_threads(void) { debug_printf("[do_test_threads]\n"); + + struct spawninfo *si = malloc(sizeof(struct spawninfo)); + domainid_t *pid = malloc(sizeof(domainid_t)); + + CHECK_ERR(spawn_load_by_name("mallocator", si, pid)); } diff --git a/platforms/Hakefile b/platforms/Hakefile index 1a20932..9b52478 100644 --- a/platforms/Hakefile +++ b/platforms/Hakefile @@ -12,7 +12,7 @@ let -- Default list of modules to build/install - modules_common = [ "/sbin/" ++ f | f <- [ "init", "hello", "memeater" + modules_common = [ "/sbin/" ++ f | f <- [ "init", "hello", "memeater", "mallocator" ] ] in [ diff --git a/usr/mallocator/Hakefile b/usr/mallocator/Hakefile new file mode 100644 index 0000000..c300d68 --- /dev/null +++ b/usr/mallocator/Hakefile @@ -0,0 +1,18 @@ +-------------------------------------------------------------------------- +-- Copyright (c) 2007-2010, ETH Zurich. +-- All rights reserved. +-- +-- This file is distributed under the terms in the attached LICENSE file. +-- If you do not find this file, copies can be found by writing to: +-- ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. +-- +-- Hakefile for /usr/init +-- +-------------------------------------------------------------------------- + +[ build application + { + target = "mallocator", + cFiles = [ "main.c" ] + } +] diff --git a/usr/mallocator/main.c b/usr/mallocator/main.c new file mode 100644 index 0000000..5f38b2c --- /dev/null +++ b/usr/mallocator/main.c @@ -0,0 +1,33 @@ +/** + * \file + * \brief process that allocates some memory to test page faulting and page mapping + */ + +/* + * Copyright (c) 2016, ETH Zurich. + * All rights reserved. + * + * This file is distributed under the terms in the attached LICENSE file. + * If you do not find this file, copies can be found by writing to: + * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group. + */ + +#include +#include + +#include +#include + +int main(int argc, char *argv[]) +{ + //allocate a 256 byte buffer + // char * small_buf = malloc(256); + // small_buf[0] = 'a'; + //allocate a 256 MiB buffer + char * big_buf = malloc(1<<28); + big_buf[0] = 'a'; + for (int i = 0; i < (1 << 14); i += 4096) { + printf("%x\n", i); + big_buf[i] = 'b'; + } +} \ No newline at end of file