[arch][warnings] fix -Wmissing-declarations warnings
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include <arch/arm/cm.h>
|
||||
#include <platform.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
|
||||
static void dump_frame(const struct arm_cm_exception_frame *frame) {
|
||||
|
||||
printf("exception frame at %p\n", frame);
|
||||
|
||||
@@ -159,7 +159,6 @@ static inline void arm_cm_trigger_preempt(void) {
|
||||
|
||||
/* systick */
|
||||
void arm_cm_systick_init(uint32_t mhz);
|
||||
/* extern void _systick(void); // override this */
|
||||
|
||||
/* interrupt glue */
|
||||
/*
|
||||
@@ -169,5 +168,17 @@ void arm_cm_systick_init(uint32_t mhz);
|
||||
void arm_cm_irq_entry(void);
|
||||
void arm_cm_irq_exit(bool reschedule);
|
||||
|
||||
/* built in exception vectors */
|
||||
void _start(void);
|
||||
void _nmi(void);
|
||||
void _hardfault(void);
|
||||
void _memmanage(void);
|
||||
void _busfault(void);
|
||||
void _usagefault(void);
|
||||
void _svc(void);
|
||||
void _debugmonitor(void);
|
||||
void _pendsv(void);
|
||||
void _systick(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
*/
|
||||
#include <lk/debug.h>
|
||||
#include <lk/compiler.h>
|
||||
#include <lk/main.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* externals */
|
||||
extern unsigned int __data_start_rom, __data_start, __data_end;
|
||||
extern unsigned int __bss_start, __bss_end;
|
||||
|
||||
extern void lk_main(void) __NO_RETURN __EXTERNALLY_VISIBLE;
|
||||
|
||||
/* entry point of the binary */
|
||||
void _start(void);
|
||||
void _start(void) {
|
||||
/* copy data from rom */
|
||||
if (&__data_start != &__data_start_rom) {
|
||||
@@ -30,5 +31,5 @@ void _start(void) {
|
||||
while (bss != &__bss_end)
|
||||
*bss++ = 0;
|
||||
|
||||
lk_main();
|
||||
lk_main(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ void arch_init(void) {
|
||||
}
|
||||
|
||||
#if WITH_SMP
|
||||
void arm_secondary_entry(uint asm_cpu_num);
|
||||
void arm_secondary_entry(uint asm_cpu_num) {
|
||||
uint cpu = arch_curr_cpu_num();
|
||||
if (cpu != asm_cpu_num)
|
||||
|
||||
@@ -98,10 +98,12 @@ static void exception_die_iframe(struct arm_iframe *frame, const char *msg) {
|
||||
for (;;);
|
||||
}
|
||||
|
||||
void arm_syscall_handler(struct arm_fault_frame *frame);
|
||||
__WEAK void arm_syscall_handler(struct arm_fault_frame *frame) {
|
||||
exception_die(frame, "unhandled syscall, halting\n");
|
||||
}
|
||||
|
||||
void arm_undefined_handler(struct arm_iframe *frame);
|
||||
void arm_undefined_handler(struct arm_iframe *frame) {
|
||||
/* look at the undefined instruction, figure out if it's something we can handle */
|
||||
bool in_thumb = frame->spsr & (1<<5);
|
||||
@@ -149,6 +151,7 @@ fpu:
|
||||
#endif
|
||||
}
|
||||
|
||||
void arm_data_abort_handler(struct arm_fault_frame *frame);
|
||||
void arm_data_abort_handler(struct arm_fault_frame *frame) {
|
||||
struct fault_handler_table_entry *fault_handler;
|
||||
uint32_t fsr = arm_read_dfsr();
|
||||
@@ -215,6 +218,7 @@ void arm_data_abort_handler(struct arm_fault_frame *frame) {
|
||||
exception_die(frame, "halting\n");
|
||||
}
|
||||
|
||||
void arm_prefetch_abort_handler(struct arm_fault_frame *frame);
|
||||
void arm_prefetch_abort_handler(struct arm_fault_frame *frame) {
|
||||
uint32_t fsr = arm_read_ifsr();
|
||||
uint32_t far = arm_read_ifar();
|
||||
|
||||
@@ -53,12 +53,14 @@ status_t arch_mp_send_ipi(mp_cpu_mask_t target, mp_ipi_t ipi) {
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
enum handler_return arm_ipi_generic_handler(void *arg);
|
||||
enum handler_return arm_ipi_generic_handler(void *arg) {
|
||||
LTRACEF("cpu %u, arg %p\n", arch_curr_cpu_num(), arg);
|
||||
|
||||
return INT_NO_RESCHEDULE;
|
||||
}
|
||||
|
||||
enum handler_return arm_ipi_reschedule_handler(void *arg);
|
||||
enum handler_return arm_ipi_reschedule_handler(void *arg) {
|
||||
LTRACEF("cpu %u, arg %p\n", arch_curr_cpu_num(), arg);
|
||||
|
||||
|
||||
@@ -136,6 +136,8 @@ void arch_enter_uspace(vaddr_t entry_point, vaddr_t user_stack_top) {
|
||||
}
|
||||
|
||||
#if WITH_SMP
|
||||
/* called from assembly */
|
||||
void arm64_secondary_entry(ulong);
|
||||
void arm64_secondary_entry(ulong asm_cpu_num) {
|
||||
uint cpu = arch_curr_cpu_num();
|
||||
if (cpu != asm_cpu_num)
|
||||
|
||||
@@ -157,6 +157,7 @@ __WEAK void arm64_syscall(struct arm64_iframe_long *iframe, bool is_64bit) {
|
||||
panic("unhandled syscall vector\n");
|
||||
}
|
||||
|
||||
void arm64_sync_exception(struct arm64_iframe_long *iframe);
|
||||
void arm64_sync_exception(struct arm64_iframe_long *iframe) {
|
||||
struct fault_handler_table_entry *fault_handler;
|
||||
uint32_t esr = ARM64_READ_SYSREG(esr_el1);
|
||||
@@ -220,6 +221,7 @@ void arm64_sync_exception(struct arm64_iframe_long *iframe) {
|
||||
panic("die\n");
|
||||
}
|
||||
|
||||
void arm64_invalid_exception(struct arm64_iframe_long *iframe, unsigned int which);
|
||||
void arm64_invalid_exception(struct arm64_iframe_long *iframe, unsigned int which) {
|
||||
printf("invalid exception, which 0x%x\n", which);
|
||||
dump_iframe(iframe);
|
||||
|
||||
@@ -49,13 +49,13 @@ status_t arch_mp_send_ipi(mp_cpu_mask_t target, mp_ipi_t ipi) {
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
enum handler_return arm_ipi_generic_handler(void *arg) {
|
||||
static enum handler_return arm_ipi_generic_handler(void *arg) {
|
||||
LTRACEF("cpu %u, arg %p\n", arch_curr_cpu_num(), arg);
|
||||
|
||||
return INT_NO_RESCHEDULE;
|
||||
}
|
||||
|
||||
enum handler_return arm_ipi_reschedule_handler(void *arg) {
|
||||
static enum handler_return arm_ipi_reschedule_handler(void *arg) {
|
||||
LTRACEF("cpu %u, arg %p\n", arch_curr_cpu_num(), arg);
|
||||
|
||||
return mp_mbx_reschedule_irq();
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <lk/trace.h>
|
||||
#include <lk/debug.h>
|
||||
#include <stdint.h>
|
||||
#include <arch.h>
|
||||
#include <arch/ops.h>
|
||||
#include <arch/microblaze.h>
|
||||
|
||||
#define LOCAL_TRACE 0
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <lk/debug.h>
|
||||
#include <stdint.h>
|
||||
#include <lk/bits.h>
|
||||
#include <arch.h>
|
||||
#include <arch/mips.h>
|
||||
#include <platform.h>
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
extern enum handler_return platform_irq(struct mips_iframe *iframe, uint num);
|
||||
|
||||
void mips_gen_exception(struct mips_iframe *iframe);
|
||||
void mips_gen_exception(struct mips_iframe *iframe) {
|
||||
uint32_t excode = BITS_SHIFT(iframe->cause, 6, 2);
|
||||
if (excode == 0x8) {
|
||||
@@ -32,6 +33,7 @@ void mips_gen_exception(struct mips_iframe *iframe) {
|
||||
}
|
||||
}
|
||||
|
||||
void mips_irq(struct mips_iframe *iframe, uint num);
|
||||
void mips_irq(struct mips_iframe *iframe, uint num) {
|
||||
// unset IE and clear EXL
|
||||
mips_write_c0_status(mips_read_c0_status() & ~(3<<0));
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <lk/init.h>
|
||||
#include <lk/main.h>
|
||||
#include <platform.h>
|
||||
#include <arch.h>
|
||||
|
||||
#include "riscv_priv.h"
|
||||
|
||||
@@ -26,6 +27,7 @@ struct riscv_percpu percpu[SMP_MAX_CPUS];
|
||||
|
||||
// called extremely early from start.S prior to getting into any other C code on
|
||||
// both the boot cpu and the secondaries
|
||||
void riscv_configure_percpu_early(uint hart_id, uint __unused, uint cpu_num);
|
||||
void riscv_configure_percpu_early(uint hart_id, uint __unused, uint cpu_num) {
|
||||
// point tp reg at the current cpu structure
|
||||
riscv_set_percpu(&percpu[cpu_num]);
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
|
||||
#define LOCAL_TRACE 0
|
||||
|
||||
extern enum handler_return riscv_platform_irq(void);
|
||||
extern enum handler_return riscv_software_exception(void);
|
||||
|
||||
static const char *cause_to_string(long cause) {
|
||||
switch (cause) {
|
||||
case RISCV_EXCEPTION_IADDR_MISALIGN:
|
||||
@@ -84,6 +81,8 @@ void riscv_syscall_handler(struct riscv_short_iframe *frame) {
|
||||
platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
|
||||
}
|
||||
|
||||
// called from assembly
|
||||
void riscv_exception_handler(long cause, ulong epc, struct riscv_short_iframe *frame, bool kernel);
|
||||
void riscv_exception_handler(long cause, ulong epc, struct riscv_short_iframe *frame, bool kernel) {
|
||||
LTRACEF("hart %u cause %#lx epc %#lx status %#lx kernel %d\n",
|
||||
riscv_current_hart(), cause, epc, frame->status, kernel);
|
||||
|
||||
@@ -159,6 +159,8 @@
|
||||
__val; \
|
||||
})
|
||||
|
||||
#include <arch/riscv/iframe.h>
|
||||
|
||||
struct riscv_percpu {
|
||||
// must be first field in the struct
|
||||
struct thread *curr_thread;
|
||||
@@ -208,6 +210,9 @@ void riscv_set_secondary_count(int count);
|
||||
|
||||
void riscv_exception_entry(void);
|
||||
enum handler_return riscv_timer_exception(void);
|
||||
enum handler_return riscv_software_exception(void);
|
||||
enum handler_return riscv_platform_irq(void);
|
||||
void riscv_syscall_handler(struct riscv_short_iframe *frame);
|
||||
|
||||
// If using S mode, time seems to be implemented in clint.h
|
||||
// TODO: clean up by moving into its own header
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
#ifndef ASSEMBLY
|
||||
|
||||
#include <lk/compiler.h>
|
||||
#include <assert.h>
|
||||
|
||||
// keep in sync with asm.S
|
||||
struct riscv_short_iframe {
|
||||
unsigned long epc;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <arch/riscv/sbi.h>
|
||||
#include <kernel/vm.h>
|
||||
|
||||
#include "riscv_priv.h"
|
||||
|
||||
#define LOCAL_TRACE 0
|
||||
|
||||
#include <kernel/vm.h>
|
||||
|
||||
@@ -105,6 +105,8 @@ void riscv_configure_percpu_mp_early(uint hart_id, uint cpu_num) {
|
||||
wmb();
|
||||
}
|
||||
|
||||
// called from assembly
|
||||
void riscv_secondary_entry(uint hart_id, uint __unused, uint cpu_id);
|
||||
void riscv_secondary_entry(uint hart_id, uint __unused, uint cpu_id) {
|
||||
// basic bootstrapping of this cpu
|
||||
riscv_early_init_percpu();
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <lk/compiler.h>
|
||||
|
||||
__BEGIN_CDECLS
|
||||
|
||||
void riscv_early_init_percpu(void);
|
||||
void riscv_init_percpu(void);
|
||||
@@ -17,3 +20,4 @@ void riscv_early_mmu_init(void);
|
||||
void riscv_mmu_init(void);
|
||||
void riscv_mmu_init_secondaries(void);
|
||||
|
||||
__END_CDECLS
|
||||
|
||||
@@ -90,7 +90,7 @@ static inline map_addr_t get_pfn_from_pte(map_addr_t pte) {
|
||||
/**
|
||||
* @brief Returning the x86 arch flags from generic mmu flags
|
||||
*/
|
||||
arch_flags_t get_x86_arch_flags(arch_flags_t flags) {
|
||||
static arch_flags_t get_x86_arch_flags(arch_flags_t flags) {
|
||||
arch_flags_t arch_flags = 0;
|
||||
|
||||
if (!(flags & ARCH_MMU_FLAG_PERM_RO))
|
||||
@@ -112,7 +112,7 @@ arch_flags_t get_x86_arch_flags(arch_flags_t flags) {
|
||||
/**
|
||||
* @brief Returning the generic mmu flags from x86 arch flags
|
||||
*/
|
||||
uint get_arch_mmu_flags(arch_flags_t flags) {
|
||||
static uint get_arch_mmu_flags(arch_flags_t flags) {
|
||||
arch_flags_t mmu_flags = 0;
|
||||
|
||||
if (!(flags & X86_MMU_PG_RW))
|
||||
|
||||
@@ -141,7 +141,7 @@ static inline uint64_t get_pfn_from_pde(uint64_t pde) {
|
||||
/**
|
||||
* @brief Returning the x86 arch flags from generic mmu flags
|
||||
*/
|
||||
arch_flags_t get_x86_arch_flags(arch_flags_t flags) {
|
||||
static arch_flags_t get_x86_arch_flags(arch_flags_t flags) {
|
||||
arch_flags_t arch_flags = 0;
|
||||
|
||||
if (!(flags & ARCH_MMU_FLAG_PERM_RO))
|
||||
@@ -162,7 +162,7 @@ arch_flags_t get_x86_arch_flags(arch_flags_t flags) {
|
||||
/**
|
||||
* @brief Returning the generic mmu flags from x86 arch flags
|
||||
*/
|
||||
uint get_arch_mmu_flags(arch_flags_t flags) {
|
||||
static uint get_arch_mmu_flags(arch_flags_t flags) {
|
||||
arch_flags_t mmu_flags = 0;
|
||||
|
||||
if (!(flags & X86_MMU_PG_RW))
|
||||
|
||||
@@ -69,24 +69,24 @@ static void exception_die(x86_iframe_t *frame, const char *msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void x86_syscall_handler(x86_iframe_t *frame) {
|
||||
static void x86_syscall_handler(x86_iframe_t *frame) {
|
||||
exception_die(frame, "unhandled syscall, halting\n");
|
||||
}
|
||||
|
||||
void x86_gpf_handler(x86_iframe_t *frame) {
|
||||
static void x86_gpf_handler(x86_iframe_t *frame) {
|
||||
exception_die(frame, "unhandled gpf, halting\n");
|
||||
}
|
||||
|
||||
void x86_invop_handler(x86_iframe_t *frame) {
|
||||
static void x86_invop_handler(x86_iframe_t *frame) {
|
||||
exception_die(frame, "unhandled invalid op, halting\n");
|
||||
}
|
||||
|
||||
void x86_unhandled_exception(x86_iframe_t *frame) {
|
||||
static void x86_unhandled_exception(x86_iframe_t *frame) {
|
||||
printf("vector %u\n", (uint)frame->vector);
|
||||
exception_die(frame, "unhandled exception, halting\n");
|
||||
}
|
||||
|
||||
void x86_pfe_handler(x86_iframe_t *frame) {
|
||||
static void x86_pfe_handler(x86_iframe_t *frame) {
|
||||
/* Handle a page fault exception */
|
||||
uint32_t error_code;
|
||||
thread_t *current_thread;
|
||||
@@ -150,7 +150,8 @@ void x86_pfe_handler(x86_iframe_t *frame) {
|
||||
}
|
||||
}
|
||||
|
||||
/* top level x86 exception handler for most exceptions and irqs */
|
||||
/* top level x86 exception handler for most exceptions and irqs, called from asm */
|
||||
void x86_exception_handler(x86_iframe_t *frame);
|
||||
void x86_exception_handler(x86_iframe_t *frame) {
|
||||
// get the current vector
|
||||
unsigned int vector = frame->vector;
|
||||
|
||||
@@ -132,6 +132,11 @@ status_t x86_mmu_check_mapping (addr_t pml4, paddr_t paddr,
|
||||
vaddr_t vaddr, arch_flags_t in_flags,
|
||||
uint32_t *ret_level, arch_flags_t *ret_flags,
|
||||
map_addr_t *last_valid_entry);
|
||||
#else
|
||||
status_t x86_mmu_check_mapping(map_addr_t init_table, map_addr_t paddr,
|
||||
vaddr_t vaddr, arch_flags_t in_flags,
|
||||
uint32_t *ret_level, arch_flags_t *ret_flags,
|
||||
map_addr_t *last_valid_entry);
|
||||
#endif
|
||||
|
||||
status_t x86_mmu_get_mapping(map_addr_t init_table, vaddr_t vaddr, uint32_t *ret_level,
|
||||
|
||||
Reference in New Issue
Block a user