maybe finish memory server
This commit is contained in:
parent
12ee3bb5b6
commit
04803f06f8
@ -25,6 +25,7 @@
|
|||||||
#include <aos/paging.h>
|
#include <aos/paging.h>
|
||||||
#include <aos/systime.h>
|
#include <aos/systime.h>
|
||||||
#include <barrelfish_kpi/domain_params.h>
|
#include <barrelfish_kpi/domain_params.h>
|
||||||
|
#include <mm/mm.h>
|
||||||
|
|
||||||
#include "threads_priv.h"
|
#include "threads_priv.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
@ -243,6 +244,8 @@ errval_t barrelfish_init_onthread(struct spawn_domain_params *params)
|
|||||||
|
|
||||||
/* TODO MILESTONE 3: now we should have a channel with init set up and can
|
/* TODO MILESTONE 3: now we should have a channel with init set up and can
|
||||||
* use it for the ram allocator */
|
* use it for the ram allocator */
|
||||||
|
//afeer: script page 135, tell domain to use our memserver.
|
||||||
|
err = ram_alloc_set(NULL);
|
||||||
|
|
||||||
// right now we don't have the nameservice & don't need the terminal
|
// right now we don't have the nameservice & don't need the terminal
|
||||||
// and domain spanning, so we return here
|
// and domain spanning, so we return here
|
||||||
|
|||||||
@ -121,15 +121,22 @@ static errval_t handle_rpc_get_ram_cap(
|
|||||||
struct capref arg_cap, size_t arg_size, uintptr_t arg0, uintptr_t arg1,
|
struct capref arg_cap, size_t arg_size, uintptr_t arg0, uintptr_t arg1,
|
||||||
struct capref *ret_cap, size_t *ret_size, uintptr_t *ret0, uintptr_t *ret1
|
struct capref *ret_cap, size_t *ret_size, uintptr_t *ret0, uintptr_t *ret1
|
||||||
) {
|
) {
|
||||||
|
errval_t err;
|
||||||
|
|
||||||
size_t bytes = arg0;
|
size_t bytes = arg0;
|
||||||
size_t alignment = arg1;
|
size_t alignment = arg1;
|
||||||
|
|
||||||
grading_rpc_handler_ram_cap(bytes, alignment);
|
err = ram_alloc_aligned(ret_cap, bytes, alignment);
|
||||||
|
if (err_is_fail(err)) return err;
|
||||||
// TODO
|
|
||||||
*ret0 = bytes;
|
*ret0 = bytes;
|
||||||
|
|
||||||
return LIB_ERR_NOT_IMPLEMENTED;
|
char buf[256];
|
||||||
|
debug_print_cap_at_capref(buf, 256, *ret_cap);
|
||||||
|
debug_printf("cap allocated by memserver: %s\n", buf);
|
||||||
|
|
||||||
|
grading_rpc_handler_ram_cap(bytes, alignment);
|
||||||
|
|
||||||
|
return SYS_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static errval_t handle_rpc_serial_getchar(
|
static errval_t handle_rpc_serial_getchar(
|
||||||
|
|||||||
@ -51,6 +51,10 @@ static errval_t request_and_map_memory(void)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char buf[256];
|
||||||
|
debug_print_cap_at_capref(buf, 256, cap1);
|
||||||
|
debug_printf("cap from rpc: %s\n", buf);
|
||||||
|
|
||||||
struct capref cap1_frame;
|
struct capref cap1_frame;
|
||||||
err = slot_alloc(&cap1_frame);
|
err = slot_alloc(&cap1_frame);
|
||||||
assert(err_is_ok(err));
|
assert(err_is_ok(err));
|
||||||
@ -70,7 +74,7 @@ static errval_t request_and_map_memory(void)
|
|||||||
void *buf1;
|
void *buf1;
|
||||||
err = paging_map_frame(pstate, &buf1, BASE_PAGE_SIZE, cap1_frame);
|
err = paging_map_frame(pstate, &buf1, BASE_PAGE_SIZE, cap1_frame);
|
||||||
if (err_is_fail(err)) {
|
if (err_is_fail(err)) {
|
||||||
DEBUG_ERR(err, "could not get BASE_PAGE_SIZE cap\n");
|
DEBUG_ERR(err, "could not map BASE_PAGE_SIZE cap\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user