nova: export kernel messages via memory

Fixes #2207
This commit is contained in:
Alexander Boettcher 2016-05-28 20:54:24 +02:00 committed by Christian Helmuth
parent 38d5a5bf0e
commit 70028f8445
4 changed files with 48 additions and 8 deletions

View File

@ -91,6 +91,7 @@ namespace Nova {
struct Mem_desc
{
enum Type {
HYPERVISOR_LOG = -6,
FRAMEBUFFER = -5,
ACPI_XSDT = -4,
ACPI_RSDT = -3,

View File

@ -527,6 +527,9 @@ Platform::Platform() :
ram_alloc()->add_range(base, size);
}
uint64_t hyp_log = 0;
uint64_t hyp_log_size = 0;
/*
* Exclude all non-available memory from physical allocator AFTER all
* available RAM was added - otherwise the non-available memory gets not
@ -536,6 +539,14 @@ Platform::Platform() :
for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) {
if (mem_desc->type == Hip::Mem_desc::AVAILABLE_MEMORY) continue;
if (verbose_boot_info)
log("detected res memory: ", Hex(mem_desc->addr), " - size: ",
Hex(mem_desc->size), " type=", (int)mem_desc->type);
if (mem_desc->type == Hip::Mem_desc::HYPERVISOR_LOG) {
hyp_log = mem_desc->addr;
hyp_log_size = mem_desc->size;
}
/* skip regions above 4G on 32 bit, no op on 64 bit */
if (mem_desc->addr > ~0UL) continue;
@ -711,6 +722,11 @@ Platform::Platform() :
init_core_log( Core_log_range { core_local_addr, log_size } );
}
/* export hypervisor log memory */
if (hyp_log && hyp_log_size)
_rom_fs.insert(new (core_mem_alloc()) Rom_module(hyp_log, hyp_log_size,
"kernel_log"));
/* I/O port allocator (only meaningful for x86) */
_io_port_alloc.add_range(0, 0x10000);

View File

@ -12,11 +12,15 @@ proc log_service { } {
return ram
}
if {[have_spec nova]} {
proc kernel_output { } { return "novga logmem" }
}
build "core init drivers/timer server/vfs server/fs_log app/log_core"
create_boot_directory
install_config {
append config {
<config>
<parent-provides>
<service name="CPU"/>
@ -76,9 +80,28 @@ install_config {
<service name="CPU"> <parent/> </service>
<service name="LOG"> <parent/> </service>
</route>
</start>
</config>
}
</start>}
append_if [have_spec nova] config {
<start name="log_kernel">
<binary name="log_core"/>
<resource name="RAM" quantum="10M"/>
<config period_ms="2000"/>
<route>
<service name="ROM" unscoped_label="log_core"> <parent/> </service>
<service name="ROM" unscoped_label="ld.lib.so"> <parent/> </service>
<service name="ROM" label="log"> <parent label="kernel_log"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="PD"> <parent/> </service>
<service name="CPU"> <parent/> </service>
<service name="LOG"> <parent/> </service>
</route>
</start>}
append config {
</config>}
install_config $config
build_boot_image "core init timer ld.lib.so vfs fs_log log_core vfs.lib.so"

View File

@ -3,10 +3,10 @@ proc binary_name_core_o { } { return "core-nova.o" }
proc binary_name_timer { } { return "nova_timer_drv" }
proc kernel_files { } { return hypervisor }
proc kernel_output { } { return "novga serial" }
proc run_boot_string { } {
return "\n\r\fNOVA Microhypervisor"
return "\nHypervisor reports "
}
@ -126,7 +126,7 @@ proc run_boot_dir {binaries} {
puts $fh " insmod multiboot2"
puts $fh " insmod gzio"
puts $fh " multiboot2 /boot/bender $serial_bender_opt"
puts $fh " module2 /boot/hypervisor hypervisor iommu serial novpid novga"
puts $fh " module2 /boot/hypervisor hypervisor iommu novpid [kernel_output]"
puts $fh " module2 /boot/image.elf.gz image.elf"
puts $fh "}"
close $fh
@ -148,7 +148,7 @@ proc run_boot_dir {binaries} {
#
set fh [open "[run_dir]/config-52-54-00-12-34-56" "WRONLY CREAT TRUNC"]
puts $fh " exec /boot/bender"
puts $fh " load /boot/hypervisor iommu serial novpid novga"
puts $fh " load /boot/hypervisor iommu novpid [kernel_output]"
puts $fh " load /boot/image.elf"
close $fh