diff options
Diffstat (limited to 'sys/arm64/arm64/machdep.c')
-rw-r--r-- | sys/arm64/arm64/machdep.c | 114 |
1 files changed, 105 insertions, 9 deletions
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index f67211f..bfdbb27 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -26,6 +26,7 @@ */ #include "opt_platform.h" +#include "opt_ddb.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -180,7 +181,7 @@ fill_fpregs(struct thread *td, struct fpreg *regs) * If we have just been running VFP instructions we will * need to save the state to memcpy it below. */ - vfp_save_state(td); + vfp_save_state(td, pcb); memcpy(regs->fp_q, pcb->pcb_vfp, sizeof(regs->fp_q)); regs->fp_cr = pcb->pcb_fpcr; @@ -209,21 +210,21 @@ int fill_dbregs(struct thread *td, struct dbreg *regs) { - panic("fill_dbregs"); + panic("ARM64TODO: fill_dbregs"); } int set_dbregs(struct thread *td, struct dbreg *regs) { - panic("set_dbregs"); + panic("ARM64TODO: set_dbregs"); } int ptrace_set_pc(struct thread *td, u_long addr) { - panic("ptrace_set_pc"); + panic("ARM64TODO: ptrace_set_pc"); return (0); } @@ -314,7 +315,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp) * If we have just been running VFP instructions we will * need to save the state to memcpy it below. */ - vfp_save_state(td); + vfp_save_state(td, curpcb); memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_vfp, sizeof(mcp->mc_fpregs)); @@ -376,7 +377,11 @@ void cpu_halt(void) { - panic("cpu_halt"); + /* We should have shutdown by now, if not enter a low power sleep */ + intr_disable(); + while (1) { + __asm __volatile("wfi"); + } } /* @@ -387,7 +392,7 @@ void cpu_flush_dcache(void *ptr, size_t len) { - /* TBD */ + /* ARM64TODO TBD */ } /* Get current clock frequency for the given CPU ID. */ @@ -395,7 +400,7 @@ int cpu_est_clockrate(int cpu_id, uint64_t *rate) { - panic("cpu_est_clockrate"); + panic("ARM64TODO: cpu_est_clockrate"); } void @@ -818,8 +823,13 @@ initarm(struct arm64_bootparams *abp) /* Print the memory map */ mem_len = 0; - for (i = 0; i < physmap_idx; i += 2) + for (i = 0; i < physmap_idx; i += 2) { + dump_avail[i] = physmap[i]; + dump_avail[i + 1] = physmap[i + 1]; mem_len += physmap[i + 1] - physmap[i]; + } + dump_avail[i] = 0; + dump_avail[i + 1] = 0; /* Set the pcpu data, this is needed by pmap_bootstrap */ pcpup = &__pcpu[0]; @@ -859,3 +869,89 @@ initarm(struct arm64_bootparams *abp) early_boot = 0; } +#ifdef DDB +#include <ddb/ddb.h> + +DB_SHOW_COMMAND(specialregs, db_show_spregs) +{ +#define PRINT_REG(reg) \ + db_printf(__STRING(reg) " = %#016lx\n", READ_SPECIALREG(reg)) + + PRINT_REG(actlr_el1); + PRINT_REG(afsr0_el1); + PRINT_REG(afsr1_el1); + PRINT_REG(aidr_el1); + PRINT_REG(amair_el1); + PRINT_REG(ccsidr_el1); + PRINT_REG(clidr_el1); + PRINT_REG(contextidr_el1); + PRINT_REG(cpacr_el1); + PRINT_REG(csselr_el1); + PRINT_REG(ctr_el0); + PRINT_REG(currentel); + PRINT_REG(daif); + PRINT_REG(dczid_el0); + PRINT_REG(elr_el1); + PRINT_REG(esr_el1); + PRINT_REG(far_el1); + PRINT_REG(fpcr); + PRINT_REG(fpsr); + PRINT_REG(id_aa64afr0_el1); + PRINT_REG(id_aa64afr1_el1); + PRINT_REG(id_aa64dfr0_el1); + PRINT_REG(id_aa64dfr1_el1); + PRINT_REG(id_aa64isar0_el1); + PRINT_REG(id_aa64isar1_el1); + PRINT_REG(id_aa64pfr0_el1); + PRINT_REG(id_aa64pfr1_el1); + PRINT_REG(id_afr0_el1); + PRINT_REG(id_dfr0_el1); + PRINT_REG(id_isar0_el1); + PRINT_REG(id_isar1_el1); + PRINT_REG(id_isar2_el1); + PRINT_REG(id_isar3_el1); + PRINT_REG(id_isar4_el1); + PRINT_REG(id_isar5_el1); + PRINT_REG(id_mmfr0_el1); + PRINT_REG(id_mmfr1_el1); + PRINT_REG(id_mmfr2_el1); + PRINT_REG(id_mmfr3_el1); +#if 0 + /* Missing from llvm */ + PRINT_REG(id_mmfr4_el1); +#endif + PRINT_REG(id_pfr0_el1); + PRINT_REG(id_pfr1_el1); + PRINT_REG(isr_el1); + PRINT_REG(mair_el1); + PRINT_REG(midr_el1); + PRINT_REG(mpidr_el1); + PRINT_REG(mvfr0_el1); + PRINT_REG(mvfr1_el1); + PRINT_REG(mvfr2_el1); + PRINT_REG(revidr_el1); + PRINT_REG(sctlr_el1); + PRINT_REG(sp_el0); + PRINT_REG(spsel); + PRINT_REG(spsr_el1); + PRINT_REG(tcr_el1); + PRINT_REG(tpidr_el0); + PRINT_REG(tpidr_el1); + PRINT_REG(tpidrro_el0); + PRINT_REG(ttbr0_el1); + PRINT_REG(ttbr1_el1); + PRINT_REG(vbar_el1); +#undef PRINT_REG +} + +DB_SHOW_COMMAND(vtop, db_show_vtop) +{ + uint64_t phys; + + if (have_addr) { + phys = arm64_address_translate_s1e1r(addr); + db_printf("Physical address reg: 0x%016lx\n", phys); + } else + db_printf("show vtop <virt_addr>\n"); +} +#endif |