Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions so3/arch/arm64/exception.S
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ ENTRY(pre_ret_to_el1_with_spin)
// Set the CPU in EL1 mode to proceed with
// the bootstrap of the domain

mov x2, #PSR_MODE_EL1t
mov x2, #PSR_MODE_EL1h

// Make sure no interrupt coming from CPU #0 is
// interferring with other CPU bootstrap
Expand Down Expand Up @@ -271,7 +271,7 @@ ENTRY(pre_ret_to_el1)
// Set the CPU in EL1 mode to proceed with
// the bootstrap of the domain

mov x2, #PSR_MODE_EL1t
mov x2, #PSR_MODE_EL1h

// Make sure no interrupt coming from CPU #0 is
// interferring with other CPU bootstrap
Expand Down
2 changes: 1 addition & 1 deletion so3/arch/arm64/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ install_el2_stub:
msr vbar_el2, x0

/* spsr */
mov x0, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT | PSR_MODE_EL1t)
mov x0, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT | PSR_MODE_EL1h)
msr spsr_el2, x0
msr elr_el2, lr
mov w0, #BOOT_CPU_MODE_EL2 // This CPU booted in EL2
Expand Down
8 changes: 6 additions & 2 deletions so3/arch/arm64/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include <asm/mmu.h>
#include <asm/cacheflush.h>

/* We disable these logs here because the UART is difficult to manage during the I/O re-mapping. */
#undef LOG_DEBUG
#define LOG_DEBUG(fmt, ...)

void *__current_pgtable = NULL;

void *current_pgtable(void)
Expand Down Expand Up @@ -675,8 +679,8 @@ void mmu_configure(addr_t fdt_addr)

/* Early mapping I/O for UART. Here, the UART is supposed to be in a different L1 entry than the RAM. */
#ifdef CONFIG_VA_BITS_48
__sys_idmap_l1pgtable[l1pte_index(CONFIG_UART_LL_PADDR)] = CONFIG_UART_LL_PADDR & TTB_L1_BLOCK_ADDR_MASK;
set_pte_block(&__sys_idmap_l1pgtable[l1pte_index(CONFIG_UART_LL_PADDR)], DCACHE_OFF);
__sys_idmap_l1pgtable[l1pte_index(CONFIG_UART_LL_PADDR)] = CONFIG_UART_LL_PADDR & TTB_L1_BLOCK_ADDR_MASK;
set_pte_block(&__sys_idmap_l1pgtable[l1pte_index(CONFIG_UART_LL_PADDR)], DCACHE_OFF);
Comment on lines -678 to +683
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think clang-format isn't liking that change, as it is whitespace only, easy fix would be to revert.

That function indentation is a bit weird because of the #ifdef CONFIG_AVZ which can add or not one level of indentation. So another possible fix would be to correct indentation for the function and add /* clang-format off */ and /* clang-format on */ arround of the function, so clang-format doesn't complain about it.

#elif CONFIG_VA_BITS_39
__sys_root_pgtable[l1pte_index(CONFIG_UART_LL_PADDR)] = CONFIG_UART_LL_PADDR & TTB_L1_BLOCK_ADDR_MASK;
set_pte_block(&__sys_root_pgtable[l1pte_index(CONFIG_UART_LL_PADDR)], DCACHE_OFF);
Expand Down
7 changes: 6 additions & 1 deletion so3/arch/arm64/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ typedef void (*vector_fn_t)(cpu_regs_t *);

void trap_handle(cpu_regs_t *regs)
{
int ret = 0;

#ifndef CONFIG_AVZ
syscall_args_t sys_args;
#endif
Expand All @@ -141,7 +143,9 @@ void trap_handle(cpu_regs_t *regs)
switch (ESR_ELx_EC(esr)) {
case ESR_ELx_EC_DABT_LOW:

dabt_handle(regs, esr);
ret = dabt_handle(regs, esr);
if (ret == -1)
goto __err;
break;

/* SVC used for syscalls */
Expand Down Expand Up @@ -247,6 +251,7 @@ void trap_handle(cpu_regs_t *regs)
#endif

default:
__err:
lprintk("### On CPU %d: ESR_Elx_EC(esr): 0x%lx\n", smp_processor_id(), ESR_ELx_EC(esr));
trap_handle_error(regs->lr);
kernel_panic();
Expand Down
3 changes: 2 additions & 1 deletion so3/kernel/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ void schedule(void)
LOG_DEBUG("Now scheduling thread ID: %d name: %s PID: %d prio: %d\n", next->tid, next->name,
((next->pcb != NULL) ? next->pcb->pid : -1), next->prio);
if (prev)
LOG_DEBUG("Previous was threadID: %d name: %s PID: %d\n", prev->tid, prev->name);
LOG_DEBUG("Previous was threadID: %d name: %s PID: %d\n", prev->tid, prev->name,
(next->pcb != NULL) ? next->pcb->pid : -1);

/*
* The current threads (here prev) can be in different states, not only running; it may be in *waiting* or *zombie*
Expand Down
9 changes: 7 additions & 2 deletions so3/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ static uint32_t kernel_size;
/* Current available I/O range address */
struct list_head io_maplist;

/**
* @brief This function is called early during the bootstrap by head.S
* There is no MMU activated and all adresses are physical.
* DO NOT PRINT ANYTHING IN THIS FUNCTION.
*
* @param fdt_paddr
*/
void early_memory_init(void *fdt_paddr)
{
int offset;
Expand All @@ -65,8 +72,6 @@ void early_memory_init(void *fdt_paddr)
__fdt_addr = (void *) __va(fdt_paddr);
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also remove this line for clang-format. (no empty line at the end of a function)

if (offset >= 0)
LOG_DEBUG("Found %d MB of RAM at 0x%08X", mem_info.size / SZ_1M, mem_info.phys_base);
}

uint32_t get_kernel_size(void)
Expand Down
10 changes: 9 additions & 1 deletion usr/lib/libc/exit/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ weak_alias(libc_exit_fini, __libc_exit_fini);

_Noreturn void exit(int code)
{
#warning exit() issue
/*
* Currently, the following code leads to data abort fault randomly. The effect
* is visible on RPi4 (64-bit) more rarely on virt64
*/
#if 0
__funcs_on_exit();
__libc_exit_fini();
__libc_exit_fini();
__stdio_exit();
#endif /* 0 */

_Exit(code);
}
Loading