Changeset 53636 in vbox for trunk/src/VBox
- Timestamp:
- Jan 2, 2015 12:00:19 PM (10 years ago)
- Location:
- trunk/src/VBox/ExtPacks/VBoxDTrace
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ExtPacks/VBoxDTrace/Config.kmk
r53635 r53636 1 # $Id$ 2 ## @file 3 # Config.kmk for VBoxDTrace. 4 # 5 # This ASSUMES that we're grafted on as src/VBox/ExtPacks/VBoxDTraceR0. 6 # 1 7 2 ifndef VBOX_ROOT 3 VBOX_ROOT := $(abspath $(PATH_ROOT)/../../../2vn/trunk) 4 endif 8 # 9 # Copyright (c) 2012 bird 10 # 11 # Permission is hereby granted, free of charge, to any person 12 # obtaining a copy of this software and associated documentation 13 # files (the "Software"), to deal in the Software without 14 # restriction, including without limitation the rights to use, 15 # copy, modify, merge, publish, distribute, sublicense, and/or sell 16 # copies of the Software, and to permit persons to whom the 17 # Software is furnished to do so, subject to the following 18 # conditions: 19 # 20 # The above copyright notice and this permission notice shall be 21 # included in all copies or substantial portions of the Software. 22 # 23 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 25 # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 27 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 28 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 29 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 30 # OTHER DEALINGS IN THE SOFTWARE. 31 # 5 32 6 include $( VBOX_ROOT)/Config.kmk33 include $(PATH_ROOT)/Config.kmk 7 34 8 9 10 VBOXDT_PATH_ONNV = $(PATH_ROOT)/src/onnv 35 VBOXDT_PATH_ONNV = $(PATH_ROOT)/src/VBox/ExtPacks/VBoxDTrace/onnv 11 36 VBOXDT_PATH_UTS = $(VBOXDT_PATH_ONNV)/uts 12 37 VBOXDT_PATH_CMD = $(VBOXDT_PATH_ONNV)/cmd 13 38 14 VBOXDT_PATH_VBOX_SDK_LIB = $(VBOX_ROOT)/out/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)/lib -
trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0/Makefile.kmk
r53635 r53636 1 1 # $Id$ 2 2 ## @file 3 # Sub-makefile for VBoxDTraceR0 3 # Sub-makefile for VBoxDTraceR0. 4 4 # 5 5 6 6 # 7 # Copyright ( C) 2012 ????7 # Copyright (c) 2012 bird 8 8 # 9 # This file is part of VirtualBox Open Source Edition (OSE), as 10 # available from http://www.virtualbox.org. This file is free software; 11 # you can redistribute it and/or modify it under the terms of the GNU 12 # General Public License (GPL) as published by the Free Software 13 # Foundation, in version 2 as it comes in the "COPYING" file of the 14 # VirtualBox OSE distribution. VirtualBox OSE is distributed in the 15 # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 9 # Permission is hereby granted, free of charge, to any person 10 # obtaining a copy of this software and associated documentation 11 # files (the "Software"), to deal in the Software without 12 # restriction, including without limitation the rights to use, 13 # copy, modify, merge, publish, distribute, sublicense, and/or sell 14 # copies of the Software, and to permit persons to whom the 15 # Software is furnished to do so, subject to the following 16 # conditions: 17 # 18 # The above copyright notice and this permission notice shall be 19 # included in all copies or substantial portions of the Software. 20 # 21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 # OTHER DEALINGS IN THE SOFTWARE. 16 29 # 17 30 18 SUB_DEPTH = ../.. 31 SUB_DEPTH = ../../../../../ 19 32 include $(KBUILD_PATH)/subheader.kmk 20 21 33 22 34 SYSMODS += VBoxDTraceR0 … … 27 39 endif 28 40 VBoxDTraceR0_INCS = \ 41 ../include \ 29 42 $(VBOXDT_PATH_UTS)/common 30 43 VBoxDTraceR0_SOURCES = \ 31 VBoxDTraceR0.cpp 44 VBoxDTraceR0.cpp \ 45 $(VBOXDT_PATH_UTS)/common/dtrace/dtrace.c 32 46 VBoxDTraceR0_LIBS = \ 33 $( VBOXDT_PATH_VBOX_SDK_LIB)/RuntimeR0$(VBOX_SUFF_LIB)47 $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB) 34 48 ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),) 35 49 VBoxDTraceR0_LIBS += \ 36 $( VBOXDT_PATH_VBOX_SDK_LIB)/SUPR0$(VBOX_SUFF_LIB)50 $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB) 37 51 endif 38 39 52 40 53 include $(KBUILD_PATH)/subfooter.kmk -
trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0/VBoxDTraceR0.cpp
r53635 r53636 1 /* $Id$ */ 2 /** @file 3 * VBoxDTraceR0. 4 */ 1 5 6 /* 7 * Copyright (c) 2012 bird 8 * 9 * Permission is hereby granted, free of charge, to any person 10 * obtaining a copy of this software and associated documentation 11 * files (the "Software"), to deal in the Software without 12 * restriction, including without limitation the rights to use, 13 * copy, modify, merge, publish, distribute, sublicense, and/or sell 14 * copies of the Software, and to permit persons to whom the 15 * Software is furnished to do so, subject to the following 16 * conditions: 17 * 18 * The above copyright notice and this permission notice shall be 19 * included in all copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 * OTHER DEALINGS IN THE SOFTWARE. 29 */ 2 30 3 31 #include <VBox/sup.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
r53634 r53636 63 63 * on capital-f functions. 64 64 */ 65 #ifndef VBOX 65 66 #include <sys/errno.h> 66 67 #include <sys/stat.h> … … 91 92 #include <sys/socket.h> 92 93 #include <netinet/in.h> 94 95 #else /* VBOX */ 96 # include <iprt/types.h> 97 # include <sys/dtrace_impl.h> 98 # include <iprt/mp.h> 99 #endif /* VBOX */ 93 100 94 101 /* … … 357 364 if (addr & (size - 1)) { \ 358 365 *flags |= CPU_DTRACE_BADALIGN; \ 359 cpu_core[ CPU->cpu_id].cpuc_dtrace_illval = addr; \366 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = addr; \ 360 367 return (0); \ 361 368 } … … 395 402 uint##bits##_t rval; \ 396 403 int i; \ 404 processorid_t me = VBDT_GET_CPUID(); \ 397 405 volatile uint16_t *flags = (volatile uint16_t *) \ 398 &cpu_core[ CPU->cpu_id].cpuc_dtrace_flags;\406 &cpu_core[me].cpuc_dtrace_flags; \ 399 407 \ 400 408 DTRACE_ALIGNCHECK(addr, size, flags); \ … … 411 419 */ \ 412 420 *flags |= CPU_DTRACE_BADADDR; \ 413 cpu_core[ CPU->cpu_id].cpuc_dtrace_illval = addr;\421 cpu_core[me].cpuc_dtrace_illval = addr; \ 414 422 return (0); \ 415 423 } \ … … 681 689 dtrace_vstate_t *vstate) 682 690 { 683 volatile uintptr_t *illval = &cpu_core[ CPU->cpu_id].cpuc_dtrace_illval;691 volatile uintptr_t *illval = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval; 684 692 685 693 /* … … 773 781 return (0); 774 782 775 flags = (volatile uint16_t *)&cpu_core[ CPU->cpu_id].cpuc_dtrace_flags;783 flags = (volatile uint16_t *)&cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags; 776 784 777 785 do { … … 827 835 if (kaddr - taddr < tsize) { 828 836 DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); 829 cpu_core[ CPU->cpu_id].cpuc_dtrace_illval = kaddr;837 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = kaddr; 830 838 return (1); 831 839 } … … 833 841 if (taddr - kaddr < size) { 834 842 DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); 835 cpu_core[ CPU->cpu_id].cpuc_dtrace_illval = taddr;843 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = taddr; 836 844 return (1); 837 845 } … … 917 925 volatile uint16_t *flags; 918 926 919 flags = (volatile uint16_t *)&cpu_core[ CPU->cpu_id].cpuc_dtrace_flags;927 flags = (volatile uint16_t *)&cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags; 920 928 921 929 if (s1 == s2) … … 1124 1132 1125 1133 bad: 1126 cpu_core[ CPU->cpu_id].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV;1134 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV; 1127 1135 1128 1136 return (0); … … 1140 1148 return (1); 1141 1149 1142 cpu_core[ CPU->cpu_id].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV;1150 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV; 1143 1151 1144 1152 return (0); … … 1151 1159 return (1); 1152 1160 1153 cpu_core[ CPU->cpu_id].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV;1161 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV; 1154 1162 1155 1163 return (0); … … 1162 1170 return (1); 1163 1171 1164 cpu_core[ CPU->cpu_id].cpuc_dtrace_flags |= CPU_DTRACE_KPRIV;1172 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_KPRIV; 1165 1173 1166 1174 return (0); … … 1173 1181 return (1); 1174 1182 1175 cpu_core[ CPU->cpu_id].cpuc_dtrace_flags |= CPU_DTRACE_KPRIV;1183 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_KPRIV; 1176 1184 1177 1185 return (0); … … 1332 1340 dtrace_dynhash_t *hash = dstate->dtds_hash; 1333 1341 dtrace_dynvar_t *free, *new_free, *next, *dvar, *start, *prev = NULL; 1334 processorid_t me = CPU->cpu_id, cpu = me;1342 processorid_t me = VBDT_GET_CPUID(), cpu = me; 1335 1343 dtrace_dstate_percpu_t *dcpu = &dstate->dtds_percpu[me]; 1336 1344 size_t bucket, ksize; … … 2415 2423 { 2416 2424 dtrace_icookie_t cookie; 2417 processorid_t cpu = CPU->cpu_id;2425 processorid_t cpu = VBDT_GET_CPUID(); 2418 2426 dtrace_buffer_t *dest = &state->dts_buffer[cpu]; 2419 2427 dtrace_specid_t i; … … 2681 2689 if ((lwp = curthread->t_lwp) == NULL) { 2682 2690 DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); 2683 cpu_core[ CPU->cpu_id].cpuc_dtrace_illval = NULL;2691 cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = NULL; 2684 2692 return (0); 2685 2693 } … … 3013 3021 dtrace_mstate_t *mstate, dtrace_state_t *state) 3014 3022 { 3015 volatile uint16_t *flags = &cpu_core[ CPU->cpu_id].cpuc_dtrace_flags;3016 volatile uintptr_t *illval = &cpu_core[ CPU->cpu_id].cpuc_dtrace_illval;3023 volatile uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags; 3024 volatile uintptr_t *illval = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval; 3017 3025 dtrace_vstate_t *vstate = &state->dts_vstate; 3018 3026 … … 4481 4489 dtrace_dstate_t *dstate = &vstate->dtvs_dynvars; 4482 4490 dtrace_difv_t *v; 4483 volatile uint16_t *flags = &cpu_core[ CPU->cpu_id].cpuc_dtrace_flags;4484 volatile uintptr_t *illval = &cpu_core[ CPU->cpu_id].cpuc_dtrace_illval;4491 volatile uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags; 4492 volatile uintptr_t *illval = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval; 4485 4493 4486 4494 dtrace_key_t tupregs[DIF_DTR_NREGS + 2]; /* +2 for thread and id */ … … 4874 4882 sz += sizeof (uint64_t); 4875 4883 ASSERT(svar->dtsv_size == NCPU * sz); 4876 a += CPU->cpu_id* sz;4884 a += VBDT_GET_CPUID() * sz; 4877 4885 4878 4886 if (*(uint8_t *)a == UINT8_MAX) { … … 4892 4900 ASSERT(svar->dtsv_size == NCPU * sizeof (uint64_t)); 4893 4901 tmp = (uint64_t *)(uintptr_t)svar->dtsv_data; 4894 regs[rd] = tmp[ CPU->cpu_id];4902 regs[rd] = tmp[VBDT_GET_CPUID()]; 4895 4903 break; 4896 4904 … … 4913 4921 sz += sizeof (uint64_t); 4914 4922 ASSERT(svar->dtsv_size == NCPU * sz); 4915 a += CPU->cpu_id* sz;4923 a += VBDT_GET_CPUID() * sz; 4916 4924 4917 4925 if (regs[rd] == NULL) { … … 4935 4943 ASSERT(svar->dtsv_size == NCPU * sizeof (uint64_t)); 4936 4944 tmp = (uint64_t *)(uintptr_t)svar->dtsv_data; 4937 tmp[ CPU->cpu_id] = regs[rd];4945 tmp[VBDT_GET_CPUID()] = regs[rd]; 4938 4946 break; 4939 4947 … … 5435 5443 int size, offs = 0, i, j; 5436 5444 uintptr_t old = mstate->dtms_scratch_ptr, saved; 5437 uint16_t *flags = &cpu_core[ CPU->cpu_id].cpuc_dtrace_flags;5445 uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags; 5438 5446 char *sym; 5439 5447 … … 5569 5577 cookie = dtrace_interrupt_disable(); 5570 5578 probe = dtrace_probes[id - 1]; 5571 cpuid = CPU->cpu_id;5579 cpuid = VBDT_GET_CPUID(); 5572 5580 onintr = CPU_ON_INTR(CPU); 5573 5581 … … 10074 10082 dtrace_icookie_t cookie = dtrace_interrupt_disable(); 10075 10083 10076 buf = &state->dts_buffer[ CPU->cpu_id];10084 buf = &state->dts_buffer[VBDT_GET_CPUID()]; 10077 10085 10078 10086 if (buf->dtb_tomax != NULL) { … … 12639 12647 */ 12640 12648 cookie = dtrace_interrupt_disable(); 12641 *cpu = CPU->cpu_id;12649 *cpu = VBDT_GET_CPUID(); 12642 12650 ASSERT(state->dts_buffer[*cpu].dtb_flags & DTRACEBUF_INACTIVE); 12643 12651 state->dts_buffer[*cpu].dtb_flags &= ~DTRACEBUF_INACTIVE; … … 12740 12748 12741 12749 cookie = dtrace_interrupt_disable(); 12742 *cpu = CPU->cpu_id;12750 *cpu = VBDT_GET_CPUID(); 12743 12751 dtrace_probe(dtrace_probeid_end, 12744 12752 (uint64_t)(uintptr_t)state, 0, 0, 0, 0); … … 13055 13063 uint32_t size, next, nnext, i; 13056 13064 dtrace_helptrace_t *ent; 13057 uint16_t flags = cpu_core[ CPU->cpu_id].cpuc_dtrace_flags;13065 uint16_t flags = cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags; 13058 13066 13059 13067 if (!dtrace_helptrace_enabled) … … 13096 13104 mstate->dtms_fltoffs : -1; 13097 13105 ent->dtht_fault = DTRACE_FLAGS2FLT(flags); 13098 ent->dtht_illval = cpu_core[ CPU->cpu_id].cpuc_dtrace_illval;13106 ent->dtht_illval = cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval; 13099 13107 13100 13108 for (i = 0; i < vstate->dtvs_nlocals; i++) { … … 13106 13114 ASSERT(svar->dtsv_size >= NCPU * sizeof (uint64_t)); 13107 13115 ent->dtht_locals[i] = 13108 ((uint64_t *)(uintptr_t)svar->dtsv_data)[ CPU->cpu_id];13116 ((uint64_t *)(uintptr_t)svar->dtsv_data)[VBDT_GET_CPUID()]; 13109 13117 } 13110 13118 } … … 13114 13122 dtrace_state_t *state, uint64_t arg0, uint64_t arg1) 13115 13123 { 13116 uint16_t *flags = &cpu_core[ CPU->cpu_id].cpuc_dtrace_flags;13124 uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags; 13117 13125 uint64_t sarg0 = mstate->dtms_arg[0]; 13118 13126 uint64_t sarg1 = mstate->dtms_arg[1]; -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h
r53634 r53636 45 45 #ifndef _ASM 46 46 47 #ifndef VBOX 47 48 #include <sys/types.h> 48 49 #include <sys/modctl.h> … … 52 53 #include <sys/cyclic.h> 53 54 #include <sys/int_limits.h> 55 #else 56 # include <VBoxDTraceTypes.h> 57 #endif 54 58 55 59 /* … … 815 819 uint_t dtdo_refcnt; /* owner reference count */ 816 820 uint_t dtdo_destructive; /* invokes destructive subroutines */ 817 #if ndef _KERNEL821 #if !defined(_KERNEL) || defined(IN_RING3) 818 822 dof_relodesc_t *dtdo_kreltab; /* kernel relocations */ 819 823 dof_relodesc_t *dtdo_ureltab; /* user relocations */ … … 1293 1297 #define DTRACEMNRN_CLONE 2 /* first clone minor */ 1294 1298 1295 #if def _KERNEL1299 #if defined(_KERNEL) || defined(IN_RING0) 1296 1300 1297 1301 /* … … 2205 2209 extern void dtrace_toxic_ranges(void (*)(uintptr_t, uintptr_t)); 2206 2210 extern void dtrace_xcall(processorid_t, dtrace_xcall_t, void *); 2211 #ifdef VBOX 2212 extern void dtrace_vpanic(const char *, va_list); 2213 #else 2207 2214 extern void dtrace_vpanic(const char *, __va_list); 2215 #endif 2208 2216 extern void dtrace_panic(const char *, ...); 2209 2217 … … 2226 2234 #endif 2227 2235 2236 #ifndef VBOX 2237 # define VBDT_GET_CPUID() (CPU->cpu_id) 2238 #else 2239 # define VBDT_GET_CPUID() (RTMpCpuId()) 2240 #endif 2241 2242 2228 2243 #define DTRACE_CPUFLAG_ISSET(flag) \ 2229 (cpu_core[ CPU->cpu_id].cpuc_dtrace_flags & (flag))2244 (cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags & (flag)) 2230 2245 2231 2246 #define DTRACE_CPUFLAG_SET(flag) \ 2232 (cpu_core[ CPU->cpu_id].cpuc_dtrace_flags |= (flag))2247 (cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= (flag)) 2233 2248 2234 2249 #define DTRACE_CPUFLAG_CLEAR(flag) \ 2235 (cpu_core[ CPU->cpu_id].cpuc_dtrace_flags &= ~(flag))2236 2237 #endif /* _KERNEL */2250 (cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags &= ~(flag)) 2251 2252 #endif /* _KERNEL || IN_RING0 */ 2238 2253 2239 2254 #endif /* _ASM */ -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace_impl.h
r53634 r53636 28 28 #define _SYS_DTRACE_IMPL_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #ifdef __cplusplus
Note:
See TracChangeset
for help on using the changeset viewer.