diff --git a/src/components/implementation/cbuf_mgr/default/Makefile b/src/components/implementation/cbuf_mgr/default/Makefile index eab2520879..9a5f9e9b31 100644 --- a/src/components/implementation/cbuf_mgr/default/Makefile +++ b/src/components/implementation/cbuf_mgr/default/Makefile @@ -2,7 +2,7 @@ C_OBJS=cbuf_mgr.o ASM_OBJS= COMPONENT=cbuf.o INTERFACES=cbuf_mgr stkmgr -DEPENDENCIES=sched printc lock mem_mgr_large valloc cinfo +DEPENDENCIES=sched printc lock mem_mgr_large valloc include ../../Makefile.subsubdir MANDITORY_LIB=simple_stklib.o diff --git a/src/components/implementation/cbuf_mgr/default/cbuf_mgr.c b/src/components/implementation/cbuf_mgr/default/cbuf_mgr.c index c3a62eaa80..6bfeac9786 100644 --- a/src/components/implementation/cbuf_mgr/default/cbuf_mgr.c +++ b/src/components/implementation/cbuf_mgr/default/cbuf_mgr.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -86,7 +85,6 @@ struct cbuf_bin { struct cbuf_comp_info { spdid_t spdid; - struct cos_component_information *cinfo_page; struct cbuf_shared_page *csp; vaddr_t dest_csp; int nbin; @@ -157,13 +155,6 @@ cbuf_comp_info_init(spdid_t spdid, struct cbuf_comp_info *cci) memset(cci, 0, sizeof(*cci)); cci->spdid = spdid; cvect_add(&components, cci, spdid); - - p = valloc_alloc(cos_spd_id(), cos_spd_id(), 1); - if (cinfo_map(cos_spd_id(), (vaddr_t)p, spdid)) { - DOUT("%d: couldn't cinfo_map for %d\n", cos_spd_id(), spdid); - valloc_free(cos_spd_id(), spdid, p, 1); - } - cci->cinfo_page = p; } static struct cbuf_comp_info * @@ -741,22 +732,21 @@ void * stkmgr_grant_stack(spdid_t d_spdid) { struct cbuf_comp_info *cci; - void *p; + void *p, *ret = NULL; vaddr_t d_addr; printl("stkmgr_grant_stack (cbuf)\n"); CBUF_TAKE(); cci = cbuf_comp_info_get(d_spdid); - assert(cci); if (!cci) goto done; - assert(!cbuf_alloc_map(d_spdid, &d_addr, (void**)&p, PAGE_SIZE)); - cci->cinfo_page->cos_stacks.freelists[0].freelist = D_COS_STK_ADDR(d_addr); + if (cbuf_alloc_map(d_spdid, &d_addr, (void**)&p, PAGE_SIZE)) goto done; + ret = (void*)D_COS_STK_ADDR(d_addr); done: CBUF_RELEASE(); - return NULL; + return ret; } diff --git a/src/components/implementation/no_interface/boot/boot_deps.h b/src/components/implementation/no_interface/boot/boot_deps.h index d54bbdd6c6..34314bdd7e 100644 --- a/src/components/implementation/no_interface/boot/boot_deps.h +++ b/src/components/implementation/no_interface/boot/boot_deps.h @@ -29,54 +29,29 @@ COS_VECT_CREATE_STATIC(spd_info_addresses); int -cinfo_add(spdid_t spdid, spdid_t target, struct cos_component_information *ci) +cinfo_add_heap_pointer(spdid_t spdid, spdid_t target, void *heap_pointer) { if (cos_vect_lookup(&spd_info_addresses, target)) return -1; - cos_vect_add_id(&spd_info_addresses, (void*)round_to_page(ci), target); + cos_vect_add_id(&spd_info_addresses, heap_pointer, target); return 0; } void* -cinfo_alloc_page(spdid_t spdid) +cinfo_get_heap_pointer(spdid_t spdid, spdid_t target) { - void *p = cos_get_vas_page(); - return p; + return cos_vect_lookup(&spd_info_addresses, target); } -int -cinfo_map(spdid_t spdid, vaddr_t map_addr, spdid_t target) -{ - vaddr_t cinfo_addr; - - cinfo_addr = (vaddr_t)cos_vect_lookup(&spd_info_addresses, target); - if (0 == cinfo_addr) return -1; - if (map_addr != - (__local_mman_alias_page(cos_spd_id(), cinfo_addr, spdid, map_addr, MAPPING_RW))) { - return -1; - } - - return 0; -} - -int -cinfo_spdid(spdid_t spdid) -{ - return cos_spd_id(); -} - -static int boot_spd_set_symbs(struct cobj_header *h, spdid_t spdid, struct cos_component_information *ci); static void -comp_info_record(struct cobj_header *h, spdid_t spdid, struct cos_component_information *ci) +boot_deps_init(void) { - if (!cinfo_add(cos_spd_id(), spdid, ci)) { - boot_spd_set_symbs(h, spdid, ci); - } + cos_vect_init_static(&spd_info_addresses); } static void -boot_deps_init(void) +boot_deps_save_hp(spdid_t spdid, void *hp) { - cos_vect_init_static(&spd_info_addresses); + cinfo_add_heap_pointer(cos_spd_id(), spdid, hp); } static void diff --git a/src/components/implementation/no_interface/boot/booter.c b/src/components/implementation/no_interface/boot/booter.c index 10fd35f8fc..abbb4559b4 100644 --- a/src/components/implementation/no_interface/boot/booter.c +++ b/src/components/implementation/no_interface/boot/booter.c @@ -131,10 +131,6 @@ boot_process_cinfo(struct cobj_header *h, spdid_t spdid, vaddr_t heap_val, ci->init_string[len] = '\0'; } - /* save the address of this page for later retrieval - * (e.g. to manipulate the stack pointer) */ - comp_info_record(h, spdid, ci); - return 1; } @@ -161,6 +157,10 @@ boot_spd_map_memory(struct cobj_header *h, spdid_t spdid, vaddr_t comp_info) local_md[spdid].h = h; local_md[spdid].page_start = cos_get_heap_ptr(); local_md[spdid].comp_info = comp_info; + + /* save the address of the heap for later retrieval */ + boot_deps_save_hp(spdid, (void*)boot_spd_end(h)); + for (i = 0 ; i < h->nsect ; i++) { struct cobj_sect *sect; int left; @@ -229,9 +229,12 @@ boot_spd_map_populate(struct cobj_header *h, spdid_t spdid, vaddr_t comp_info, i } if (sect->flags & COBJ_SECT_CINFO) { + struct cos_component_information *ci; assert(left == PAGE_SIZE); assert(comp_info == dest_daddr); - boot_process_cinfo(h, spdid, boot_spd_end(h), start_addr + (comp_info-init_daddr), comp_info); + ci = (struct cos_component_information *)(start_addr + (comp_info - init_daddr)); + boot_process_cinfo(h, spdid, boot_spd_end(h), (void*)ci, comp_info); + if (first_time) boot_spd_set_symbs(h, spdid, ci); } } return 0; diff --git a/src/components/implementation/no_interface/cbboot/boot_deps.h b/src/components/implementation/no_interface/cbboot/boot_deps.h index 8aa68f30f4..3a36634abc 100644 --- a/src/components/implementation/no_interface/cbboot/boot_deps.h +++ b/src/components/implementation/no_interface/cbboot/boot_deps.h @@ -26,19 +26,14 @@ #include #include -static int boot_spd_set_symbs(struct cobj_header *h, spdid_t spdid, struct cos_component_information *ci); static void -comp_info_record(struct cobj_header *h, spdid_t spdid, struct cos_component_information *ci) -{ - vaddr_t cinfo_addr = (vaddr_t)cinfo_alloc_page(cos_spd_id()); - if (cinfo_addr != __local_mman_alias_page(cos_spd_id(), (vaddr_t)round_to_page(ci), cinfo_spdid(cos_spd_id()), cinfo_addr, MAPPING_RW)) BUG(); - if (!cinfo_add(cos_spd_id(), spdid, cinfo_addr)) { - boot_spd_set_symbs(h, spdid, ci); - } -} +boot_deps_init(void) { return; } static void -boot_deps_init(void) { return; } +boot_deps_save_hp(spdid_t spdid, void *hp) +{ + cinfo_add_heap_pointer(cos_spd_id(), spdid, hp); +} static void boot_deps_run(void) { return; } diff --git a/src/components/implementation/no_interface/cinfo_test/citest.c b/src/components/implementation/no_interface/cinfo_test/citest.c index bdf5c20584..b8b3b604b5 100644 --- a/src/components/implementation/no_interface/cinfo_test/citest.c +++ b/src/components/implementation/no_interface/cinfo_test/citest.c @@ -6,29 +6,14 @@ void cos_init(void) { - void *hp = cos_get_heap_ptr(); int i; for (i = 0 ; i < MAX_NUM_SPDS ; i++) { - struct cos_component_information *ci; spdid_t spdid = (spdid_t)i; - - cos_set_heap_ptr((void*)(((unsigned long)hp)+PAGE_SIZE)); - //spdid = cinfo_get_spdid(i); - //if (!spdid) break; - - if (cinfo_map(cos_spd_id(), (vaddr_t)hp, spdid)) { - printc("Could not map cinfo page for %d.\n", spdid); - continue; - } - ci = hp; - printc("mapped -- id: %ld, hp:%x, sp:%x\n", - ci->cos_this_spd_id, (unsigned int)ci->cos_heap_ptr, - (unsigned int)ci->cos_stacks.freelists[0].freelist); - - hp = cos_get_heap_ptr(); + void *hp = cinfo_get_heap_pointer(cos_spd_id(), spdid); + printc("got heap -- id: %d, hp:%p\n", spdid, hp); } - printc("Done mapping components information pages!\n"); + printc("Done getting components heap pointers!\n"); } void bin (void) diff --git a/src/components/implementation/no_interface/llboot/boot_deps.h b/src/components/implementation/no_interface/llboot/boot_deps.h index 4e29706063..4c99385900 100644 --- a/src/components/implementation/no_interface/llboot/boot_deps.h +++ b/src/components/implementation/no_interface/llboot/boot_deps.h @@ -241,16 +241,6 @@ __local_mman_alias_page(spdid_t s_spd, vaddr_t s_addr, spdid_t d_spd, vaddr_t d_ return d_addr; } -static int boot_spd_set_symbs(struct cobj_header *h, spdid_t spdid, struct cos_component_information *ci); -static void -comp_info_record(struct cobj_header *h, spdid_t spdid, struct cos_component_information *ci) -{ - if (!comp_boot_nfo[spdid].symbols_initialized) { - comp_boot_nfo[spdid].symbols_initialized = 1; - boot_spd_set_symbs(h, spdid, ci); - } -} - static inline void boot_create_init_thds(void) { struct llbooter_per_core *llboot = PERCPU_GET(llbooter); @@ -278,6 +268,11 @@ boot_deps_init(void) assert(nmmgrs > 0); } +static void +boot_deps_save_hp(spdid_t spdid, void *hp) +{ +} + static void boot_deps_run(void) { diff --git a/src/components/implementation/valloc/simple/valloc.c b/src/components/implementation/valloc/simple/valloc.c index b82bff4f79..9f99445c09 100644 --- a/src/components/implementation/valloc/simple/valloc.c +++ b/src/components/implementation/valloc/simple/valloc.c @@ -54,7 +54,6 @@ struct vas_extent { struct spd_vas_tracker { spdid_t spdid; - struct cos_component_information *ci; struct vas_extent extents[MAX_SPD_VAS_LOCATIONS]; /* should be an array to track more than 2^27 bytes */ struct spd_vas_occupied *map; @@ -65,7 +64,6 @@ static int __valloc_init(spdid_t spdid) int ret = -1; struct spd_vas_tracker *trac; struct spd_vas_occupied *occ; - struct cos_component_information *ci; unsigned long page_off; void *hp; @@ -76,12 +74,10 @@ static int __valloc_init(spdid_t spdid) occ = alloc_page(); if (!occ) goto err_free1; - ci = cos_get_vas_page(); - if (cinfo_map(cos_spd_id(), (vaddr_t)ci, spdid)) goto err_free2; - hp = (void*)ci->cos_heap_ptr; + hp = cinfo_get_heap_pointer(cos_spd_id(), spdid); + if (!hp) goto err_free2; trac->spdid = spdid; - trac->ci = ci; trac->map = occ; trac->extents[0].start = (void*)round_to_pgd_page(hp); trac->extents[0].end = (void*)round_up_to_pgd_page(hp); @@ -96,7 +92,6 @@ static int __valloc_init(spdid_t spdid) done: return ret; err_free2: - cos_release_vas_page(ci); free_page(occ); err_free1: free(trac); diff --git a/src/components/include/cos_asm_stkmgr_stacks.h b/src/components/include/cos_asm_stkmgr_stacks.h index 8160dfbc96..efac44c508 100644 --- a/src/components/include/cos_asm_stkmgr_stacks.h +++ b/src/components/include/cos_asm_stkmgr_stacks.h @@ -42,6 +42,7 @@ movl (%eax), %esp; \ COMP_INFO_CMPXCHG; \ jnz 8b; \ +5: \ \ /* now we have the stack */ \ movl %eax, %esp; \ @@ -80,9 +81,7 @@ call stkmgr_grant_stack; \ addl $4, %esp; \ \ - /* addl $0x4, %eax; */ \ - \ - /*restore stack */ \ + /* restore regs */ \ popl %edx; \ popl %ecx; \ popl %ebx; \ @@ -90,12 +89,11 @@ popl %esi; \ popl %ebp; \ \ - /* movl %eax, %esp; */ \ - /* restore Thd_id in eax */ \ - /* movl $THD_ID_SHARED_PAGE, %edx; */ \ - /* movl (%edx), %eax; */ \ - movl %edx, %eax; \ - jmp 1b; + /* Check for NULL stack return */ \ + testl %eax, %eax; \ + je 8b; \ + /* Got a stack in eax */ \ + jmp 5b; #define COS_ASM_RET_STACK \ \ diff --git a/src/components/interface/cinfo/cinfo.h b/src/components/interface/cinfo/cinfo.h index cff070d24c..3f7a1d1c4c 100644 --- a/src/components/interface/cinfo/cinfo.h +++ b/src/components/interface/cinfo/cinfo.h @@ -1,11 +1,7 @@ #ifndef CINFO_H #define CINFO_H -int cinfo_add(spdid_t spdid, spdid_t target, struct cos_component_information *ci); -void* cinfo_alloc_page(spdid_t spdid); -int cinfo_map(spdid_t spdid, vaddr_t map_addr, spdid_t target); -int cinfo_spdid(spdid_t spdid); - -/* vaddr_t cinfo_map_peek(spdid_t spdid); */ +int cinfo_add_heap_pointer(spdid_t spdid, spdid_t target, void *hp); +void* cinfo_get_heap_pointer(spdid_t spdid, spdid_t target); #endif /* !CINFO_H */ diff --git a/src/components/interface/cinfo/stubs/s_stub.S b/src/components/interface/cinfo/stubs/s_stub.S index b8a2a614ed..a4807fd742 100644 --- a/src/components/interface/cinfo/stubs/s_stub.S +++ b/src/components/interface/cinfo/stubs/s_stub.S @@ -9,7 +9,5 @@ .text -cos_asm_server_stub_spdid(cinfo_add) -cos_asm_server_stub_spdid(cinfo_alloc_page) -cos_asm_server_stub_spdid(cinfo_map) -cos_asm_server_stub_spdid(cinfo_spdid) +cos_asm_server_stub_spdid(cinfo_add_heap_pointer) +cos_asm_server_stub_spdid(cinfo_get_heap_pointer)