fix: unify boot code

This commit is contained in:
Mark Poliakov 2021-10-11 18:54:36 +03:00
parent bc3a2ddf99
commit f9d7af1744
9 changed files with 18 additions and 29 deletions

View File

@ -26,7 +26,7 @@ $(error TODO)
else
ifeq ($(MACH),qemu)
QEMU_OPTS+=-kernel $(O)/kernel \
-M virt,virtualization=off \
-M virt,virtualization=on \
-cpu cortex-a72 \
-m 512 \
-serial chardev:serial0 \

View File

@ -31,18 +31,14 @@ SECTIONS {
}
. = ALIGN(4K);
.tables : AT(. - KERNEL_OFFSET) {
*(.tables)
}
. = ALIGN(4K);
PROVIDE(__bss_start_phys = . - KERNEL_OFFSET);
PROVIDE(__bss_start = .);
.bss : AT(. - KERNEL_OFFSET) {
PROVIDE(__bss_start = .);
*(COMMON)
*(.bss*)
. = ALIGN(4K);
PROVIDE(__bss_end = .);
}
PROVIDE(__bss_end_phys = . - KERNEL_OFFSET);
PROVIDE(__kernel_end = .);
}

View File

@ -13,7 +13,13 @@ _entry:
b 1b
2:
// TODO leave EL2 if running in it
mrs x0, currentel
cmp x0, #8
bne 1f
b .
1:
// TODO zero .bss

View File

@ -4,8 +4,8 @@ use crate::arch::{aarch64::asm::CPACR_EL1, machine};
use crate::dev::{Device, fdt::DeviceTree};
use crate::mem::virt;
use cortex_a::asm::barrier::{self, dsb, isb};
use cortex_a::registers::{DAIF, SCTLR_EL1, VBAR_EL1, CurrentEL};
use tock_registers::interfaces::{ReadWriteable, Writeable, Readable};
use cortex_a::registers::{DAIF, SCTLR_EL1, VBAR_EL1};
use tock_registers::interfaces::{ReadWriteable, Writeable};
#[no_mangle]
extern "C" fn __aa64_bsp_main(fdt_base: usize) {
@ -57,13 +57,5 @@ extern "C" fn __aa64_bsp_main(fdt_base: usize) {
}
global_asm!(include_str!("macros.S"));
cfg_if! {
if #[cfg(feature = "mach_orangepi3")] {
global_asm!(include_str!("uboot.S"));
} else {
global_asm!(include_str!("entry.S"));
}
}
global_asm!(include_str!("uboot.S"));
global_asm!(include_str!("upper.S"));

View File

@ -77,8 +77,3 @@ __aa64_entry_upper:
bsp_stack_bottom:
.skip 32768
bsp_stack_top:
.section .data
.p2align 4
fdt_base_phys:
.skip 8

View File

@ -67,7 +67,6 @@ extern "C" fn __aa64_exc_irq_handler() {
#[no_mangle]
extern "C" fn __aa64_exc_sync_handler(exc: &mut ExceptionFrame) {
loop {}
let err_code = exc.esr >> 26;
let iss = exc.esr & 0x1FFFFFF;

View File

@ -57,8 +57,8 @@ impl Device for Gic {
let gicd_mmio_banked = DeviceMemoryIo::new(gicd_mmio);
let gicc_mmio = DeviceMemoryIo::map("GICv2 CPU registers", self.gicc_base, 1)?;
let mut gicd = Gicd::new(gicd_mmio_shared, gicd_mmio_banked);
let mut gicc = Gicc::new(gicc_mmio);
let gicd = Gicd::new(gicd_mmio_shared, gicd_mmio_banked);
let gicc = Gicc::new(gicc_mmio);
gicd.enable();
gicc.enable();

View File

@ -14,6 +14,7 @@ static mut INDEX_BUFFER: Wrap = Wrap { data: [0; 65536] };
type INode<'a> = DevTreeIndexNode<'a, 'a, 'a>;
#[allow(dead_code)]
pub struct DeviceTree {
tree: DevTree<'static>,
index: DevTreeIndex<'static, 'static>,

View File

@ -80,7 +80,7 @@ impl Device for Pl031 {
}
unsafe fn enable(&self) -> Result<(), Errno> {
let mut inner = Pl031Inner {
let inner = Pl031Inner {
regs: DeviceMemoryIo::map(self.name(), self.base, 1)?,
};