From d13c7d2fe6f5e3f82a035effcc10785c7fb03520 Mon Sep 17 00:00:00 2001 From: Reto Achermann Date: Wed, 30 Apr 2014 14:33:50 +0200 Subject: [PATCH] added entries to gitignore --- .gitignore | 3 ++ include/barrelfish/caddr.h | 2 +- include/barrelfish_kpi/init.h | 24 ++++++++---------- include/xeon_phi/xeon_phi.h | 17 ------------- kernel/arch/x86_64/entry.S | 10 ++++---- kernel/include/startup.h | 4 +- kernel/include/target/x86_64/offsets_target.h | 4 +- kernel/startup.c | 33 +++++------------------- lib/barrelfish/capabilities.c | 10 +------ usr/init/mem_alloc.c | 4 +- usr/init/spawn.c | 13 +-------- usr/mem_serv/mem_serv.c | 14 +--------- 12 files changed, 39 insertions(+), 99 deletions(-) diff --git a/.gitignore b/.gitignore index 30a9856..4630891 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ tags /.dist-buildwrapper toolchain/* /build +.cproject +.project + diff --git a/include/barrelfish/caddr.h b/include/barrelfish/caddr.h index 67ee990..86db376 100644 --- a/include/barrelfish/caddr.h +++ b/include/barrelfish/caddr.h @@ -58,7 +58,7 @@ static inline bool capref_is_null(struct capref capref) /* well-known cnodes */ extern struct cnoderef cnode_root, cnode_task, cnode_base, - cnode_super0, cnode_super1, cnode_page, cnode_module; + cnode_super, cnode_page, cnode_module; /* well-known capabilities */ extern struct capref cap_root, cap_monitorep, cap_irq, cap_io, cap_dispatcher, diff --git a/include/barrelfish_kpi/init.h b/include/barrelfish_kpi/init.h index 8f8b1ae..31258e4 100644 --- a/include/barrelfish_kpi/init.h +++ b/include/barrelfish_kpi/init.h @@ -19,7 +19,7 @@ /** * Size of bootinfo mapping. - */ + */ #define BOOTINFO_SIZEBITS (BASE_PAGE_BITS + 2) #define BOOTINFO_SIZE (1UL << BOOTINFO_SIZEBITS) @@ -77,16 +77,15 @@ #define ROOTCN_SLOT_TASKCN 0 ///< Taskcn slot in root cnode #define ROOTCN_SLOT_PAGECN 1 ///< Pagecn slot in root cnode #define ROOTCN_SLOT_BASE_PAGE_CN 2 ///< Slot for a cnode of BASE_PAGE_SIZE frames -#define ROOTCN_SLOT_SUPERCN0 3 ///< Slot for a cnode of SUPER frames -#define ROOTCN_SLOT_SUPERCN1 4 ///< Slot for a cnode of SUPER frames -#define ROOTCN_SLOT_SEGCN 5 ///< SegCN slot in root cnode -#define ROOTCN_SLOT_PACN 6 ///< PhysAddr cnode slot in root cnode -#define ROOTCN_SLOT_MODULECN 7 ///< Multiboot modules cnode slot in root cnode -#define ROOTCN_SLOT_SLOT_ALLOC0 8 ///< Root of slot alloc0 -#define ROOTCN_SLOT_SLOT_ALLOC1 9 ///< Root of slot alloc1 -#define ROOTCN_SLOT_SLOT_ALLOC2 10 ///< Root of slot alloc2 -#define ROOTCN_SLOT_ARGCN 11 ///< Argcn slot in root cnode -#define ROOTCN_SLOTS_USER 12 ///< First free slot in root cnode for user +#define ROOTCN_SLOT_SUPERCN 3 ///< Slot for a cnode of SUPER frames +#define ROOTCN_SLOT_SEGCN 4 ///< SegCN slot in root cnode +#define ROOTCN_SLOT_PACN 5 ///< PhysAddr cnode slot in root cnode +#define ROOTCN_SLOT_MODULECN 6 ///< Multiboot modules cnode slot in root cnode +#define ROOTCN_SLOT_SLOT_ALLOC0 7 ///< Root of slot alloc0 +#define ROOTCN_SLOT_SLOT_ALLOC1 8 ///< Root of slot alloc1 +#define ROOTCN_SLOT_SLOT_ALLOC2 9 ///< Root of slot alloc2 +#define ROOTCN_SLOT_ARGCN 10 ///< Argcn slot in root cnode +#define ROOTCN_SLOTS_USER 11 ///< First free slot in root cnode for user /* Size of CNodes in Root CNode if not the default size */ #define SLOT_ALLOC_CNODE_BITS (DEFAULT_CNODE_BITS * 2) @@ -114,8 +113,7 @@ #define DEFAULT_CN_ADDR_BITS (CPTR_BITS - DEFAULT_CNODE_BITS) #define CPTR_BASE_PAGE_CN_BASE (ROOTCN_SLOT_BASE_PAGE_CN << DEFAULT_CN_ADDR_BITS) -#define CPTR_SUPERCN0_BASE (ROOTCN_SLOT_SUPERCN0 << DEFAULT_CN_ADDR_BITS) -#define CPTR_SUPERCN1_BASE (ROOTCN_SLOT_SUPERCN1 << DEFAULT_CN_ADDR_BITS) +#define CPTR_SUPERCN_BASE (ROOTCN_SLOT_SUPERCN << DEFAULT_CN_ADDR_BITS) #define CPTR_PHYADDRCN_BASE (ROOTCN_SLOT_PACN << DEFAULT_CN_ADDR_BITS) #define CPTR_MODULECN_BASE (ROOTCN_SLOT_MODULECN << DEFAULT_CN_ADDR_BITS) #define CPTR_PML4_BASE (ROOTCN_SLOT_PAGECN << (CPTR_BITS - PAGE_CNODE_BITS)) diff --git a/include/xeon_phi/xeon_phi.h b/include/xeon_phi/xeon_phi.h index d10b506..9469bf6 100644 --- a/include/xeon_phi/xeon_phi.h +++ b/include/xeon_phi/xeon_phi.h @@ -13,21 +13,4 @@ /// The maximum number of coprocessor cards in a system #define XEON_PHI_NUM_MAX 8 - -#define XEON_PHY_HOST_MEM_OFFSET 0x8000000000UL - -#define XEON_PHI_HOST_TO_CARD_MEM(x) \ - ((lpaddr_t)(x)+XEON_PHY_HOST_MEM_OFFSET) - - -/** - * this struct represents the information passed from the host to the - * coprocessor kernels - */ -struct xeon_phi_info { - uintptr_t comm_base; // TODO: communication base - - uint8_t present; ///< flag indicating the present cards in the system -}; - #endif // XEON_PHI_XEON_PHI_H_ diff --git a/kernel/arch/x86_64/entry.S b/kernel/arch/x86_64/entry.S index ff17209..959be91 100644 --- a/kernel/arch/x86_64/entry.S +++ b/kernel/arch/x86_64/entry.S @@ -59,7 +59,7 @@ syscall_entry: /* Load pointer to endpoint cap */ shl $OBJBITS_CTE, %rsi mov OFFSETOF_CAP_CNODE_CNODE(%rdi), %rcx - mov $0xfffffe0000000000, %rdi // phys_to_mem() + mov $0xffffff8000000000, %rdi // phys_to_mem() add %rdi, %rcx add %rsi, %rcx @@ -147,7 +147,7 @@ lrpc_check_runnable_continue: xor %eax, %eax mov %eax, %fs mov %eax, %gs - + /* Get new dispatcher pointer */ mov OFFSETOF_DCB_DISP(%rsi), %rax /* Disable target dispatcher -- gotta do it here for TLB hit reasons */ @@ -182,7 +182,7 @@ load_ldt: /* Load a new LDT: r11 = base, r14 = npages, rcx = temp for descriptor je load_ldt_invalid cmpq $0, %r14 je load_ldt_invalid - + /* Update segment descriptor for LDT */ movq %r11, current_ldt_base(%rip) @@ -236,9 +236,9 @@ load_ldt: /* Load a new LDT: r11 = base, r14 = npages, rcx = temp for descriptor // Store new descriptor (low half) to GDT mov %rcx, (gdt + 8*LDT_LO_SEL)(%rip) - + // Construct segment selector and load it - mov $LDT_SELECTOR, %cx + mov $LDT_SELECTOR, %cx lldt %cx jmp load_ldt_continue diff --git a/kernel/include/startup.h b/kernel/include/startup.h index d40ef13..0d87336 100644 --- a/kernel/include/startup.h +++ b/kernel/include/startup.h @@ -22,12 +22,12 @@ enum region_type; struct spawn_state { /// Init's cnodes - struct cte *taskcn, *segcn,*supercn0,*supercn1, *physaddrcn, *modulecn, + struct cte *taskcn, *segcn, *supercn, *physaddrcn, *modulecn, *pagecn, *basepagecn, *slot_alloc_cn0, *slot_alloc_cn1, *slot_alloc_cn2; /// Next slot in each cnode - cslot_t segcn_slot, supercn0_slot, supercn1_slot, physaddrcn_slot, modulecn_slot; + cslot_t segcn_slot, supercn_slot, physaddrcn_slot, modulecn_slot; /// Address of arguments page lpaddr_t args_page; diff --git a/kernel/include/target/x86_64/offsets_target.h b/kernel/include/target/x86_64/offsets_target.h index e48b033..0761873 100644 --- a/kernel/include/target/x86_64/offsets_target.h +++ b/kernel/include/target/x86_64/offsets_target.h @@ -62,7 +62,7 @@ * for a bigger physical address space. We set this to 37-bit, * i.e. 128 GBytes. */ -#define X86_64_PADDR_SPACE_LIMIT ((genpaddr_t)1 << 40) +#define X86_64_PADDR_SPACE_LIMIT ((genpaddr_t)1 << 37) /** * Static address space limit for the init user-space domain. The @@ -100,7 +100,7 @@ * Aligns an address to the nearest PML4 entry by masking out lower 39 * bits. */ -#define X86_64_PML4_ALIGN(addr) ((addr) & ((genpaddr_t)0x7fffff << 41)) +#define X86_64_PML4_ALIGN(addr) ((addr) & ((genpaddr_t)0x1ffffff << 39)) /** * Absolute offset of mapped physical memory within virtual address diff --git a/kernel/startup.c b/kernel/startup.c index d1ea737..bfa443d 100644 --- a/kernel/startup.c +++ b/kernel/startup.c @@ -61,12 +61,8 @@ errval_t create_caps_to_cnode(lpaddr_t base_addr, size_t size, switch(type) { case RegionType_Empty: cap_type = ObjType_RAM; - cnode = &st->supercn0->cap; - slot = &st->supercn0_slot; - if (*slot >= 1UL << cnode->u.cnode.bits) { - slot = &st->supercn1_slot; - cnode = &st->supercn1->cap; - } + cnode = &st->supercn->cap; + slot = &st->supercn_slot; break; case RegionType_PhyAddr: @@ -89,19 +85,9 @@ errval_t create_caps_to_cnode(lpaddr_t base_addr, size_t size, while (remain > 0) { /* Cannot insert anymore into this cnode */ if (*slot >= 1UL << cnode->u.cnode.bits) { - /* - * it may be the case that we run over so switch to the other - * supercn1 the switching should only happen once during this loop - */ - if (cnode == &st->supercn0->cap) { - slot = &st->supercn1_slot; - cnode = &st->supercn1->cap; - assert(*slot < 1UL << cnode->u.cnode.bits); - } else { - printk(LOG_WARN, "create_caps_to_cnode: Cannot create more caps " - "in CNode\n"); - return -1; - } + printk(LOG_WARN, "create_caps_to_cnode: Cannot create more caps " + "in CNode\n"); + return -1; } /* Cannot insert anymore into the mem_region */ if (*regions_index >= MAX_MEM_REGIONS) { @@ -181,15 +167,10 @@ struct dcb *spawn_module(struct spawn_state *st, assert(err_is_ok(err)); // Super cnode in root cnode - st->supercn0 = caps_locate_slot(CNODE(&rootcn), ROOTCN_SLOT_SUPERCN0); + st->supercn = caps_locate_slot(CNODE(&rootcn), ROOTCN_SLOT_SUPERCN); err = caps_create_new(ObjType_CNode, alloc_phys(BASE_PAGE_SIZE), - BASE_PAGE_BITS, DEFAULT_CNODE_BITS, st->supercn0); + BASE_PAGE_BITS, DEFAULT_CNODE_BITS, st->supercn); assert(err_is_ok(err)); - st->supercn1 = caps_locate_slot(CNODE(&rootcn), ROOTCN_SLOT_SUPERCN1); - err = caps_create_new(ObjType_CNode, alloc_phys(BASE_PAGE_SIZE), - BASE_PAGE_BITS, DEFAULT_CNODE_BITS, st->supercn1); - assert(err_is_ok(err)); - // slot_alloc cnodes in root cnode st->slot_alloc_cn0 = caps_locate_slot(CNODE(&rootcn), ROOTCN_SLOT_SLOT_ALLOC0); diff --git a/lib/barrelfish/capabilities.c b/lib/barrelfish/capabilities.c index 4275d9e..a1162b4 100644 --- a/lib/barrelfish/capabilities.c +++ b/lib/barrelfish/capabilities.c @@ -49,14 +49,8 @@ struct cnoderef cnode_base = { }; /// Super CNode -struct cnoderef cnode_super0 = { - .address = CPTR_SUPERCN0_BASE, - .address_bits = DEFAULT_CNODE_BITS, - .size_bits = DEFAULT_CNODE_BITS, - .guard_size = 0 -}; -struct cnoderef cnode_super1 = { - .address = CPTR_SUPERCN1_BASE, +struct cnoderef cnode_super = { + .address = CPTR_SUPERCN_BASE, .address_bits = DEFAULT_CNODE_BITS, .size_bits = DEFAULT_CNODE_BITS, .guard_size = 0 diff --git a/usr/init/mem_alloc.c b/usr/init/mem_alloc.c index 9c27298..4a63af4 100644 --- a/usr/init/mem_alloc.c +++ b/usr/init/mem_alloc.c @@ -54,7 +54,7 @@ errval_t initialize_ram_alloc(void) * or else the next closest less than MM_MAXSIZEBITS */ int mem_region = -1, mem_slot = 0; struct capref mem_cap = { - .cnode = cnode_super0, + .cnode = cnode_super, .slot = 0, }; @@ -62,7 +62,7 @@ errval_t initialize_ram_alloc(void) for (int i = 0; i < bi->regions_length; i++) { assert(!bi->regions[i].mr_consumed); if (bi->regions[i].mr_type == RegionType_Empty) { - if (bi->regions[i].mr_bits >= MM_REQUIREDBITS + if (bi->regions[i].mr_bits >= MM_REQUIREDBITS && bi->regions[i].mr_bits <= MM_MAXSIZEBITS && (mem_region == -1 || bi->regions[i].mr_bits < bi->regions[mem_region].mr_bits)) { mem_region = i; diff --git a/usr/init/spawn.c b/usr/init/spawn.c index 6aaae11..6d1a110 100644 --- a/usr/init/spawn.c +++ b/usr/init/spawn.c @@ -24,26 +24,17 @@ errval_t initialize_mem_serv(struct spawninfo *si) /* copy supercn to memory server */; struct capref init_supercn_cap = { .cnode = cnode_root, - .slot = ROOTCN_SLOT_SUPERCN0 + .slot = ROOTCN_SLOT_SUPERCN }; struct capref child_supercn_cap = { .cnode = si->rootcn, - .slot = ROOTCN_SLOT_SUPERCN0 + .slot = ROOTCN_SLOT_SUPERCN }; err = cap_copy(child_supercn_cap, init_supercn_cap); if (err_is_fail(err)) { return err_push(err, INIT_ERR_COPY_SUPERCN_CAP); } - /* copy supercn to memory server */; - init_supercn_cap.slot = ROOTCN_SLOT_SUPERCN1; - child_supercn_cap.slot = ROOTCN_SLOT_SUPERCN1; - - err = cap_copy(child_supercn_cap, init_supercn_cap); - if (err_is_fail(err)) { - return err_push(err, INIT_ERR_COPY_SUPERCN_CAP); - } - return SYS_ERR_OK; } diff --git a/usr/mem_serv/mem_serv.c b/usr/mem_serv/mem_serv.c index d48d774..092098b 100644 --- a/usr/mem_serv/mem_serv.c +++ b/usr/mem_serv/mem_serv.c @@ -34,7 +34,7 @@ size_t mem_total = 0, mem_avail = 0; // architecture, we use paddr_t as the type to represent region // limits, which limits us its size. #if defined(__x86_64__) -# define MAXSIZEBITS 40 ///< Max size of memory in allocator +# define MAXSIZEBITS 38 ///< Max size of memory in allocator #elif defined(__i386__) # define MAXSIZEBITS 32 #elif defined(__arm__) @@ -410,7 +410,7 @@ initialize_ram_alloc(void) /* walk bootinfo and add all unused RAM caps to allocator */ struct capref mem_cap = { - .cnode = cnode_super0, + .cnode = cnode_super, .slot = 0, }; @@ -418,16 +418,6 @@ initialize_ram_alloc(void) if (bi->regions[i].mr_type == RegionType_Empty) { dump_ram_region(i, bi->regions + i); - /* - * we may have more memory regions than we have space in a single - * CNode, thus we switch to the second. - * - */ - if (mem_cap.slot >= (1UL << mem_cap.cnode.size_bits)) { - mem_cap.slot=0; - mem_cap.cnode = cnode_super1; - } - mem_total += ((size_t)1) << bi->regions[i].mr_bits; if (bi->regions[i].mr_consumed) { -- 1.7.2.5