tz_vmm: make scenario reproducible by everyone

This commit is contained in:
Stefan Kalkowski 2013-11-27 17:12:39 +01:00 committed by Norman Feske
parent 23ce6dad50
commit c70bc350e8
6 changed files with 47 additions and 14 deletions

View File

@ -24,8 +24,8 @@ namespace Trustzone
SECURE_RAM_BASE = Genode::Board_base::RAM_3_BASE,
SECURE_RAM_SIZE = Genode::Board_base::RAM_3_SIZE - VM_STATE_SIZE,
VM_STATE_BASE = SECURE_RAM_BASE + SECURE_RAM_SIZE,
NONSECURE_RAM_BASE = Genode::Board_base::RAM_1_BASE,
NONSECURE_RAM_SIZE = 0x40000000,
NONSECURE_RAM_BASE = 0x80000000,
NONSECURE_RAM_SIZE = 0x20000000,
};
}

View File

@ -32,7 +32,7 @@ void Kernel::trustzone_initialization(Pic *pic)
pic->unsecure(34); //Timer 0/1
pic->unsecure(35); //Timer 2/3
pic->unsecure(36); //RTC
pic->unsecure(40); //UART3
pic->unsecure(37); //UART0
pic->unsecure(41); //MCI0
pic->unsecure(42); //MCI1
pic->unsecure(43); //AACI

View File

@ -36,6 +36,28 @@ install_config {
</config>
}
if {[have_spec platform_imx53]} {
set init_uri "http://genode.org/files/images/imx53_qsb/initrd.gz"
set linux_uri "http://genode.org/files/images/imx53_qsb/linux_trustzone.bin"
} elseif {[have_spec platform_vea9x4]} {
set init_uri "http://genode.org/files/images/vea9x4/initrd.gz"
set linux_uri "http://genode.org/files/images/vea9x4/linux_trustzone.bin"
}
if {![file exists bin/initrd.gz]} {
puts "Download initramfs ..."
exec >& /dev/null wget -c -O bin/initrd.gz $init_uri
}
if {![file exists bin/linux]} {
puts "Download linux binary ..."
exec >& /dev/null wget -c -O bin/linux $linux_uri
}
exec >& /dev/null wget -O bin/initrd.gz.md5 $init_uri.md5
exec >& /dev/null wget -O bin/linux.md5 $linux_uri.md5
cd bin
exec md5sum -c initrd.gz.md5
exec md5sum -c linux.md5
cd ..
build_boot_image "core init tz_vmm linux initrd.gz"
run_genode_until forever

View File

