uint8_t maxslotbits; ///< Maximum number of slots per allocation
uint8_t cnode_size_bits; ///< Size of created cnodes
- struct cnoderef top_cnode; ///< Top-level cnode
+ struct cnoderef top_cnode __attribute__ ((aligned(4))); ///< Top-level cnode
struct capref top_cnode_slot; ///< Location to place top-level cnode
uint64_t top_used; ///< Slots used in top-level cnode
*/
struct spawninfo {
domainid_t domain_id;
- struct cnoderef rootcn, taskcn, segcn, pagecn;
+ struct cnoderef rootcn __attribute__ ((aligned(4)));
+ struct cnoderef taskcn __attribute__ ((aligned(4)));
+ struct cnoderef segcn __attribute__ ((aligned(4)));
+ struct cnoderef pagecn __attribute__ ((aligned(4)));
struct capref rootcn_cap, taskcn_cap, pagecn_cap;
struct capref dispframe, dcb, argspg, vtree;
struct capref fdcap;
uint16_t invoke_bits = (sa->arg0 >> 16) & 0xffff;
capaddr_t invoke_cptr = sa->arg1;
- debug(SUBSYS_SYSCALL, "sys_invoke(0x%"PRIxCADDR"(%d))\n", invoke_cptr, invoke_bits);
+ //debug(SUBSYS_SYSCALL, "sys_invoke(0x%"PRIxCADDR"(%d))\n", invoke_cptr, invoke_bits);
struct sysret r = { .error = SYS_ERR_OK, .value = 0 };
$exceptions_save_got:
ldr r0, = got_for_sys_mode
str PIC_REGISTER, [r0]
-//$exceptions_unmask_irq:
-// mrs r1, cpsr
-// bic r1, r1, #0x80
-// msr cpsr_c, r1
$exceptions_init_done:
ldmfd sp!, {pc}
.endm
//
- // Macro to enter SVC mode with interrupts disabled.
+ // Macro to enter SYS mode with interrupts disabled.
// Set up stack and GOT pointer.
//
.macro enter_sys scratch
- mov \scratch, #(CPSR_IF_MASK | ARM_MODE_SVC)
+ mov \scratch, #(CPSR_IF_MASK | ARM_MODE_SYS)
msr cpsr_c, \scratch
init_sys_pic_register
init_sys_stack
// Kernel command line variables and binding options
//
+//TODO: timeslice instead of tick_hz
static int tick_hz = 100;
static int serial_console_port = 0;
static int serial_debug_port = 1;
serial_console_init(serial_console_port);
// do not remove/change this printf: needed by regression harness
- // printf("Barrelfish CPU driver starting on ARMv5 Board id 0x%08"PRIx32"\n",
- // board_id);
- // printf("The address of paging_map_kernel_section is %p\n",
- // paging_map_kernel_section);
+ printf("Barrelfish CPU driver starting on ARMv7 Board id 0x%08"PRIx32"\n", board_id);
+ printf("The address of paging_map_kernel_section is %p\n", paging_map_kernel_section);
+
errval = serial_debug_init(serial_debug_port);
if (err_is_fail(errval))
{
printf("Failed to initialize debug port: %d", serial_debug_port);
}
- //lvaddr_t *foo = 0x0;
- //elf_file = *foo;
- // debug(SUBSYS_STARTUP, "alloc_top %08"PRIxLVADDR" %08"PRIxLVADDR"\n",
- // alloc_top, alloc_top - KERNEL_OFFSET);
- //debug(SUBSYS_STARTUP, "elf_file %08"PRIxLVADDR"\n", elf_file);
my_core_id = hal_get_cpu_id();
pit_init(tick_hz, 1);
tsc_init();
-
- //pit_start(0);
- //while(1) {}
-
ae = atag_find(atag_base, ATAG_MEM);
// Add unused physical memory to memory map
ARM_L1_SECTION_BYTES,
ae->u.mem.start + ae->u.mem.bytes);
- // phys_mmap_add(&phys_mmap,
- // ETABLE_ADDR - KERNEL_OFFSET + BASE_PAGE_SIZE,
- // ae->u.mem.start + ae->u.mem.bytes);
-
ae = atag_find(atag_base, ATAG_VIDEOLFB);
if (NULL != ae)
{
l1_table = (union l1_entry *) ttbase;
l1_table[ARM_L1_OFFSET(va)] = l1;
}
-/*
-inline static void
-paging_write_l2_entry(union l2_entry *l2_table, lvaddr_t va, union l2_entry l2)
-{
- l2_table[ARM_L2_OFFSET(va)] = l2;
-}
-*/
-
// ------------------------------------------------------------------------
// Exported functions
return dev_alloc;
}
-/*
-
-void
-paging_map_device_page(uintptr_t l1_table,
- lvaddr_t device_vbase,
- lpaddr_t device_pbase,
- size_t device_bytes)
-{
- assert(device_bytes <= BYTES_PER_PAGE);
- union l2_entry l2;
-
- l2.raw = 0;
- l2.small_page.type = L2_TYPE_SMALL_PAGE;
- l2.small_page.bufferable = 0;
- l2.small_page.cacheable = 0;
- l2.small_page.ap10 = 1; // RW/NA
- l2.small_page.ap2 = 0;
- l2.small_page.base_address = device_pbase >> BASE_PAGE_BITS;
-
- //get address to l2 table
- if (l1_table == 0) {
- l1_table = cp15_read_ttbr() + KERNEL_OFFSET;
- }
-
-
- paging_write_l2_entry((union l2_entry *) l2_table, device_vbase, l2);
-}
-*/
void paging_make_good(lvaddr_t new_table_base, size_t new_table_bytes)
{
e.page_table.domain = 0;
e.page_table.base_address = (pa >> 10);
- //uintptr_t* l1table = (uintptr_t*)table_base;
- //l1table[va / BYTES_PER_SECTION] = e.raw;
paging_write_l1_entry(table_base, va, e);
}
{
cp15_write_ttbr(ttbr);
cp15_invalidate_tlb();
+ //this isn't necessary on gem5, since gem5 doesn't implement the cache
+ //maintenance instructions, but ensures coherency by itself
//cp15_invalidate_i_and_d_caches();
}
}
STARTUP_PROGRESS();
- printf("XXX: Debug print to make Bram's code work\n");
+ //printf("XXX: Debug print to make Bram's code work\n");
paging_context_switch(mem_to_local_phys((lvaddr_t)init_l1));
const uint8_t* initrd_cpio_base = (uint8_t*)local_phys_to_mem(initrd_base);
- // if (!cpio_archive_valid(initrd_cpio_base, initrd_bytes))
- // {
- // panic("Invalid initrd filesystem\n");
- // }
+ if (!cpio_archive_valid(initrd_cpio_base, initrd_bytes))
+ {
+ panic("Invalid initrd filesystem\n");
+ }
spawn_init(BSP_INIT_MODULE_NAME, 0, initrd_cpio_base, initrd_bytes);
}
debug(SUBSYS_CAPS, "caps_retype: numobjs == 0\n");
return SYS_ERR_INVALID_SIZE_BITS;
}
- debug(SUBSYS_CAPS, "caps_retype: numobjs == %d\n", (int)numobjs);
+ // debug(SUBSYS_CAPS, "caps_retype: numobjs == %d\n", (int)numobjs);
/* check that destination slots all fit within target cnode */
if (dest_slot + numobjs > (1UL << dest_cnode->u.cnode.bits)) {
if (err == SYS_ERR_RETRY_THROUGH_MONITOR) {
return cap_delete_remote(caddr, vbits);
} else {
- if(err)
- printf("invoke_cnode_delete in capabilities.c failed\n");
return err;
}
}
errval_t err;
err = cap_delete(cap);
if (err_is_fail(err)) {
- printf("cap_delete in capabilities.c failed!\n");
return err;
}
err = cap_destroy(ram);
if (err_is_fail(err)) {
- printf("cap_destroy in capabilities.c failed!\n");
return err;
}
void *buf;
err = vspace_pinned_alloc(&buf, VREGION_LIST);
if (err_is_fail(err)) {
- printf("vspace pinned alloc fail!\n");
return err_push(err, LIB_ERR_VSPACE_PINNED_ALLOC);
}
slab_grow(&anon->vregion_slab, buf,
VSPACE_PINNED_UNIT * sizeof(struct vregion_list));
data = slab_alloc(&anon->vregion_slab);
if (!data) {
- printf("slab alloc fail!\n");
return LIB_ERR_SLAB_ALLOC_FAIL;
}
}
err = frame_alloc(&frame, BASE_PAGE_SIZE, NULL);
if (err_is_fail(err)) {
thread_mutex_unlock(&state->mutex);
- printf("frame alloc fail!\n");
return err_push(err, LIB_ERR_FRAME_ALLOC);
}
err = state->memobj.m.f.fill((struct memobj*)&state->memobj,
BASE_PAGE_SIZE);
if (err_is_fail(err)) {
thread_mutex_unlock(&state->mutex);
- printf("memobj fill fail!\n");
return err_push(err, LIB_ERR_MEMOBJ_FILL);
}
thread_mutex_unlock(&state->mutex);
if (buf == NULL) {
- printf("slab alloc fail!\n");
return LIB_ERR_SLAB_ALLOC_FAIL;
} else {
*retbuf = buf;
genvaddr_t address;
err = pmap->f.determine_addr(pmap, memobj, alignment, &address);
if (err_is_fail(err)) {
- printf("pmap fail!\n");
return err_push(err, LIB_ERR_PMAP_DETERMINE_ADDR);
}
// Add to the vspace
err = vspace_add_vregion(vspace, vregion);
if (err_is_fail(err)) {
- printf("vspace add vregion fail!\n");
return err_push(err, LIB_ERR_VSPACE_ADD_REGION);
}
// Add to memobj
err = memobj->f.map_region(memobj, vregion);
if (err_is_fail(err)) {
- printf("map region fail!\n");
return err_push(err, LIB_ERR_MEMOBJ_MAP_REGION);
}
# -- Misc
-#add-symbol-file arm/sbin/init 0x400000
+#add-symbol-file gem5/sbin/init 0x400000
#set kernel_log_subsystem_mask = 0x7fffffff
#break panic
#elif defined(__i386__)
# define MONITOR_NAME "x86_32/sbin/monitor"
# define MEM_SERV_NAME "x86_32/sbin/mem_serv"
+#elif defined(__GEM5__)
+# define MONITOR_NAME "gem5/sbin/monitor"
+# define MEM_SERV_NAME "gem5/sbin/mem_serv"
#elif defined(__arm__)
# define MONITOR_NAME "arm/sbin/monitor"
# define MEM_SERV_NAME "arm/sbin/mem_serv"