Skip to content

Commit

Permalink
Functions which use curr_vm now makes a function call to determine wh…
Browse files Browse the repository at this point in the history
…ich core they are running on instead of referring to a shared curr_vm
  • Loading branch information
didriklundberg committed Aug 6, 2015
1 parent 78a43d9 commit 498293b
Show file tree
Hide file tree
Showing 14 changed files with 690 additions and 587 deletions.
20 changes: 15 additions & 5 deletions core/hw/cpu/arm/arm_common/arm_pt.S
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
* ARM pagetable functions including the initial setup
*/

.global arm_setup_initial_pt
.global arm_setup_initial_slave_pt
.global arm_setup_initial_pt_slave
.global arm_reset_initial_pt

.code 32
Expand Down Expand Up @@ -52,7 +51,11 @@ arm_setup_initial_pt_slave:
* later).
*/

mov r0, =(__hyper_pt_start_slave__ + HAL_OFFSET)
/*mov r0, = #(__hyper_pt_start_slave__ + HAL_OFFSET)*/
ldr r0, =__hyper_pt_start_slave__
ldr r1, =HAL_OFFSET
add r0, r0, r1

mov r1, #0
add r2, r0, #0x4000

Expand All @@ -68,7 +71,10 @@ arm_setup_initial_pt_slave:


arm_reset_initial_pt:
ldr r4, = (__hyper_pt_start__ + HAL_OFFSET)
ldr r4, =__hyper_pt_start__
ldr r1, =HAL_OFFSET
add r4, r4, r1

mcr p15, 0, r4, c2, c0, 0 @ load page table pointer
bx lr

Expand All @@ -78,7 +84,11 @@ arm_setup_initial_pt:
*/


mov r0, =(__hyper_pt_start__ + HAL_OFFSET)
/* mov r0, = #(__hyper_pt_start__ + HAL_OFFSET) */
ldr r0, =__hyper_pt_start__
ldr r1, =HAL_OFFSET
add r0, r0, r1

mov r1, #0
add r2, r0, #0x4000

Expand Down
15 changes: 8 additions & 7 deletions core/hw/cpu/arm/arm_common/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
#include "guest_blob.h"
#include <cache.h>

extern virtual_machine *curr_vm;
extern virtual_machine* get_curr_vm();

void start(){
uint32_t r3 = curr_vm->mode_states[HC_GM_KERNEL].ctx.reg[3];
uint32_t r4 = curr_vm->mode_states[HC_GM_KERNEL].ctx.reg[4];
uint32_t r5 = curr_vm->mode_states[HC_GM_KERNEL].ctx.reg[5];
uint32_t r6 = curr_vm->mode_states[HC_GM_KERNEL].ctx.reg[6];
addr_t start = curr_vm->config->firmware->vstart + curr_vm->config->guest_entry_offset;
virtual_machine* _curr_vm = get_curr_vm();
uint32_t r3 = _curr_vm->mode_states[HC_GM_KERNEL].ctx.reg[3];
uint32_t r4 = _curr_vm->mode_states[HC_GM_KERNEL].ctx.reg[4];
uint32_t r5 = _curr_vm->mode_states[HC_GM_KERNEL].ctx.reg[5];
uint32_t r6 = _curr_vm->mode_states[HC_GM_KERNEL].ctx.reg[6];
addr_t start = _curr_vm->config->firmware->vstart + _curr_vm->config->guest_entry_offset;
#ifdef LINUX
start = curr_vm->config->firmware->pstart + curr_vm->config->guest_entry_offset;
start = _curr_vm->config->firmware->pstart + _curr_vm->config->guest_entry_offset;
#endif

printf("Branching to address: %x\n", start);
Expand Down
28 changes: 14 additions & 14 deletions core/hw/ld/virt-hyper.ld
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,7 @@ SECTIONS
/* Heap: up to 104 KiB */
__hyper_heap_start__ = .;
. = 0xf0100000 - 1024 * (64 + 32 + 8);
__hyper_heap_end__ = .;

/* Primary stack (for core 0) */
__hyper_stack_bottom__ = .;
. += 1024 * 8;
__hyper_stack_top__ = .;
__hyper_heap_end__ = .;

/* Guest (running on core 0) */
__hyper_guest_start__ = .;
Expand All @@ -89,25 +84,30 @@ SECTIONS
. += 1024 * 64;
__hyper_pt_end__ = .;

/* Secondary stack (for core 1)
/* Primary stack (for core 0) TODO: Moved this to here, from between Heap and Guest above. */
__hyper_stack_bottom__ = .;
. += 1024 * 8;
__hyper_stack_top__ = .;

/* Secondary stack (for core 1) */
__hyper_stack_bottom_core_1__ = .;
. += 1024 * 8;
__hyper_stack_top_core_1__ = .; */
__hyper_stack_top_core_1__ = .;

/* Tertiary stack (for core 2)
/* Tertiary stack (for core 2) */
__hyper_stack_bottom_core_2__ = .;
. += 1024 * 8;
__hyper_stack_top_core_2__ = .;
__hyper_stack_top_core_2__ = .;

/* Quaternary stack (for core 3)
/* Quaternary stack (for core 3) */
__hyper_stack_bottom_core_3__ = .;
. += 1024 * 8;
__hyper_stack_top_core_3__ = .; */
__hyper_stack_top_core_3__ = .;

/* Secondary (slave) PT memory (only needed to run guests on different cores)
/* Secondary (slave) PT memory (only needed to run guests on different cores) */
__hyper_pt_start_slave__ = .;
. += 1024 * 64;
__hyper_pt_end_slave__ = .; */
__hyper_pt_end_slave__ = .;

__hyper_end__ = .;

Expand Down
Loading

0 comments on commit 498293b

Please sign in to comment.