191eaf3e1SJohn Birrell /* 291eaf3e1SJohn Birrell * CDDL HEADER START 391eaf3e1SJohn Birrell * 491eaf3e1SJohn Birrell * The contents of this file are subject to the terms of the 591eaf3e1SJohn Birrell * Common Development and Distribution License, Version 1.0 only 691eaf3e1SJohn Birrell * (the "License"). You may not use this file except in compliance 791eaf3e1SJohn Birrell * with the License. 891eaf3e1SJohn Birrell * 991eaf3e1SJohn Birrell * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 1091eaf3e1SJohn Birrell * or http://www.opensolaris.org/os/licensing. 1191eaf3e1SJohn Birrell * See the License for the specific language governing permissions 1291eaf3e1SJohn Birrell * and limitations under the License. 1391eaf3e1SJohn Birrell * 1491eaf3e1SJohn Birrell * When distributing Covered Code, include this CDDL HEADER in each 1591eaf3e1SJohn Birrell * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1691eaf3e1SJohn Birrell * If applicable, add the following below this CDDL HEADER, with the 1791eaf3e1SJohn Birrell * fields enclosed by brackets "[]" replaced with your own identifying 1891eaf3e1SJohn Birrell * information: Portions Copyright [yyyy] [name of copyright owner] 1991eaf3e1SJohn Birrell * 2091eaf3e1SJohn Birrell * CDDL HEADER END 2191eaf3e1SJohn Birrell * 2291eaf3e1SJohn Birrell * $FreeBSD$ 2391eaf3e1SJohn Birrell */ 2491eaf3e1SJohn Birrell /* 2591eaf3e1SJohn Birrell * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 2691eaf3e1SJohn Birrell * Use is subject to license terms. 2791eaf3e1SJohn Birrell */ 2891eaf3e1SJohn Birrell #include <sys/cdefs.h> 2991eaf3e1SJohn Birrell 3091eaf3e1SJohn Birrell #include <sys/param.h> 3191eaf3e1SJohn Birrell #include <sys/systm.h> 3291eaf3e1SJohn Birrell #include <sys/kernel.h> 3391eaf3e1SJohn Birrell #include <sys/stack.h> 3491eaf3e1SJohn Birrell #include <sys/pcpu.h> 3591eaf3e1SJohn Birrell 3691eaf3e1SJohn Birrell #include <machine/frame.h> 3791eaf3e1SJohn Birrell #include <machine/md_var.h> 3891eaf3e1SJohn Birrell #include <machine/reg.h> 3991eaf3e1SJohn Birrell #include <machine/stack.h> 40*8ca79fbdSMateusz Guzik #include <x86/ifunc.h> 4191eaf3e1SJohn Birrell 4291eaf3e1SJohn Birrell #include <vm/vm.h> 4391eaf3e1SJohn Birrell #include <vm/vm_param.h> 4491eaf3e1SJohn Birrell #include <vm/pmap.h> 4591eaf3e1SJohn Birrell 46c6f5742fSRui Paulo #include "regset.h" 4791eaf3e1SJohn Birrell 4891eaf3e1SJohn Birrell uint8_t dtrace_fuword8_nocheck(void *); 4991eaf3e1SJohn Birrell uint16_t dtrace_fuword16_nocheck(void *); 5091eaf3e1SJohn Birrell uint32_t dtrace_fuword32_nocheck(void *); 5191eaf3e1SJohn Birrell uint64_t dtrace_fuword64_nocheck(void *); 5291eaf3e1SJohn Birrell 5309a15aa3SMark Johnston int dtrace_ustackdepth_max = 2048; 5409a15aa3SMark Johnston 5591eaf3e1SJohn Birrell void 5691eaf3e1SJohn Birrell dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, 5791eaf3e1SJohn Birrell uint32_t *intrpc) 5891eaf3e1SJohn Birrell { 5991eaf3e1SJohn Birrell int depth = 0; 6091eaf3e1SJohn Birrell register_t rbp; 6191eaf3e1SJohn Birrell struct amd64_frame *frame; 6291eaf3e1SJohn Birrell vm_offset_t callpc; 6391eaf3e1SJohn Birrell pc_t caller = (pc_t) solaris_cpu[curcpu].cpu_dtrace_caller; 6491eaf3e1SJohn Birrell 6591eaf3e1SJohn Birrell if (intrpc != 0) 6691eaf3e1SJohn Birrell pcstack[depth++] = (pc_t) intrpc; 6791eaf3e1SJohn Birrell 6891eaf3e1SJohn Birrell aframes++; 6991eaf3e1SJohn Birrell 7091eaf3e1SJohn Birrell __asm __volatile("movq %%rbp,%0" : "=r" (rbp)); 7191eaf3e1SJohn Birrell 7291eaf3e1SJohn Birrell frame = (struct amd64_frame *)rbp; 7391eaf3e1SJohn Birrell while (depth < pcstack_limit) { 7491eaf3e1SJohn Birrell if (!INKERNEL((long) frame)) 7591eaf3e1SJohn Birrell break; 7691eaf3e1SJohn Birrell 7791eaf3e1SJohn Birrell callpc = frame->f_retaddr; 7891eaf3e1SJohn Birrell 7991eaf3e1SJohn Birrell if (!INKERNEL(callpc)) 8091eaf3e1SJohn Birrell break; 8191eaf3e1SJohn Birrell 8291eaf3e1SJohn Birrell if (aframes > 0) { 8391eaf3e1SJohn Birrell aframes--; 8491eaf3e1SJohn Birrell if ((aframes == 0) && (caller != 0)) { 8591eaf3e1SJohn Birrell pcstack[depth++] = caller; 8691eaf3e1SJohn Birrell } 8791eaf3e1SJohn Birrell } 8891eaf3e1SJohn Birrell else { 8991eaf3e1SJohn Birrell pcstack[depth++] = callpc; 9091eaf3e1SJohn Birrell } 9191eaf3e1SJohn Birrell 9291eaf3e1SJohn Birrell if (frame->f_frame <= frame || 93888e282aSKonstantin Belousov (vm_offset_t)frame->f_frame >= curthread->td_kstack + 94888e282aSKonstantin Belousov curthread->td_kstack_pages * PAGE_SIZE) 9591eaf3e1SJohn Birrell break; 9691eaf3e1SJohn Birrell frame = frame->f_frame; 9791eaf3e1SJohn Birrell } 9891eaf3e1SJohn Birrell 9991eaf3e1SJohn Birrell for (; depth < pcstack_limit; depth++) { 10091eaf3e1SJohn Birrell pcstack[depth] = 0; 10191eaf3e1SJohn Birrell } 10291eaf3e1SJohn Birrell } 10391eaf3e1SJohn Birrell 10491eaf3e1SJohn Birrell static int 10591eaf3e1SJohn Birrell dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc, 10691eaf3e1SJohn Birrell uintptr_t sp) 10791eaf3e1SJohn Birrell { 10809a15aa3SMark Johnston uintptr_t oldsp; 10991eaf3e1SJohn Birrell volatile uint16_t *flags = 11091eaf3e1SJohn Birrell (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; 11191eaf3e1SJohn Birrell int ret = 0; 11291eaf3e1SJohn Birrell 11391eaf3e1SJohn Birrell ASSERT(pcstack == NULL || pcstack_limit > 0); 11409a15aa3SMark Johnston ASSERT(dtrace_ustackdepth_max > 0); 11591eaf3e1SJohn Birrell 116c6f5742fSRui Paulo while (pc != 0) { 11709a15aa3SMark Johnston /* 11809a15aa3SMark Johnston * We limit the number of times we can go around this 11909a15aa3SMark Johnston * loop to account for a circular stack. 12009a15aa3SMark Johnston */ 12109a15aa3SMark Johnston if (ret++ >= dtrace_ustackdepth_max) { 12209a15aa3SMark Johnston *flags |= CPU_DTRACE_BADSTACK; 12309a15aa3SMark Johnston cpu_core[curcpu].cpuc_dtrace_illval = sp; 12409a15aa3SMark Johnston break; 12509a15aa3SMark Johnston } 12609a15aa3SMark Johnston 12791eaf3e1SJohn Birrell if (pcstack != NULL) { 12891eaf3e1SJohn Birrell *pcstack++ = (uint64_t)pc; 12991eaf3e1SJohn Birrell pcstack_limit--; 13091eaf3e1SJohn Birrell if (pcstack_limit <= 0) 13191eaf3e1SJohn Birrell break; 13291eaf3e1SJohn Birrell } 13391eaf3e1SJohn Birrell 134c6f5742fSRui Paulo if (sp == 0) 135c6f5742fSRui Paulo break; 13691eaf3e1SJohn Birrell 13709a15aa3SMark Johnston oldsp = sp; 13809a15aa3SMark Johnston 139c6f5742fSRui Paulo pc = dtrace_fuword64((void *)(sp + 140c6f5742fSRui Paulo offsetof(struct amd64_frame, f_retaddr))); 141c6f5742fSRui Paulo sp = dtrace_fuword64((void *)sp); 14291eaf3e1SJohn Birrell 14309a15aa3SMark Johnston if (sp == oldsp) { 14409a15aa3SMark Johnston *flags |= CPU_DTRACE_BADSTACK; 14509a15aa3SMark Johnston cpu_core[curcpu].cpuc_dtrace_illval = sp; 14609a15aa3SMark Johnston break; 14709a15aa3SMark Johnston } 14809a15aa3SMark Johnston 14991eaf3e1SJohn Birrell /* 15091eaf3e1SJohn Birrell * This is totally bogus: if we faulted, we're going to clear 15191eaf3e1SJohn Birrell * the fault and break. This is to deal with the apparently 15291eaf3e1SJohn Birrell * broken Java stacks on x86. 15391eaf3e1SJohn Birrell */ 15491eaf3e1SJohn Birrell if (*flags & CPU_DTRACE_FAULT) { 15591eaf3e1SJohn Birrell *flags &= ~CPU_DTRACE_FAULT; 15691eaf3e1SJohn Birrell break; 15791eaf3e1SJohn Birrell } 15891eaf3e1SJohn Birrell } 15991eaf3e1SJohn Birrell 16091eaf3e1SJohn Birrell return (ret); 16191eaf3e1SJohn Birrell } 16291eaf3e1SJohn Birrell 16391eaf3e1SJohn Birrell void 16491eaf3e1SJohn Birrell dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit) 16591eaf3e1SJohn Birrell { 16691eaf3e1SJohn Birrell proc_t *p = curproc; 16791eaf3e1SJohn Birrell struct trapframe *tf; 168c6f5742fSRui Paulo uintptr_t pc, sp, fp; 16991eaf3e1SJohn Birrell volatile uint16_t *flags = 17091eaf3e1SJohn Birrell (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; 17191eaf3e1SJohn Birrell int n; 17291eaf3e1SJohn Birrell 17391eaf3e1SJohn Birrell if (*flags & CPU_DTRACE_FAULT) 17491eaf3e1SJohn Birrell return; 17591eaf3e1SJohn Birrell 17691eaf3e1SJohn Birrell if (pcstack_limit <= 0) 17791eaf3e1SJohn Birrell return; 17891eaf3e1SJohn Birrell 17991eaf3e1SJohn Birrell /* 18091eaf3e1SJohn Birrell * If there's no user context we still need to zero the stack. 18191eaf3e1SJohn Birrell */ 18291eaf3e1SJohn Birrell if (p == NULL || (tf = curthread->td_frame) == NULL) 18391eaf3e1SJohn Birrell goto zero; 18491eaf3e1SJohn Birrell 18591eaf3e1SJohn Birrell *pcstack++ = (uint64_t)p->p_pid; 18691eaf3e1SJohn Birrell pcstack_limit--; 18791eaf3e1SJohn Birrell 18891eaf3e1SJohn Birrell if (pcstack_limit <= 0) 18991eaf3e1SJohn Birrell return; 19091eaf3e1SJohn Birrell 19191eaf3e1SJohn Birrell pc = tf->tf_rip; 192c6f5742fSRui Paulo fp = tf->tf_rbp; 19391eaf3e1SJohn Birrell sp = tf->tf_rsp; 19491eaf3e1SJohn Birrell 19591eaf3e1SJohn Birrell if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) { 196c6f5742fSRui Paulo /* 197c6f5742fSRui Paulo * In an entry probe. The frame pointer has not yet been 198c6f5742fSRui Paulo * pushed (that happens in the function prologue). The 199c6f5742fSRui Paulo * best approach is to add the current pc as a missing top 200c6f5742fSRui Paulo * of stack and back the pc up to the caller, which is stored 201c6f5742fSRui Paulo * at the current stack pointer address since the call 202c6f5742fSRui Paulo * instruction puts it there right before the branch. 203c6f5742fSRui Paulo */ 204c6f5742fSRui Paulo 20591eaf3e1SJohn Birrell *pcstack++ = (uint64_t)pc; 20691eaf3e1SJohn Birrell pcstack_limit--; 20791eaf3e1SJohn Birrell if (pcstack_limit <= 0) 20891eaf3e1SJohn Birrell return; 20991eaf3e1SJohn Birrell 210c6f5742fSRui Paulo pc = dtrace_fuword64((void *) sp); 21191eaf3e1SJohn Birrell } 21291eaf3e1SJohn Birrell 213c6f5742fSRui Paulo n = dtrace_getustack_common(pcstack, pcstack_limit, pc, fp); 21491eaf3e1SJohn Birrell ASSERT(n >= 0); 21591eaf3e1SJohn Birrell ASSERT(n <= pcstack_limit); 21691eaf3e1SJohn Birrell 21791eaf3e1SJohn Birrell pcstack += n; 21891eaf3e1SJohn Birrell pcstack_limit -= n; 21991eaf3e1SJohn Birrell 22091eaf3e1SJohn Birrell zero: 22191eaf3e1SJohn Birrell while (pcstack_limit-- > 0) 22291eaf3e1SJohn Birrell *pcstack++ = 0; 22391eaf3e1SJohn Birrell } 22491eaf3e1SJohn Birrell 22591eaf3e1SJohn Birrell int 22691eaf3e1SJohn Birrell dtrace_getustackdepth(void) 22791eaf3e1SJohn Birrell { 22891eaf3e1SJohn Birrell proc_t *p = curproc; 22991eaf3e1SJohn Birrell struct trapframe *tf; 230c6f5742fSRui Paulo uintptr_t pc, fp, sp; 23191eaf3e1SJohn Birrell int n = 0; 23291eaf3e1SJohn Birrell 23391eaf3e1SJohn Birrell if (p == NULL || (tf = curthread->td_frame) == NULL) 23491eaf3e1SJohn Birrell return (0); 23591eaf3e1SJohn Birrell 23691eaf3e1SJohn Birrell if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT)) 23791eaf3e1SJohn Birrell return (-1); 23891eaf3e1SJohn Birrell 23991eaf3e1SJohn Birrell pc = tf->tf_rip; 240c6f5742fSRui Paulo fp = tf->tf_rbp; 24191eaf3e1SJohn Birrell sp = tf->tf_rsp; 24291eaf3e1SJohn Birrell 24391eaf3e1SJohn Birrell if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) { 244c6f5742fSRui Paulo /* 245c6f5742fSRui Paulo * In an entry probe. The frame pointer has not yet been 246c6f5742fSRui Paulo * pushed (that happens in the function prologue). The 247c6f5742fSRui Paulo * best approach is to add the current pc as a missing top 248c6f5742fSRui Paulo * of stack and back the pc up to the caller, which is stored 249c6f5742fSRui Paulo * at the current stack pointer address since the call 250c6f5742fSRui Paulo * instruction puts it there right before the branch. 251c6f5742fSRui Paulo */ 25291eaf3e1SJohn Birrell 253c6f5742fSRui Paulo pc = dtrace_fuword64((void *) sp); 254c6f5742fSRui Paulo n++; 25591eaf3e1SJohn Birrell } 25691eaf3e1SJohn Birrell 257c6f5742fSRui Paulo n += dtrace_getustack_common(NULL, 0, pc, fp); 25891eaf3e1SJohn Birrell 25991eaf3e1SJohn Birrell return (n); 26091eaf3e1SJohn Birrell } 26191eaf3e1SJohn Birrell 26291eaf3e1SJohn Birrell void 26391eaf3e1SJohn Birrell dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, int pcstack_limit) 26491eaf3e1SJohn Birrell { 26591eaf3e1SJohn Birrell proc_t *p = curproc; 266c6f5742fSRui Paulo struct trapframe *tf; 267c6f5742fSRui Paulo uintptr_t pc, sp, fp; 26891eaf3e1SJohn Birrell volatile uint16_t *flags = 26991eaf3e1SJohn Birrell (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; 270c6f5742fSRui Paulo #ifdef notyet /* XXX signal stack */ 271c6f5742fSRui Paulo uintptr_t oldcontext; 27291eaf3e1SJohn Birrell size_t s1, s2; 273c6f5742fSRui Paulo #endif 27491eaf3e1SJohn Birrell 27591eaf3e1SJohn Birrell if (*flags & CPU_DTRACE_FAULT) 27691eaf3e1SJohn Birrell return; 27791eaf3e1SJohn Birrell 27891eaf3e1SJohn Birrell if (pcstack_limit <= 0) 27991eaf3e1SJohn Birrell return; 28091eaf3e1SJohn Birrell 28191eaf3e1SJohn Birrell /* 28291eaf3e1SJohn Birrell * If there's no user context we still need to zero the stack. 28391eaf3e1SJohn Birrell */ 284c6f5742fSRui Paulo if (p == NULL || (tf = curthread->td_frame) == NULL) 28591eaf3e1SJohn Birrell goto zero; 28691eaf3e1SJohn Birrell 28791eaf3e1SJohn Birrell *pcstack++ = (uint64_t)p->p_pid; 28891eaf3e1SJohn Birrell pcstack_limit--; 28991eaf3e1SJohn Birrell 29091eaf3e1SJohn Birrell if (pcstack_limit <= 0) 29191eaf3e1SJohn Birrell return; 29291eaf3e1SJohn Birrell 293c6f5742fSRui Paulo pc = tf->tf_rip; 294c6f5742fSRui Paulo sp = tf->tf_rsp; 295c6f5742fSRui Paulo fp = tf->tf_rbp; 29691eaf3e1SJohn Birrell 297c6f5742fSRui Paulo #ifdef notyet /* XXX signal stack */ 298c6f5742fSRui Paulo oldcontext = lwp->lwp_oldcontext; 29991eaf3e1SJohn Birrell s1 = sizeof (struct xframe) + 2 * sizeof (long); 30091eaf3e1SJohn Birrell s2 = s1 + sizeof (siginfo_t); 301c6f5742fSRui Paulo #endif 30291eaf3e1SJohn Birrell 30391eaf3e1SJohn Birrell if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) { 30491eaf3e1SJohn Birrell *pcstack++ = (uint64_t)pc; 30591eaf3e1SJohn Birrell *fpstack++ = 0; 30691eaf3e1SJohn Birrell pcstack_limit--; 30791eaf3e1SJohn Birrell if (pcstack_limit <= 0) 30891eaf3e1SJohn Birrell return; 30991eaf3e1SJohn Birrell 310c6f5742fSRui Paulo pc = dtrace_fuword64((void *)sp); 31191eaf3e1SJohn Birrell } 31291eaf3e1SJohn Birrell 313c6f5742fSRui Paulo while (pc != 0) { 31491eaf3e1SJohn Birrell *pcstack++ = (uint64_t)pc; 315c6f5742fSRui Paulo *fpstack++ = fp; 31691eaf3e1SJohn Birrell pcstack_limit--; 31791eaf3e1SJohn Birrell if (pcstack_limit <= 0) 31891eaf3e1SJohn Birrell break; 31991eaf3e1SJohn Birrell 320c6f5742fSRui Paulo if (fp == 0) 321c6f5742fSRui Paulo break; 322c6f5742fSRui Paulo 323c6f5742fSRui Paulo #ifdef notyet /* XXX signal stack */ 32491eaf3e1SJohn Birrell if (oldcontext == sp + s1 || oldcontext == sp + s2) { 32591eaf3e1SJohn Birrell ucontext_t *ucp = (ucontext_t *)oldcontext; 32691eaf3e1SJohn Birrell greg_t *gregs = ucp->uc_mcontext.gregs; 32791eaf3e1SJohn Birrell 32891eaf3e1SJohn Birrell sp = dtrace_fulword(&gregs[REG_FP]); 32991eaf3e1SJohn Birrell pc = dtrace_fulword(&gregs[REG_PC]); 33091eaf3e1SJohn Birrell 33191eaf3e1SJohn Birrell oldcontext = dtrace_fulword(&ucp->uc_link); 332c6f5742fSRui Paulo } else 333c6f5742fSRui Paulo #endif /* XXX */ 334c6f5742fSRui Paulo { 335c6f5742fSRui Paulo pc = dtrace_fuword64((void *)(fp + 336c6f5742fSRui Paulo offsetof(struct amd64_frame, f_retaddr))); 337c6f5742fSRui Paulo fp = dtrace_fuword64((void *)fp); 33891eaf3e1SJohn Birrell } 33991eaf3e1SJohn Birrell 34091eaf3e1SJohn Birrell /* 34191eaf3e1SJohn Birrell * This is totally bogus: if we faulted, we're going to clear 34291eaf3e1SJohn Birrell * the fault and break. This is to deal with the apparently 34391eaf3e1SJohn Birrell * broken Java stacks on x86. 34491eaf3e1SJohn Birrell */ 34591eaf3e1SJohn Birrell if (*flags & CPU_DTRACE_FAULT) { 34691eaf3e1SJohn Birrell *flags &= ~CPU_DTRACE_FAULT; 34791eaf3e1SJohn Birrell break; 34891eaf3e1SJohn Birrell } 34991eaf3e1SJohn Birrell } 35091eaf3e1SJohn Birrell 35191eaf3e1SJohn Birrell zero: 35291eaf3e1SJohn Birrell while (pcstack_limit-- > 0) 353c6f5742fSRui Paulo *pcstack++ = 0; 35491eaf3e1SJohn Birrell } 35591eaf3e1SJohn Birrell 35691eaf3e1SJohn Birrell /*ARGSUSED*/ 35791eaf3e1SJohn Birrell uint64_t 35891eaf3e1SJohn Birrell dtrace_getarg(int arg, int aframes) 35991eaf3e1SJohn Birrell { 36091eaf3e1SJohn Birrell uintptr_t val; 36191eaf3e1SJohn Birrell struct amd64_frame *fp = (struct amd64_frame *)dtrace_getfp(); 36291eaf3e1SJohn Birrell uintptr_t *stack; 36391eaf3e1SJohn Birrell int i; 36491eaf3e1SJohn Birrell 36591eaf3e1SJohn Birrell /* 36691eaf3e1SJohn Birrell * A total of 6 arguments are passed via registers; any argument with 36791eaf3e1SJohn Birrell * index of 5 or lower is therefore in a register. 36891eaf3e1SJohn Birrell */ 36991eaf3e1SJohn Birrell int inreg = 5; 37091eaf3e1SJohn Birrell 37191eaf3e1SJohn Birrell for (i = 1; i <= aframes; i++) { 37291eaf3e1SJohn Birrell fp = fp->f_frame; 37391eaf3e1SJohn Birrell 3748382ec9eSMark Johnston if (P2ROUNDUP(fp->f_retaddr, 16) == 3758382ec9eSMark Johnston (long)dtrace_invop_callsite) { 37691eaf3e1SJohn Birrell /* 37791eaf3e1SJohn Birrell * In the case of amd64, we will use the pointer to the 37891eaf3e1SJohn Birrell * regs structure that was pushed when we took the 37991eaf3e1SJohn Birrell * trap. To get this structure, we must increment 38091eaf3e1SJohn Birrell * beyond the frame structure, and then again beyond 38191eaf3e1SJohn Birrell * the calling RIP stored in dtrace_invop(). If the 38291eaf3e1SJohn Birrell * argument that we're seeking is passed on the stack, 38391eaf3e1SJohn Birrell * we'll pull the true stack pointer out of the saved 38491eaf3e1SJohn Birrell * registers and decrement our argument by the number 38591eaf3e1SJohn Birrell * of arguments passed in registers; if the argument 3866c280659SMark Johnston * we're seeking is passed in registers, we can just 38791eaf3e1SJohn Birrell * load it directly. 38891eaf3e1SJohn Birrell */ 3896c280659SMark Johnston struct trapframe *tf = (struct trapframe *)&fp[1]; 39091eaf3e1SJohn Birrell 39191eaf3e1SJohn Birrell if (arg <= inreg) { 3927e75d586SMark Johnston switch (arg) { 3937e75d586SMark Johnston case 0: 3948382ec9eSMark Johnston stack = (uintptr_t *)&tf->tf_rdi; 3957e75d586SMark Johnston break; 3967e75d586SMark Johnston case 1: 3978382ec9eSMark Johnston stack = (uintptr_t *)&tf->tf_rsi; 3987e75d586SMark Johnston break; 3997e75d586SMark Johnston case 2: 4008382ec9eSMark Johnston stack = (uintptr_t *)&tf->tf_rdx; 4017e75d586SMark Johnston break; 4027e75d586SMark Johnston case 3: 4038382ec9eSMark Johnston stack = (uintptr_t *)&tf->tf_rcx; 4047e75d586SMark Johnston break; 4057e75d586SMark Johnston case 4: 4068382ec9eSMark Johnston stack = (uintptr_t *)&tf->tf_r8; 4077e75d586SMark Johnston break; 4087e75d586SMark Johnston case 5: 4098382ec9eSMark Johnston stack = (uintptr_t *)&tf->tf_r9; 4107e75d586SMark Johnston break; 4117e75d586SMark Johnston } 4127e75d586SMark Johnston arg = 0; 41391eaf3e1SJohn Birrell } else { 4148382ec9eSMark Johnston stack = (uintptr_t *)(tf->tf_rsp); 41591eaf3e1SJohn Birrell arg -= inreg; 41691eaf3e1SJohn Birrell } 41791eaf3e1SJohn Birrell goto load; 41891eaf3e1SJohn Birrell } 41991eaf3e1SJohn Birrell 42091eaf3e1SJohn Birrell } 42191eaf3e1SJohn Birrell 42291eaf3e1SJohn Birrell /* 42391eaf3e1SJohn Birrell * We know that we did not come through a trap to get into 42491eaf3e1SJohn Birrell * dtrace_probe() -- the provider simply called dtrace_probe() 42591eaf3e1SJohn Birrell * directly. As this is the case, we need to shift the argument 42691eaf3e1SJohn Birrell * that we're looking for: the probe ID is the first argument to 42791eaf3e1SJohn Birrell * dtrace_probe(), so the argument n will actually be found where 42891eaf3e1SJohn Birrell * one would expect to find argument (n + 1). 42991eaf3e1SJohn Birrell */ 43091eaf3e1SJohn Birrell arg++; 43191eaf3e1SJohn Birrell 43291eaf3e1SJohn Birrell if (arg <= inreg) { 43391eaf3e1SJohn Birrell /* 43491eaf3e1SJohn Birrell * This shouldn't happen. If the argument is passed in a 43591eaf3e1SJohn Birrell * register then it should have been, well, passed in a 43691eaf3e1SJohn Birrell * register... 43791eaf3e1SJohn Birrell */ 43891eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP); 43991eaf3e1SJohn Birrell return (0); 44091eaf3e1SJohn Birrell } 44191eaf3e1SJohn Birrell 44291eaf3e1SJohn Birrell arg -= (inreg + 1); 4431e954a7cSMark Johnston stack = (uintptr_t *)&fp[1]; 44491eaf3e1SJohn Birrell 44591eaf3e1SJohn Birrell load: 44691eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); 44791eaf3e1SJohn Birrell val = stack[arg]; 44891eaf3e1SJohn Birrell DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); 44991eaf3e1SJohn Birrell 45091eaf3e1SJohn Birrell return (val); 45191eaf3e1SJohn Birrell } 45291eaf3e1SJohn Birrell 45391eaf3e1SJohn Birrell int 45491eaf3e1SJohn Birrell dtrace_getstackdepth(int aframes) 45591eaf3e1SJohn Birrell { 45691eaf3e1SJohn Birrell int depth = 0; 45791eaf3e1SJohn Birrell struct amd64_frame *frame; 45891eaf3e1SJohn Birrell vm_offset_t rbp; 45991eaf3e1SJohn Birrell 46091eaf3e1SJohn Birrell aframes++; 46191eaf3e1SJohn Birrell rbp = dtrace_getfp(); 46291eaf3e1SJohn Birrell frame = (struct amd64_frame *)rbp; 46391eaf3e1SJohn Birrell depth++; 46491eaf3e1SJohn Birrell for(;;) { 46591eaf3e1SJohn Birrell if (!INKERNEL((long) frame)) 46691eaf3e1SJohn Birrell break; 46791eaf3e1SJohn Birrell if (!INKERNEL((long) frame->f_frame)) 46891eaf3e1SJohn Birrell break; 46991eaf3e1SJohn Birrell depth++; 47091eaf3e1SJohn Birrell if (frame->f_frame <= frame || 471888e282aSKonstantin Belousov (vm_offset_t)frame->f_frame >= curthread->td_kstack + 472888e282aSKonstantin Belousov curthread->td_kstack_pages * PAGE_SIZE) 47391eaf3e1SJohn Birrell break; 47491eaf3e1SJohn Birrell frame = frame->f_frame; 47591eaf3e1SJohn Birrell } 47691eaf3e1SJohn Birrell if (depth < aframes) 47791eaf3e1SJohn Birrell return 0; 47891eaf3e1SJohn Birrell else 47991eaf3e1SJohn Birrell return depth - aframes; 48091eaf3e1SJohn Birrell } 48191eaf3e1SJohn Birrell 48291eaf3e1SJohn Birrell ulong_t 483c6f5742fSRui Paulo dtrace_getreg(struct trapframe *rp, uint_t reg) 48491eaf3e1SJohn Birrell { 485c6f5742fSRui Paulo /* This table is dependent on reg.d. */ 48691eaf3e1SJohn Birrell int regmap[] = { 487c6f5742fSRui Paulo REG_GS, /* 0 GS */ 488c6f5742fSRui Paulo REG_FS, /* 1 FS */ 489c6f5742fSRui Paulo REG_ES, /* 2 ES */ 490c6f5742fSRui Paulo REG_DS, /* 3 DS */ 491c6f5742fSRui Paulo REG_RDI, /* 4 EDI */ 492c6f5742fSRui Paulo REG_RSI, /* 5 ESI */ 493c6f5742fSRui Paulo REG_RBP, /* 6 EBP, REG_FP */ 494c6f5742fSRui Paulo REG_RSP, /* 7 ESP */ 495c6f5742fSRui Paulo REG_RBX, /* 8 EBX, REG_R1 */ 496c6f5742fSRui Paulo REG_RDX, /* 9 EDX */ 497c6f5742fSRui Paulo REG_RCX, /* 10 ECX */ 498c6f5742fSRui Paulo REG_RAX, /* 11 EAX, REG_R0 */ 499c6f5742fSRui Paulo REG_TRAPNO, /* 12 TRAPNO */ 500c6f5742fSRui Paulo REG_ERR, /* 13 ERR */ 501c6f5742fSRui Paulo REG_RIP, /* 14 EIP, REG_PC */ 502c6f5742fSRui Paulo REG_CS, /* 15 CS */ 503c6f5742fSRui Paulo REG_RFL, /* 16 EFL, REG_PS */ 504c6f5742fSRui Paulo REG_RSP, /* 17 UESP, REG_SP */ 505c6f5742fSRui Paulo REG_SS /* 18 SS */ 50691eaf3e1SJohn Birrell }; 50791eaf3e1SJohn Birrell 50891eaf3e1SJohn Birrell if (reg <= SS) { 50991eaf3e1SJohn Birrell if (reg >= sizeof (regmap) / sizeof (int)) { 51091eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP); 51191eaf3e1SJohn Birrell return (0); 51291eaf3e1SJohn Birrell } 51391eaf3e1SJohn Birrell 51491eaf3e1SJohn Birrell reg = regmap[reg]; 51591eaf3e1SJohn Birrell } else { 516c6f5742fSRui Paulo /* This is dependent on reg.d. */ 51791eaf3e1SJohn Birrell reg -= SS + 1; 51891eaf3e1SJohn Birrell } 51991eaf3e1SJohn Birrell 52091eaf3e1SJohn Birrell switch (reg) { 52191eaf3e1SJohn Birrell case REG_RDI: 522c6f5742fSRui Paulo return (rp->tf_rdi); 52391eaf3e1SJohn Birrell case REG_RSI: 524c6f5742fSRui Paulo return (rp->tf_rsi); 52591eaf3e1SJohn Birrell case REG_RDX: 526c6f5742fSRui Paulo return (rp->tf_rdx); 52791eaf3e1SJohn Birrell case REG_RCX: 528c6f5742fSRui Paulo return (rp->tf_rcx); 52991eaf3e1SJohn Birrell case REG_R8: 530c6f5742fSRui Paulo return (rp->tf_r8); 53191eaf3e1SJohn Birrell case REG_R9: 532c6f5742fSRui Paulo return (rp->tf_r9); 53391eaf3e1SJohn Birrell case REG_RAX: 534c6f5742fSRui Paulo return (rp->tf_rax); 53591eaf3e1SJohn Birrell case REG_RBX: 536c6f5742fSRui Paulo return (rp->tf_rbx); 53791eaf3e1SJohn Birrell case REG_RBP: 538c6f5742fSRui Paulo return (rp->tf_rbp); 53991eaf3e1SJohn Birrell case REG_R10: 540c6f5742fSRui Paulo return (rp->tf_r10); 54191eaf3e1SJohn Birrell case REG_R11: 542c6f5742fSRui Paulo return (rp->tf_r11); 54391eaf3e1SJohn Birrell case REG_R12: 544c6f5742fSRui Paulo return (rp->tf_r12); 54591eaf3e1SJohn Birrell case REG_R13: 546c6f5742fSRui Paulo return (rp->tf_r13); 54791eaf3e1SJohn Birrell case REG_R14: 548c6f5742fSRui Paulo return (rp->tf_r14); 54991eaf3e1SJohn Birrell case REG_R15: 550c6f5742fSRui Paulo return (rp->tf_r15); 55191eaf3e1SJohn Birrell case REG_DS: 552c6f5742fSRui Paulo return (rp->tf_ds); 55391eaf3e1SJohn Birrell case REG_ES: 554c6f5742fSRui Paulo return (rp->tf_es); 55591eaf3e1SJohn Birrell case REG_FS: 556c6f5742fSRui Paulo return (rp->tf_fs); 55791eaf3e1SJohn Birrell case REG_GS: 558c6f5742fSRui Paulo return (rp->tf_gs); 55991eaf3e1SJohn Birrell case REG_TRAPNO: 560c6f5742fSRui Paulo return (rp->tf_trapno); 56191eaf3e1SJohn Birrell case REG_ERR: 562c6f5742fSRui Paulo return (rp->tf_err); 56391eaf3e1SJohn Birrell case REG_RIP: 564c6f5742fSRui Paulo return (rp->tf_rip); 56591eaf3e1SJohn Birrell case REG_CS: 566c6f5742fSRui Paulo return (rp->tf_cs); 56791eaf3e1SJohn Birrell case REG_SS: 568c6f5742fSRui Paulo return (rp->tf_ss); 56991eaf3e1SJohn Birrell case REG_RFL: 570c6f5742fSRui Paulo return (rp->tf_rflags); 57191eaf3e1SJohn Birrell case REG_RSP: 572c6f5742fSRui Paulo return (rp->tf_rsp); 57391eaf3e1SJohn Birrell default: 57491eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP); 57591eaf3e1SJohn Birrell return (0); 57691eaf3e1SJohn Birrell } 57791eaf3e1SJohn Birrell } 57891eaf3e1SJohn Birrell 57991eaf3e1SJohn Birrell static int 58091eaf3e1SJohn Birrell dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size) 58191eaf3e1SJohn Birrell { 582f340e9feSAndriy Gapon ASSERT(INKERNEL(kaddr) && kaddr + size >= kaddr); 58391eaf3e1SJohn Birrell 584f340e9feSAndriy Gapon if (uaddr + size > VM_MAXUSER_ADDRESS || uaddr + size < uaddr) { 58591eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); 58691eaf3e1SJohn Birrell cpu_core[curcpu].cpuc_dtrace_illval = uaddr; 58791eaf3e1SJohn Birrell return (0); 58891eaf3e1SJohn Birrell } 58991eaf3e1SJohn Birrell 59091eaf3e1SJohn Birrell return (1); 59191eaf3e1SJohn Birrell } 59291eaf3e1SJohn Birrell 59391eaf3e1SJohn Birrell void 59491eaf3e1SJohn Birrell dtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size, 59591eaf3e1SJohn Birrell volatile uint16_t *flags) 59691eaf3e1SJohn Birrell { 59791eaf3e1SJohn Birrell if (dtrace_copycheck(uaddr, kaddr, size)) 59891eaf3e1SJohn Birrell dtrace_copy(uaddr, kaddr, size); 59991eaf3e1SJohn Birrell } 60091eaf3e1SJohn Birrell 60191eaf3e1SJohn Birrell void 60291eaf3e1SJohn Birrell dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size, 60391eaf3e1SJohn Birrell volatile uint16_t *flags) 60491eaf3e1SJohn Birrell { 60591eaf3e1SJohn Birrell if (dtrace_copycheck(uaddr, kaddr, size)) 60691eaf3e1SJohn Birrell dtrace_copy(kaddr, uaddr, size); 60791eaf3e1SJohn Birrell } 60891eaf3e1SJohn Birrell 60991eaf3e1SJohn Birrell void 61091eaf3e1SJohn Birrell dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size, 61191eaf3e1SJohn Birrell volatile uint16_t *flags) 61291eaf3e1SJohn Birrell { 61391eaf3e1SJohn Birrell if (dtrace_copycheck(uaddr, kaddr, size)) 61491eaf3e1SJohn Birrell dtrace_copystr(uaddr, kaddr, size, flags); 61591eaf3e1SJohn Birrell } 61691eaf3e1SJohn Birrell 61791eaf3e1SJohn Birrell void 61891eaf3e1SJohn Birrell dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size, 61991eaf3e1SJohn Birrell volatile uint16_t *flags) 62091eaf3e1SJohn Birrell { 62191eaf3e1SJohn Birrell if (dtrace_copycheck(uaddr, kaddr, size)) 62291eaf3e1SJohn Birrell dtrace_copystr(kaddr, uaddr, size, flags); 62391eaf3e1SJohn Birrell } 62491eaf3e1SJohn Birrell 62591eaf3e1SJohn Birrell uint8_t 62691eaf3e1SJohn Birrell dtrace_fuword8(void *uaddr) 62791eaf3e1SJohn Birrell { 628f340e9feSAndriy Gapon if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { 62991eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); 63091eaf3e1SJohn Birrell cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; 63191eaf3e1SJohn Birrell return (0); 63291eaf3e1SJohn Birrell } 63391eaf3e1SJohn Birrell return (dtrace_fuword8_nocheck(uaddr)); 63491eaf3e1SJohn Birrell } 63591eaf3e1SJohn Birrell 63691eaf3e1SJohn Birrell uint16_t 63791eaf3e1SJohn Birrell dtrace_fuword16(void *uaddr) 63891eaf3e1SJohn Birrell { 639f340e9feSAndriy Gapon if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { 64091eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); 64191eaf3e1SJohn Birrell cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; 64291eaf3e1SJohn Birrell return (0); 64391eaf3e1SJohn Birrell } 64491eaf3e1SJohn Birrell return (dtrace_fuword16_nocheck(uaddr)); 64591eaf3e1SJohn Birrell } 64691eaf3e1SJohn Birrell 64791eaf3e1SJohn Birrell uint32_t 64891eaf3e1SJohn Birrell dtrace_fuword32(void *uaddr) 64991eaf3e1SJohn Birrell { 650f340e9feSAndriy Gapon if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { 65191eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); 65291eaf3e1SJohn Birrell cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; 65391eaf3e1SJohn Birrell return (0); 65491eaf3e1SJohn Birrell } 65591eaf3e1SJohn Birrell return (dtrace_fuword32_nocheck(uaddr)); 65691eaf3e1SJohn Birrell } 65791eaf3e1SJohn Birrell 65891eaf3e1SJohn Birrell uint64_t 65991eaf3e1SJohn Birrell dtrace_fuword64(void *uaddr) 66091eaf3e1SJohn Birrell { 661f340e9feSAndriy Gapon if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { 66291eaf3e1SJohn Birrell DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); 66391eaf3e1SJohn Birrell cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; 66491eaf3e1SJohn Birrell return (0); 66591eaf3e1SJohn Birrell } 66691eaf3e1SJohn Birrell return (dtrace_fuword64_nocheck(uaddr)); 66791eaf3e1SJohn Birrell } 668*8ca79fbdSMateusz Guzik 669*8ca79fbdSMateusz Guzik /* 670*8ca79fbdSMateusz Guzik * ifunc resolvers for SMAP support 671*8ca79fbdSMateusz Guzik */ 672*8ca79fbdSMateusz Guzik void dtrace_copy_nosmap(uintptr_t, uintptr_t, size_t); 673*8ca79fbdSMateusz Guzik void dtrace_copy_smap(uintptr_t, uintptr_t, size_t); 674*8ca79fbdSMateusz Guzik DEFINE_IFUNC(, void, dtrace_copy, (uintptr_t, uintptr_t, size_t), static) 675*8ca79fbdSMateusz Guzik { 676*8ca79fbdSMateusz Guzik 677*8ca79fbdSMateusz Guzik return ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0 ? 678*8ca79fbdSMateusz Guzik dtrace_copy_smap : dtrace_copy_nosmap); 679*8ca79fbdSMateusz Guzik } 680*8ca79fbdSMateusz Guzik 681*8ca79fbdSMateusz Guzik void dtrace_copystr_nosmap(uintptr_t, uintptr_t, size_t, volatile uint16_t *); 682*8ca79fbdSMateusz Guzik void dtrace_copystr_smap(uintptr_t, uintptr_t, size_t, volatile uint16_t *); 683*8ca79fbdSMateusz Guzik DEFINE_IFUNC(, void, dtrace_copystr, (uintptr_t, uintptr_t, size_t, 684*8ca79fbdSMateusz Guzik volatile uint16_t *), static) 685*8ca79fbdSMateusz Guzik { 686*8ca79fbdSMateusz Guzik 687*8ca79fbdSMateusz Guzik return ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0 ? 688*8ca79fbdSMateusz Guzik dtrace_copystr_smap : dtrace_copystr_nosmap); 689*8ca79fbdSMateusz Guzik } 690*8ca79fbdSMateusz Guzik 691*8ca79fbdSMateusz Guzik uintptr_t dtrace_fulword_nosmap(void *); 692*8ca79fbdSMateusz Guzik uintptr_t dtrace_fulword_smap(void *); 693*8ca79fbdSMateusz Guzik DEFINE_IFUNC(, uintptr_t, dtrace_fulword, (void *), static) 694*8ca79fbdSMateusz Guzik { 695*8ca79fbdSMateusz Guzik 696*8ca79fbdSMateusz Guzik return ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0 ? 697*8ca79fbdSMateusz Guzik dtrace_fulword_smap : dtrace_fulword_nosmap); 698*8ca79fbdSMateusz Guzik } 699*8ca79fbdSMateusz Guzik 700*8ca79fbdSMateusz Guzik uint8_t dtrace_fuword8_nocheck_nosmap(void *); 701*8ca79fbdSMateusz Guzik uint8_t dtrace_fuword8_nocheck_smap(void *); 702*8ca79fbdSMateusz Guzik DEFINE_IFUNC(, uint8_t, dtrace_fuword8_nocheck, (void *), static) 703*8ca79fbdSMateusz Guzik { 704*8ca79fbdSMateusz Guzik 705*8ca79fbdSMateusz Guzik return ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0 ? 706*8ca79fbdSMateusz Guzik dtrace_fuword8_nocheck_smap : dtrace_fuword8_nocheck_nosmap); 707*8ca79fbdSMateusz Guzik } 708*8ca79fbdSMateusz Guzik 709*8ca79fbdSMateusz Guzik uint16_t dtrace_fuword16_nocheck_nosmap(void *); 710*8ca79fbdSMateusz Guzik uint16_t dtrace_fuword16_nocheck_smap(void *); 711*8ca79fbdSMateusz Guzik DEFINE_IFUNC(, uint16_t, dtrace_fuword16_nocheck, (void *), static) 712*8ca79fbdSMateusz Guzik { 713*8ca79fbdSMateusz Guzik 714*8ca79fbdSMateusz Guzik return ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0 ? 715*8ca79fbdSMateusz Guzik dtrace_fuword16_nocheck_smap : dtrace_fuword16_nocheck_nosmap); 716*8ca79fbdSMateusz Guzik } 717*8ca79fbdSMateusz Guzik 718*8ca79fbdSMateusz Guzik uint32_t dtrace_fuword32_nocheck_nosmap(void *); 719*8ca79fbdSMateusz Guzik uint32_t dtrace_fuword32_nocheck_smap(void *); 720*8ca79fbdSMateusz Guzik DEFINE_IFUNC(, uint32_t, dtrace_fuword32_nocheck, (void *), static) 721*8ca79fbdSMateusz Guzik { 722*8ca79fbdSMateusz Guzik 723*8ca79fbdSMateusz Guzik return ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0 ? 724*8ca79fbdSMateusz Guzik dtrace_fuword32_nocheck_smap : dtrace_fuword32_nocheck_nosmap); 725*8ca79fbdSMateusz Guzik } 726*8ca79fbdSMateusz Guzik 727*8ca79fbdSMateusz Guzik uint64_t dtrace_fuword64_nocheck_nosmap(void *); 728*8ca79fbdSMateusz Guzik uint64_t dtrace_fuword64_nocheck_smap(void *); 729*8ca79fbdSMateusz Guzik DEFINE_IFUNC(, uint64_t, dtrace_fuword64_nocheck, (void *), static) 730*8ca79fbdSMateusz Guzik { 731*8ca79fbdSMateusz Guzik 732*8ca79fbdSMateusz Guzik return ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0 ? 733*8ca79fbdSMateusz Guzik dtrace_fuword64_nocheck_smap : dtrace_fuword64_nocheck_nosmap); 734*8ca79fbdSMateusz Guzik } 735