Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha - Expose alpha_fp_complete_at() to callers ou...



details:   https://anonhg.NetBSD.org/src/rev/299f83824f40
branches:  trunk
changeset: 1022506:299f83824f40
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Jul 23 03:50:32 2021 +0000

description:
- Expose alpha_fp_complete_at() to callers outside fp_complete.c.
- Use ufetch_32() instead of copyin() to fetch the instruction.

diffstat:

 sys/arch/alpha/alpha/fp_complete.c |  22 +++++++++++-----------
 sys/arch/alpha/include/alpha.h     |   3 ++-
 2 files changed, 13 insertions(+), 12 deletions(-)

diffs (99 lines):

diff -r 91bdc4baa412 -r 299f83824f40 sys/arch/alpha/alpha/fp_complete.c
--- a/sys/arch/alpha/alpha/fp_complete.c        Fri Jul 23 02:35:14 2021 +0000
+++ b/sys/arch/alpha/alpha/fp_complete.c        Fri Jul 23 03:50:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fp_complete.c,v 1.25 2021/07/22 01:39:18 thorpej Exp $ */
+/* $NetBSD: fp_complete.c,v 1.26 2021/07/23 03:50:32 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.25 2021/07/22 01:39:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.26 2021/07/23 03:50:32 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -522,13 +522,13 @@
  */
 
 static void
-print_fp_instruction(alpha_instruction *pc, struct lwp *l, uint32_t bits)
+print_fp_instruction(unsigned long pc, struct lwp *l, uint32_t bits)
 {
 #if defined(DDB)
        char buf[32];
        struct alpha_print_instruction_context ctx = {
                .insn.bits = bits,
-               .pc = (unsigned long)pc,
+               .pc = pc,
                .buf = buf,
                .bufsize = sizeof(buf),
        };
@@ -553,7 +553,7 @@
 }
 
 static void
-alpha_fp_interpret(alpha_instruction *pc, struct lwp *l, uint32_t bits)
+alpha_fp_interpret(unsigned long pc, struct lwp *l, uint32_t bits)
 {
        s_float sfa, sfb, sfc;
        t_float tfa, tfb, tfc;
@@ -624,16 +624,15 @@
        }
 }
 
-static int
-alpha_fp_complete_at(alpha_instruction *trigger_pc, struct lwp *l,
-    uint64_t *ucode)
+int
+alpha_fp_complete_at(unsigned long trigger_pc, struct lwp *l, uint64_t *ucode)
 {
        int needsig;
        alpha_instruction inst;
        uint64_t rm, fpcr, orig_fpcr;
        uint64_t orig_flags, new_flags, changed_flags, md_flags;
 
-       if (__predict_false(copyin(trigger_pc, &inst, sizeof inst))) {
+       if (__predict_false(ufetch_32((void *)trigger_pc, &inst.bits))) {
                this_cannot_happen(6, -1);
                return SIGSEGV;
        }
@@ -712,7 +711,8 @@
        if (cpu_amask & ALPHA_AMASK_PAT) {
                if ((a0 & (ALPHA_AESR_SWC | ALPHA_AESR_INV)) != 0 ||
                    alpha_fp_sync_complete) {
-                       sig = alpha_fp_complete_at(trigger_pc, l, ucode);
+                       sig = alpha_fp_complete_at((u_long)trigger_pc, l,
+                           ucode);
                        goto resolved;
                }
        }
@@ -773,7 +773,7 @@
                alpha_shadow.max = t;
        if (__predict_true(trigger_pc != 0 && a1 == 0)) {
                ++alpha_shadow.resolved;
-               sig = alpha_fp_complete_at(trigger_pc, l, ucode);
+               sig = alpha_fp_complete_at((u_long)trigger_pc, l, ucode);
                goto resolved;
        } else {
                ++alpha_shadow.unresolved;
diff -r 91bdc4baa412 -r 299f83824f40 sys/arch/alpha/include/alpha.h
--- a/sys/arch/alpha/include/alpha.h    Fri Jul 23 02:35:14 2021 +0000
+++ b/sys/arch/alpha/include/alpha.h    Fri Jul 23 03:50:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha.h,v 1.46 2021/07/20 05:43:10 thorpej Exp $ */
+/* $NetBSD: alpha.h,v 1.47 2021/07/23 03:50:32 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -178,6 +178,7 @@
 void alpha_write_fp_c(struct lwp *, uint64_t);
 
 int alpha_fp_complete(u_long, u_long, struct lwp *, uint64_t *);
+int alpha_fp_complete_at(u_long, struct lwp *, uint64_t *);
 
 /* Security sensitive rate limiting printf */
 



Home | Main Index | Thread Index | Old Index