add mallocator module
This commit is contained in:
parent
148b2a02ad
commit
070b2fe8e4
@ -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...
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
[
|
||||
|
||||
18
usr/mallocator/Hakefile
Normal file
18
usr/mallocator/Hakefile
Normal file
@ -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" ]
|
||||
}
|
||||
]
|
||||
33
usr/mallocator/main.c
Normal file
33
usr/mallocator/main.c
Normal file
@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <aos/aos.h>
|
||||
#include <aos/paging.h>
|
||||
|
||||
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';
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user