From e6da68a2118c79b0a772fe6c29bb6747e9f31877 Mon Sep 17 00:00:00 2001 From: miod Date: Mon, 8 Apr 2024 20:00:27 +0000 Subject: [PATCH] Remove dead code and data, fix typos, kill wrong comments. ok kettenis@ --- sys/arch/sparc64/include/hypervisor.h | 3 +- sys/arch/sparc64/sparc64/hvcall.S | 12 +------- sys/arch/sparc64/sparc64/ipifuncs.c | 4 +-- sys/arch/sparc64/sparc64/locore.s | 43 ++++++--------------------- sys/arch/sparc64/sparc64/pmap.c | 4 +-- 5 files changed, 14 insertions(+), 52 deletions(-) diff --git a/sys/arch/sparc64/include/hypervisor.h b/sys/arch/sparc64/include/hypervisor.h index 3177c4dccc5..5d10f2d48b4 100644 --- a/sys/arch/sparc64/include/hypervisor.h +++ b/sys/arch/sparc64/include/hypervisor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hypervisor.h,v 1.20 2019/10/20 16:27:19 kettenis Exp $ */ +/* $OpenBSD: hypervisor.h,v 1.21 2024/04/08 20:00:27 miod Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -55,7 +55,6 @@ int64_t hv_cpu_myid(uint64_t *cpuid); int64_t hv_mmu_demap_page(vaddr_t vaddr, uint64_t context, uint64_t flags); int64_t hv_mmu_demap_ctx(uint64_t context, uint64_t flags); -int64_t hv_mmu_demap_all(uint64_t flags); int64_t hv_mmu_map_perm_addr(vaddr_t vaddr, uint64_t tte, uint64_t flags); int64_t hv_mmu_unmap_perm_addr(vaddr_t vaddr, uint64_t flags); int64_t hv_mmu_map_addr(vaddr_t vaddr, uint64_t context, uint64_t tte, diff --git a/sys/arch/sparc64/sparc64/hvcall.S b/sys/arch/sparc64/sparc64/hvcall.S index aec0c02ca63..8de6bb46de2 100644 --- a/sys/arch/sparc64/sparc64/hvcall.S +++ b/sys/arch/sparc64/sparc64/hvcall.S @@ -1,4 +1,4 @@ -/* $OpenBSD: hvcall.S,v 1.12 2019/10/20 16:27:19 kettenis Exp $ */ +/* $OpenBSD: hvcall.S,v 1.13 2024/04/08 20:00:27 miod Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -235,16 +235,6 @@ ENTRY(hv_mmu_demap_ctx) retl nop -ENTRY(hv_mmu_demap_all) - mov %o1, %o3 - mov %o0, %o2 - clr %o1 - clr %o0 - mov MMU_DEMAP_CTX, %o5 - ta FAST_TRAP - retl - nop - ENTRY(hv_mmu_map_perm_addr) mov %o2, %o3 mov %o1, %o2 diff --git a/sys/arch/sparc64/sparc64/ipifuncs.c b/sys/arch/sparc64/sparc64/ipifuncs.c index 0934b210e22..8ce3a66d299 100644 --- a/sys/arch/sparc64/sparc64/ipifuncs.c +++ b/sys/arch/sparc64/sparc64/ipifuncs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipifuncs.c,v 1.19 2019/08/06 18:06:32 kettenis Exp $ */ +/* $OpenBSD: ipifuncs.c,v 1.20 2024/04/08 20:00:27 miod Exp $ */ /* $NetBSD: ipifuncs.c,v 1.8 2006/10/07 18:11:36 rjs Exp $ */ /*- @@ -41,8 +41,6 @@ #define SPARC64_IPI_RETRIES 10000 -#define sparc64_ipi_sleep() delay(1000) - void sun4u_send_ipi(int, void (*)(void), u_int64_t, u_int64_t); void sun4u_broadcast_ipi(void (*)(void), u_int64_t, u_int64_t); void sun4v_send_ipi(int, void (*)(void), u_int64_t, u_int64_t); diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index aac1f9620f0..dd736bcc0cf 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.215 2024/04/08 19:59:57 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.216 2024/04/08 20:00:27 miod Exp $ */ /* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */ /* @@ -3325,8 +3325,6 @@ sun4v_texttrap: * will generate a bus error. Debugging the problem will be a bit * complicated since lots of register windows will be lost, but what * can we do? - * - * XXX The trap code generates SIGKILL for now. */ checkalign: rdpr %tl, %g2 @@ -3555,7 +3553,6 @@ softtrap: /* * syscall_setup() builds a trap frame and calls syscall(). - * sun_syscall is same but delivers sun system call number * XXX should not have to save&reload ALL the registers just for * ptrace... */ @@ -3601,7 +3598,7 @@ syscall_setup: /* see `proc_trampoline' for the reason for this label */ return_from_syscall: - wrpr %g0, PSTATE_KERN, %pstate ! Disable intterrupts + wrpr %g0, PSTATE_KERN, %pstate ! Disable interrupts wrpr %g0, 0, %tl ! Return to tl==0 ba,a,pt %icc, return_from_trap nop @@ -4232,12 +4229,12 @@ sparc_intr_retry: jmpl %l1, %o7 ! (*ih->ih_ack)(ih) mov %l2, %o0 0: - brnz,pn %l7, 2b ! 'Nother? + brnz,pn %l7, 2b ! Another? mov %l7, %l2 intrcmplt: /* - * Re-read SOFTINT to see if any new pending interrupts + * Re-read SOFTINT to see if there are any new pending interrupts * at this level. */ mov 1, %l3 ! Ack softint @@ -4281,7 +4278,7 @@ intrcmplt: .globl syscall /* - * Various return-from-trap routines (see return_from_trap). + * Various return-from-trap routines. */ /* @@ -4298,9 +4295,8 @@ intrcmplt: * When returning to user mode, the trap level does not matter, as it * will be set explicitly. * - * If we are returning to user code, we must: - * 1. Check for register windows in the pcb that belong on the stack. - * If there are any, reload them + * If we are returning to user code, we must check for register windows in + * the pcb that belong on the stack, and reload them, if there are any. */ return_from_trap: #ifdef DEBUG @@ -4527,8 +4523,7 @@ dump_dtlb: retl nop -#endif /* DDB */ /* DDB */ -#if defined(DDB) + .globl print_dtlb print_dtlb: save %sp, -CC64FSZ, %sp @@ -4568,7 +4563,7 @@ print_dtlb: 3: .asciz "%2d:%016lx %016lx\r\n" .text -#endif /* defined(DDB) */ +#endif /* DDB */ .align 8 dostart: @@ -4584,15 +4579,10 @@ dostart: * and the bootops vector in %o2. * * All we need to do is: - * * 1: Save the prom vector - * * 2: Create a decent stack for ourselves - * * 3: Install the permanent 4MB kernel mapping - * * 4: Call the C language initialization code - * */ /* @@ -5337,7 +5327,6 @@ ENTRY(_copyin) GET_CPCB(%o3) wr %g0, ASI_AIUS, %asi set Lcopyfault, %o4 -! mov %o7, %g7 ! save return address membar #Sync stx %o4, [%o3 + PCB_ONFAULT] cmp %o2, BCOPY_SMALL @@ -5518,18 +5507,11 @@ END(_copyin) * This is a modified version of bcopy that uses ASI_AIUS. When * bcopy is optimized to use block copy ASIs, this should be also. */ - /* - * This needs to be reimplemented to really do the copy. - */ ENTRY(copyout) - /* - * ******NOTE****** this depends on bcopy() not using %g7 - */ Ldocopy: GET_CPCB(%o3) wr %g0, ASI_AIUS, %asi set Lcopyfault, %o4 -! mov %o7, %g7 ! save return address membar #Sync stx %o4, [%o3 + PCB_ONFAULT] cmp %o2, BCOPY_SMALL @@ -5697,7 +5679,6 @@ Lcopyout_done: GET_CPCB(%o3) membar #Sync stx %g0, [%o3 + PCB_ONFAULT] -! jmp %g7 + 8 ! Original instr wr %g0, ASI_PRIMARY_NOFAULT, %asi ! Restore ASI membar #StoreStore|#StoreLoad retl ! New instr @@ -5721,9 +5702,6 @@ ENTRY(copyin32) END(copyin32) ! Copyin or copyout fault. Clear cpcb->pcb_onfault and return EFAULT. -! Note that although we were in bcopy, there is no state to clean up; -! the only special thing is that we have to return to [g7 + 8] rather than -! [o7 + 8]. Lcopyfault: GET_CPCB(%o3) stx %g0, [%o3 + PCB_ONFAULT] @@ -6154,8 +6132,6 @@ END(pseg_set) /* * memcpy(dst, src, len) - always copies forward. - * - * Must not use %g7 (see copyin/copyout above). */ ENTRY(memcpy) /* dest, src, size */ cmp %o2, BCOPY_SMALL! (check length for doublecopy first) @@ -7454,7 +7430,6 @@ proc0paddr: .xword u0 ! KVA of proc0 uarea #ifdef DEBUG - .comm trapdebug, 4 .comm pmapdebug, 4 #endif /* DEBUG */ diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c index 50c0a8fe975..246289702f4 100644 --- a/sys/arch/sparc64/sparc64/pmap.c +++ b/sys/arch/sparc64/sparc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.117 2024/03/30 07:45:21 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.118 2024/04/08 20:00:27 miod Exp $ */ /* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */ /* * @@ -2616,7 +2616,7 @@ ctx_free(struct pmap *pm) if (ctxbusy[oldctx] == 0) printf("ctx_free: freeing free context %d\n", oldctx); if (ctxbusy[oldctx] != pm->pm_physaddr) { - printf("ctx_free: freeing someone esle's context\n " + printf("ctx_free: freeing someone else's context\n " "ctxbusy[%d] = %p, pm(%p)->pm_ctx = %p\n", oldctx, (void *)(u_long)ctxbusy[oldctx], pm, (void *)(u_long)pm->pm_physaddr); -- 2.20.1