Source-Changes-HG archive

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

[src/trunk]: src make dtrace work on amd64.



details:   https://anonhg.NetBSD.org/src/rev/207f717c1a69
branches:  trunk
changeset: 779687:207f717c1a69
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Jun 11 15:18:05 2012 +0000

description:
make dtrace work on amd64.

diffstat:

 external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S  |   9 +++------
 external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c  |  13 ++++++-------
 external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c |  14 +++++++++++++-
 sys/arch/amd64/amd64/genassym.cf                   |   4 +++-
 sys/arch/amd64/include/Makefile.inc                |   4 ++--
 sys/arch/amd64/include/asm.h                       |   3 ++-
 6 files changed, 29 insertions(+), 18 deletions(-)

diffs (150 lines):

diff -r cea4625ba4d0 -r 207f717c1a69 external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S
--- a/external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S Sun Jun 10 21:44:12 2012 +0000
+++ b/external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S Mon Jun 11 15:18:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dtrace_asm.S,v 1.3 2010/03/13 22:31:15 christos Exp $  */
+/*     $NetBSD: dtrace_asm.S,v 1.4 2012/06/11 15:18:05 chs Exp $       */
 
 /*
  * CDDL HEADER START
@@ -32,7 +32,6 @@
 
 #define _ASM
 
-
 #include <sys/cpuvar_defs.h>
 #include <sys/dtrace.h>
 #include <machine/asm.h>
@@ -65,8 +64,6 @@
 1:     addq    $TF_RIP,%rsp;
 
 
-       .globl  calltrap
-       .type   calltrap,@function
        ENTRY(dtrace_invop_start)
 
        /*
@@ -81,7 +78,7 @@
        pushq   (%rsi)
        movq    %rsp, %rsi
        call    dtrace_invop
-//     ALTENTRY(dtrace_invop_callsite)
+       ALTENTRY(dtrace_invop_callsite)
        addq    $8, %rsp
        cmpl    $DTRACE_INVOP_PUSHL_EBP, %eax
        je      bp_push
@@ -147,7 +144,7 @@
        /*NOTREACHED*/
 
 bp_ret:
-//     INTR_POP
+       INTR_POP
        pushq   %rax                    /* push temp */
        movq    32(%rsp), %rax          /* load %rsp */
        movq    (%rax), %rax            /* load calling RIP */
diff -r cea4625ba4d0 -r 207f717c1a69 external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c
--- a/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c Sun Jun 10 21:44:12 2012 +0000
+++ b/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c Mon Jun 11 15:18:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dtrace_isa.c,v 1.3 2010/03/13 22:31:15 christos Exp $  */
+/*     $NetBSD: dtrace_isa.c,v 1.4 2012/06/11 15:18:05 chs Exp $       */
 
 /*
  * CDDL HEADER START
@@ -52,15 +52,14 @@
 uint32_t dtrace_fuword32_nocheck(void *);
 uint64_t dtrace_fuword64_nocheck(void *);
 
-uintptr_t kernelbase = (uintptr_t)KERNBASE;
-        
-#define INKERNEL(va) (((vm_offset_t)(va)) >= USRSTACK && \
-     ((vm_offset_t)(va)) < VM_MAX_KERNEL_ADDRESS)
+uintptr_t kernelbase = (uintptr_t)KERN_BASE;
+
+#define INKERNEL(va) ((intptr_t)(va) < 0)
 
 struct amd64_frame {     
        struct amd64_frame      *f_frame;
-       int                      f_retaddr; 
-       int                      f_arg0;
+       uintptr_t                f_retaddr; 
+       uintptr_t                f_arg0;
 };
 
 typedef unsigned long vm_offset_t;
diff -r cea4625ba4d0 -r 207f717c1a69 external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
--- a/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c        Sun Jun 10 21:44:12 2012 +0000
+++ b/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c        Mon Jun 11 15:18:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dtrace_subr.c,v 1.5 2011/08/31 21:57:16 christos Exp $ */
+/*     $NetBSD: dtrace_subr.c,v 1.6 2012/06/11 15:18:05 chs Exp $      */
 
 /*
  * CDDL HEADER START
@@ -374,6 +374,18 @@
 }
 #endif
 
+#ifdef __NetBSD__
+static __inline uint64_t
+dtrace_rdtsc(void)
+{
+       uint32_t hi, lo;
+
+       __asm volatile("rdtsc" : "=d" (hi), "=a" (lo));
+       return (((uint64_t)hi << 32) | (uint64_t) lo);
+}
+#define rdtsc dtrace_rdtsc
+#endif
+
 #ifdef notyet
 static int64_t tgt_cpu_tsc;
 static int64_t hst_cpu_tsc;
diff -r cea4625ba4d0 -r 207f717c1a69 sys/arch/amd64/amd64/genassym.cf
--- a/sys/arch/amd64/amd64/genassym.cf  Sun Jun 10 21:44:12 2012 +0000
+++ b/sys/arch/amd64/amd64/genassym.cf  Mon Jun 11 15:18:05 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.50 2012/04/20 22:23:24 rmind Exp $
+#      $NetBSD: genassym.cf,v 1.51 2012/06/11 15:18:05 chs Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -372,3 +372,5 @@
 define VM_MIN_KERNEL_ADDRESS_HIGH32    (VM_MIN_KERNEL_ADDRESS >> 32)
 
 define RESCHED_KPREEMPT        RESCHED_KPREEMPT
+
+define SEL_RPL_MASK            SEL_RPL
diff -r cea4625ba4d0 -r 207f717c1a69 sys/arch/amd64/include/Makefile.inc
--- a/sys/arch/amd64/include/Makefile.inc       Sun Jun 10 21:44:12 2012 +0000
+++ b/sys/arch/amd64/include/Makefile.inc       Mon Jun 11 15:18:05 2012 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile.inc,v 1.3 2009/11/27 13:50:29 pooka Exp $
+# $NetBSD: Makefile.inc,v 1.4 2012/06/11 15:18:05 chs Exp $
 
 CFLAGS+=       -mno-red-zone
 
 # this should really be !(RUMPKERNEL && PIC)
 .if !defined(RUMPKERNEL)
-CFLAGS+=       -mcmodel=kernel
+CFLAGS+=       -mcmodel=kernel -fno-omit-frame-pointer
 .endif
 
 USE_SSP?=      yes
diff -r cea4625ba4d0 -r 207f717c1a69 sys/arch/amd64/include/asm.h
--- a/sys/arch/amd64/include/asm.h      Sun Jun 10 21:44:12 2012 +0000
+++ b/sys/arch/amd64/include/asm.h      Mon Jun 11 15:18:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asm.h,v 1.14 2010/12/20 21:11:24 joerg Exp $   */
+/*     $NetBSD: asm.h,v 1.15 2012/06/11 15:18:05 chs Exp $     */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -101,6 +101,7 @@
 
 #define        ENTRY(y)        _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
 #define        NENTRY(y)       _ENTRY(_C_LABEL(y))
+#define        ALTENTRY(x)     NENTRY(x)
 #define        ASENTRY(y)      _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 #define        LABEL(y)        _LABEL(_C_LABEL(y))
 



Home | Main Index | Thread Index | Old Index