The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/cddl/dev/kinst/kinst.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * SPDX-License-Identifier: CDDL 1.0
    3  *
    4  * Copyright 2022 Christos Margiolis <christos@FreeBSD.org>
    5  */
    6 
    7 #ifndef _KINST_H_
    8 #define _KINST_H_
    9 
   10 #include <sys/dtrace.h>
   11 
   12 typedef struct {
   13         char    kpd_func[DTRACE_FUNCNAMELEN];
   14         char    kpd_mod[DTRACE_MODNAMELEN];
   15         int     kpd_off;
   16 } dtrace_kinst_probedesc_t;
   17 
   18 #define KINSTIOC_MAKEPROBE      _IOW('k', 1, dtrace_kinst_probedesc_t)
   19 
   20 #ifdef _KERNEL
   21 
   22 #include <sys/queue.h>
   23 
   24 #include "kinst_isa.h"
   25 
   26 struct kinst_probe {
   27         LIST_ENTRY(kinst_probe) kp_hashnext;
   28         const char              *kp_func;
   29         char                    kp_name[16];
   30         dtrace_id_t             kp_id;
   31         kinst_patchval_t        kp_patchval;
   32         kinst_patchval_t        kp_savedval;
   33         kinst_patchval_t        *kp_patchpoint;
   34 
   35         struct kinst_probe_md   kp_md;
   36 };
   37 
   38 LIST_HEAD(kinst_probe_list, kinst_probe);
   39 
   40 extern struct kinst_probe_list  *kinst_probetab;
   41 
   42 #define KINST_PROBETAB_MAX      0x8000  /* 32k */
   43 #define KINST_ADDR2NDX(addr)    (((uintptr_t)(addr)) & (KINST_PROBETAB_MAX - 1))
   44 #define KINST_GETPROBE(i)       (&kinst_probetab[KINST_ADDR2NDX(i)])
   45 
   46 struct linker_file;
   47 struct linker_symval;
   48 
   49 int     kinst_invop(uintptr_t, struct trapframe *, uintptr_t);
   50 int     kinst_make_probe(struct linker_file *, int, struct linker_symval *,
   51             void *);
   52 void    kinst_patch_tracepoint(struct kinst_probe *, kinst_patchval_t);
   53 void    kinst_probe_create(struct kinst_probe *, struct linker_file *);
   54 
   55 int     kinst_trampoline_init(void);
   56 int     kinst_trampoline_deinit(void);
   57 uint8_t *kinst_trampoline_alloc(int);
   58 void    kinst_trampoline_dealloc(uint8_t *);
   59 
   60 int     kinst_md_init(void);
   61 void    kinst_md_deinit(void);
   62 
   63 #ifdef MALLOC_DECLARE
   64 MALLOC_DECLARE(M_KINST);
   65 #endif /* MALLOC_DECLARE */
   66 
   67 #define KINST_LOG_HELPER(fmt, ...)      \
   68         printf("%s:%d: " fmt "%s\n", __func__, __LINE__, __VA_ARGS__)
   69 #define KINST_LOG(...)                  \
   70         KINST_LOG_HELPER(__VA_ARGS__, "")
   71 
   72 #endif /* _KERNEL */
   73 
   74 #endif /* _KINST_H_ */

Cache object: 11ae0474ef784806124f5e3014bf3f8a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.