From a1140a7a60e3883a4bfcf6032d56127fd3d1a37f Mon Sep 17 00:00:00 2001 From: markj Date: Tue, 26 Feb 2019 16:34:43 +0000 Subject: [PATCH] Remove illumos-specific code from the x86 fasttrap_isa.c. The file has not been touched upstream in over a decade, and the nature of the code means that a lot of FreeBSD-specific bits are required. Remove the dead code to improve readability. No functional change intended. Discussed with: cem MFC after: 1 week Sponsored by: The FreeBSD Foundation --- .../uts/intel/dtrace/fasttrap_isa.c | 93 ------------------- 1 file changed, 93 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c b/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c index 94e871ea417..99f12346265 100644 --- a/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c +++ b/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c @@ -28,21 +28,11 @@ * Use is subject to license terms. */ -#ifdef illumos -#pragma ident "%Z%%M% %I% %E% SMI" -#endif - #include #include #include #include #include -#ifdef illumos -#include -#include -#include -#include -#else #include #include #include @@ -53,14 +43,8 @@ #include #include #include -#endif #include -#ifdef illumos -#include -#include -#else #include -#endif /* illumos */ #ifdef __i386__ #define r_rax r_eax @@ -707,16 +691,9 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, fasttrap_tracepoint_t *tp; fasttrap_bucket_t *bucket; fasttrap_id_t *id; -#ifdef illumos - kmutex_t *pid_mtx; - - pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock; - mutex_enter(pid_mtx); -#else struct rm_priotracker tracker; rm_rlock(&fasttrap_tp_lock, &tracker); -#endif bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)]; for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) { @@ -731,11 +708,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, * is not essential to the correct execution of the process. */ if (tp == NULL) { -#ifdef illumos - mutex_exit(pid_mtx); -#else rm_runlock(&fasttrap_tp_lock, &tracker); -#endif return; } @@ -756,30 +729,12 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, rp->r_rax, rp->r_rbx, 0, 0); } -#ifdef illumos - mutex_exit(pid_mtx); -#else rm_runlock(&fasttrap_tp_lock, &tracker); -#endif } static void fasttrap_sigsegv(proc_t *p, kthread_t *t, uintptr_t addr) { -#ifdef illumos - sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP); - - sqp->sq_info.si_signo = SIGSEGV; - sqp->sq_info.si_code = SEGV_MAPERR; - sqp->sq_info.si_addr = (caddr_t)addr; - - mutex_enter(&p->p_lock); - sigaddqa(p, t, sqp); - mutex_exit(&p->p_lock); - - if (t != NULL) - aston(t); -#else ksiginfo_t *ksi = kmem_zalloc(sizeof (ksiginfo_t), KM_SLEEP); ksiginfo_init(ksi); @@ -787,7 +742,6 @@ fasttrap_sigsegv(proc_t *p, kthread_t *t, uintptr_t addr) ksi->ksi_code = SEGV_MAPERR; ksi->ksi_addr = (caddr_t)addr; (void) tdksignal(t, SIGSEGV, ksi); -#endif } #ifdef __amd64 @@ -971,9 +925,6 @@ fasttrap_pid_probe(struct trapframe *tf) uintptr_t pc; uintptr_t new_pc = 0; fasttrap_bucket_t *bucket; -#ifdef illumos - kmutex_t *pid_mtx; -#endif fasttrap_tracepoint_t *tp, tp_local; pid_t pid; dtrace_icookie_t cookie; @@ -1013,15 +964,6 @@ fasttrap_pid_probe(struct trapframe *tf) * parent. We know that there's only one thread of control in such a * process: this one. */ -#ifdef illumos - while (p->p_flag & SVFORK) { - p = p->p_parent; - } - - pid = p->p_pid; - pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock; - mutex_enter(pid_mtx); -#else pp = p; sx_slock(&proctree_lock); while (pp->p_vmspace == pp->p_pptr->p_vmspace) @@ -1045,7 +987,6 @@ fasttrap_pid_probe(struct trapframe *tf) sx_sunlock(&proctree_lock); rm_rlock(&fasttrap_tp_lock, &tracker); -#endif bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)]; @@ -1064,10 +1005,6 @@ fasttrap_pid_probe(struct trapframe *tf) * fasttrap_ioctl), or somehow we have mislaid this tracepoint. */ if (tp == NULL) { -#ifdef illumos - mutex_exit(pid_mtx); - return (-1); -#else rm_runlock(&fasttrap_tp_lock, &tracker); gen = atomic_load_acq_64(&pp->p_fasttrap_tp_gen); if (pp != p) @@ -1088,7 +1025,6 @@ fasttrap_pid_probe(struct trapframe *tf) return (0); } return (-1); -#endif } if (pp != p) PRELE(pp); @@ -1210,11 +1146,7 @@ fasttrap_pid_probe(struct trapframe *tf) * tracepoint again later if we need to light up any return probes. */ tp_local = *tp; -#ifdef illumos - mutex_exit(pid_mtx); -#else rm_runlock(&fasttrap_tp_lock, &tracker); -#endif tp = &tp_local; /* @@ -1534,28 +1466,6 @@ fasttrap_pid_probe(struct trapframe *tf) uint8_t scratch[2 * FASTTRAP_MAX_INSTR_SIZE + 7]; #endif uint_t i = 0; -#ifdef illumos - klwp_t *lwp = ttolwp(curthread); - - /* - * Compute the address of the ulwp_t and step over the - * ul_self pointer. The method used to store the user-land - * thread pointer is very different on 32- and 64-bit - * kernels. - */ -#if defined(__amd64) - if (p->p_model == DATAMODEL_LP64) { - addr = lwp->lwp_pcb.pcb_fsbase; - addr += sizeof (void *); - } else { - addr = lwp->lwp_pcb.pcb_gsbase; - addr += sizeof (caddr32_t); - } -#else - addr = USD_GETBASE(&lwp->lwp_pcb.pcb_gsdesc); - addr += sizeof (void *); -#endif -#else /* !illumos */ fasttrap_scrspace_t *scrspace; scrspace = fasttrap_scraddr(curthread, tp->ftt_proc); if (scrspace == NULL) { @@ -1571,7 +1481,6 @@ fasttrap_pid_probe(struct trapframe *tf) break; } addr = scrspace->ftss_addr; -#endif /* illumos */ /* * Generic Instruction Tracing @@ -1813,11 +1722,9 @@ fasttrap_pid_probe(struct trapframe *tf) rp->r_rip = new_pc; -#ifndef illumos PROC_LOCK(p); proc_write_regs(curthread, rp); PROC_UNLOCK(p); -#endif return (0); } -- 2.45.0