@ -33,9 +33,7 @@ enum {
};
static const char* cmdline_tablet =
"console=ttymxc0,115200 androidboot.console=ttymxc0 lpj=4997120 \
video=mxcdi1fb:RGB666,XGA gpu_memory=64M";
static const char* cmdline_tablet = "console=ttymxc0,115200";
namespace Vmm {
@ -47,6 +45,11 @@ class Vmm::Vmm : public Thread<8192>
{
private:
enum Devices {
FRAMEBUFFER,
INPUT,
};
Signal_receiver _sig_rcv;
Signal_context _vm_context;
Vm *_vm;
@ -57,6 +60,9 @@ class Vmm::Vmm : public Thread<8192>
{
/* check device number*/
switch (_vm->state()->r0) {
case FRAMEBUFFER:
case INPUT:
break;
default:
PERR("Unknown hypervisor call!");
_vm->dump();
@ -96,6 +102,7 @@ class Vmm::Vmm : public Thread<8192>
{
_vm->sig_handler(_sig_rcv.manage(&_vm_context));
_vm->start();
_vm->run();
while (true) {
Signal s = _sig_rcv.wait_for_signal();
@ -127,7 +134,7 @@ int main()
{
static Vm vm("linux", "initrd.gz", cmdline_tablet,
Trustzone::NONSECURE_RAM_BASE, Trustzone::NONSECURE_RAM_SIZE,
KERNEL_OFFSET, MACH_TYPE_TABLET, BOARD_REV_TABLET);
KERNEL_OFFSET, MACH_TYPE_QSB);
static Vmm::Vmm vmm(&vm);
PINF("Start virtual machine ...");

View File

@ -21,6 +21,7 @@
#include <rom_session/connection.h>
#include <vm_session/connection.h>
#include <dataspace/client.h>
#include <drivers/trustzone.h>
/* local includes */
#include <tsc_380.h>
@ -150,7 +151,9 @@ class Vmm::Vmm : public Thread<8192>
Signal_receiver sig_rcv;
Signal_context sig_cxt;
Signal_context_capability sig_cap(sig_rcv.manage(&sig_cxt));
_vm->start(sig_cap);
_vm->sig_handler(sig_cap);
_vm->start();
while (true) {
_vm->run();
Signal s = sig_rcv.wait_for_signal();
@ -168,7 +171,8 @@ class Vmm::Vmm : public Thread<8192>
Vmm(addr_t tsc_base, addr_t tpc_base,
addr_t sys_base, addr_t sp810_base,
Vm *vm)
: _tsc_io_mem(tsc_base, 0x1000),
: Thread<8192>("vmm"),
_tsc_io_mem(tsc_base, 0x1000),
_tpc_io_mem(tpc_base, 0x1000),
_sys_io_mem(sys_base, 0x1000),
_sp810_io_mem(sp810_base, 0x1000),
@ -187,13 +191,13 @@ int main()
SP810_VEA9X4_BASE = 0x10001000,
TPC_VEA9X4_BASE = 0x100e6000,
TSC_VEA9X4_BASE = 0x100ec000,
MAIN_MEM_START = 0x80000000,
MAIN_MEM_SIZE = 0x10000000,
MAIN_MEM_START = Trustzone::NONSECURE_RAM_BASE,
MAIN_MEM_SIZE = Trustzone::NONSECURE_RAM_SIZE,
KERNEL_OFFSET = 0x8000,
MACH_TYPE = 2272,
};
static const char* cmdline = "console=ttyAMA0,38400n8 root=/dev/ram0 lpj=1554432";
static const char* cmdline = "console=ttyAMA0,115200n8 root=/dev/ram0 lpj=1554432";
static Vm vm("linux", "initrd.gz", cmdline, MAIN_MEM_START, MAIN_MEM_SIZE,
KERNEL_OFFSET, MACH_TYPE);
static Vmm::Vmm vmm(TSC_VEA9X4_BASE, TPC_VEA9X4_BASE,

View File

@ -152,7 +152,7 @@ class Tsc_380 : Genode::Mmio
write<Region_attr<REGION15_REG_OFF>::Subreg2>(1);
write<Region_attr<REGION15_REG_OFF>::Subreg3>(1);
/* Access to UART3, and WDT */
/* Access to UART0, and WDT */
write<Region_low<REGION14_REG_OFF> >(0x10008000);
write<Region_high<REGION14_REG_OFF> >(0x10010000);
write<Region_attr<REGION14_REG_OFF>::Enable>(1);
@ -162,9 +162,9 @@ class Tsc_380 : Genode::Mmio
write<Region_attr<REGION14_REG_OFF>::Secure_read>(1);
write<Region_attr<REGION14_REG_OFF>::Secure_write>(1);
write<Region_attr<REGION14_REG_OFF>::Subreg0>(1);
write<Region_attr<REGION14_REG_OFF>::Subreg1>(1);
write<Region_attr<REGION14_REG_OFF>::Subreg2>(1);
write<Region_attr<REGION14_REG_OFF>::Subreg3>(1);
write<Region_attr<REGION14_REG_OFF>::Subreg4>(1);
write<Region_attr<REGION14_REG_OFF>::Subreg5>(1);
write<Region_attr<REGION14_REG_OFF>::Subreg6>(1);