Module Name: src Committed By: martin Date: Wed Feb 12 19:55:57 UTC 2020
Modified Files: src/external/cddl/osnet/dev/dtrace/aarch64 [netbsd-9]: dtrace_isa.c dtrace_subr.c src/external/cddl/osnet/dev/fbt/aarch64 [netbsd-9]: fbt_isa.c src/external/cddl/osnet/dist/lib/libdtrace/common [netbsd-9]: dt_impl.h dt_module.c dt_open.c src/sys/arch/aarch64/aarch64 [netbsd-9]: vectors.S src/sys/arch/aarch64/include [netbsd-9]: cpu.h src/sys/modules/cyclic [netbsd-9]: Makefile Log Message: Pull up following revision(s) (requested by riastradh in ticket #701): external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c: revision 1.2 external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c: revision 1.17 external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c: revision 1.18 sys/modules/cyclic/Makefile: revision 1.5 external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c: revision 1.2 external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c: revision 1.3 sys/arch/aarch64/aarch64/vectors.S: revision 1.10 external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c: revision 1.2 external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c: revision 1.3 external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c: revision 1.4 external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c: revision 1.5 external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c: revision 1.6 sys/arch/aarch64/include/cpu.h: revision 1.20 external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h: revision 1.9 Create a buffer space of 512 bytes before the trapframe. dtrace fbt needs enough space to emulate an stp x29, x30, [sp,#-FRAMESIZE]! instruction in a function prologue. In the aarch64 instruction encoding, FRAMESIZE can be as large as 512 bytes, so reserve this much space when KDTRACE_HOOKS is enabled. Use db_write_bytes to overwrite kernel text. Tidy up a bit. No functional change intended. aarch64 fbt_invop doesn't actually use the argument, but it would make more sense for it to be the return value and/or first argument register. Certainly it's not `eax'! Tidy up a bit: don't set things we won't use; assert nonzeroness. Use /dev/ksyms, not /netbsd, for the running kernel's symbols. Teach dtrace about el1_trap_exit frames on aarch64. Implement dtrace_getarg and dtrace_getreg while here. Count the number of artificial frames in aarch64 fbt probe correctly. Change the address ranges that aarch64 considers toxic for dtrace. `Toxic' means dtrace forbids D scripts from even attempting to read or write at them. Previously we considered [0, VM_MIN_KERNEL_ADDRESS) toxic, but VM_MIN_KERNEL_ADDRESS is only the minimum address of the kernel map; the direct-mapped region lies below it, and with PMAP_MAP_POOLPAGE we allocate virtual pages for pool backing directly from physical pages through the direct-mapped region. Also, this did not consider I/O mappings to be toxic, which they probably should be. Instead, treat: [0, AARCH64_KSEG_START) and [VM_KERNEL_IO_ADDRESS, 0xfff...ff) as toxic. (The upper bound for 0xfff...ff ought to be inclusive, not exclusive, but I think we'll need another mechanism for expressing that to dtrace!) Switch from db_write_bytes to using direct-mapping. This way there's no dependency on ddb. Define the MULTIPROCESSOR cpu_number() for modules too. Modules should work whether the main kernel is multiprocessor or not. In particular, dtrace should not think cpu_number() is 0 while cpu_index(curcpu()) and curcpu()->ci_index are nonzero, leading to rather spectacularly bogus results... cyclic.kmod needs -Wno-sign-compare for aarch64 CPU_INFO_FOREACH. Provisional workaround; feel free to fix. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c \ src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c cvs rdiff -u -r1.8 -r1.8.4.1 \ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h cvs rdiff -u -r1.17 -r1.17.4.1 \ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c cvs rdiff -u -r1.16 -r1.16.2.1 \ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/aarch64/aarch64/vectors.S cvs rdiff -u -r1.13.4.1 -r1.13.4.2 src/sys/arch/aarch64/include/cpu.h cvs rdiff -u -r1.3.34.1 -r1.3.34.2 src/sys/modules/cyclic/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c diff -u src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c:1.1.2.2 src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c:1.1.2.3 --- src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c:1.1.2.2 Mon Dec 9 15:19:30 2019 +++ src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_isa.c Wed Feb 12 19:55:56 2020 @@ -89,52 +89,60 @@ void dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, uint32_t *intrpc) { - struct unwind_state state; - int scp_offset; - register_t sp, fp; - int depth; - - depth = 0; - - if (intrpc != 0) { - pcstack[depth++] = (pc_t) intrpc; + extern const char el1_trap_exit[]; + const register_t *fp; + int i = 0; + + if (intrpc) { + if (i < pcstack_limit) + pcstack[i++] = (pc_t)intrpc; } - aframes++; - - __asm __volatile("mov %0, sp" : "=&r" (sp)); - - state.fp = (uint64_t)__builtin_frame_address(0); - state.sp = sp; - state.pc = (uint64_t)dtrace_getpcstack; - - while (depth < pcstack_limit) { - if (!INKERNEL(state.pc) || !INKERNEL(state.fp)) - break; - - fp = state.fp; - state.sp = fp + 0x10; - /* FP to previous frame (X29) */ - state.fp = *(register_t *)(fp); - /* LR (X30) */ - state.pc = *(register_t *)(fp + 8) - 4; - - /* - * NB: Unlike some other architectures, we don't need to - * explicitly insert cpu_dtrace_caller as it appears in the - * normal kernel stack trace rather than a special trap frame. - */ - if (aframes > 0) { + /* + * fp[0] = x29 (saved frame pointer) + * fp[1] = x30 (saved link register == return address) + */ + fp = __builtin_frame_address(0); + while (i < pcstack_limit && INKERNEL(fp[0]) && INKERNEL(fp[1])) { + /* Skip the specified number of artificial frames. */ + if (aframes > 0) aframes--; + else + pcstack[i++] = fp[1]; + + /* Check whether this frame is handling a trap. */ + if (fp[1] == (register_t)el1_trap_exit) { + /* + * Trap from kernel. The trapframe is the + * saved frame pointer of the call to the trap + * handler whose return address is + * el1_trap_exit. The frame pointer of the + * interrupted code is in x29 stashed in the + * trapframe, alongside its pc. + */ + const struct trapframe *tf = (const void *)fp[0]; + /* x29 = frame pointer */ + fp = (const void *)tf->tf_regs.r_reg[29]; + if (INKERNEL(tf->tf_pc)) { + if (i >= pcstack_limit) + break; + if (aframes > 0) + aframes--; + else + pcstack[i++] = tf->tf_pc; + } } else { - pcstack[depth++] = state.pc; + /* + * Not a trap. Keep going with fp[0] as the + * parent frame pointer. + */ + fp = (const void *)fp[0]; } - } - for (; depth < pcstack_limit; depth++) { - pcstack[depth] = 0; - } + /* Zero the rest of the return address stack. (Paranoia?) */ + while (i < pcstack_limit) + pcstack[i++] = 0; } static int @@ -282,48 +290,78 @@ dtrace_getufpstack(uint64_t *pcstack, ui uint64_t dtrace_getarg(int arg, int aframes) { + extern const char el1_trap_exit[]; + const register_t *fp; + const struct trapframe *tf = NULL; + int i = 0; - printf("IMPLEMENT ME: %s\n", __func__); + /* + * The first arguments are passed in x0,...,x7. The rest are + * on the stack, too much trouble to figure out. + * + * XXX Shouldn't we ask ctf or dwarf or something to figure + * this stuff out for us? + */ + KASSERT(arg >= 0); + if (arg >= 8) + return 0; + + fp = __builtin_frame_address(0); + while (i < 1000 && INKERNEL(fp[0]) && INKERNEL(fp[1])) { + if (aframes > 0) + aframes--; + else + i++; + if (fp[1] == (register_t)el1_trap_exit) { + tf = (const void *)fp[0]; + break; + } else { + fp = (const void *)fp[0]; + } + } - return (0); + /* If we didn't find a trap frame, give up. */ + if (tf == NULL) + return 0; + + /* Arg0, arg1, ..., arg7 are in registers x0, x1, ..., x7. */ + return tf->tf_regs.r_reg[arg]; } int dtrace_getstackdepth(int aframes) { - struct unwind_state state; - int scp_offset; - register_t sp; - int depth; - int done; - - depth = 1; - done = 0; - - __asm __volatile("mov %0, sp" : "=&r" (sp)); - - state.fp = (uint64_t)__builtin_frame_address(0); - state.sp = sp; - state.pc = (uint64_t)dtrace_getstackdepth; - - do { - done = unwind_frame(&state); - if (!INKERNEL(state.pc) || !INKERNEL(state.fp)) - break; - depth++; - } while (!done); + extern const char el1_trap_exit[]; + const register_t *fp; + int i = 0; + + fp = __builtin_frame_address(0); + while (i < 1000 && INKERNEL(fp[0]) && INKERNEL(fp[1])) { + if (aframes > 0) + aframes--; + else + i++; + if (fp[1] == (register_t)el1_trap_exit) { + const struct trapframe *tf = (const void *)fp[0]; + fp = (const void *)tf->tf_regs.r_reg[29]; + if (aframes > 0) + aframes--; + else + i++; + } else { + fp = (const void *)fp[0]; + } + } - if (depth < aframes) - return (0); - else - return (depth - aframes); + return i; } ulong_t -dtrace_getreg(struct trapframe *rp, uint_t reg) +dtrace_getreg(struct trapframe *tf, uint_t reg) { - printf("IMPLEMENT ME: %s\n", __func__); + if (reg < 32) + return tf->tf_regs.r_reg[reg]; return (0); } Index: src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c diff -u src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.1.2.2 src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.1.2.3 --- src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.1.2.2 Mon Dec 9 15:19:30 2019 +++ src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c Wed Feb 12 19:55:56 2020 @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dtrace_subr.c,v 1.1.2.2 2019/12/09 15:19:30 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dtrace_subr.c,v 1.1.2.3 2020/02/12 19:55:56 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -69,13 +69,13 @@ typedef struct dtrace_invop_hdlr { dtrace_invop_hdlr_t *dtrace_invop_hdlr; int -dtrace_invop(uintptr_t addr, struct trapframe *frame, uintptr_t eax) +dtrace_invop(uintptr_t addr, struct trapframe *frame, uintptr_t r0) { dtrace_invop_hdlr_t *hdlr; int rval; for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) - if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) + if ((rval = hdlr->dtih_func(addr, frame, r0)) != 0) return (rval); return (0); @@ -128,7 +128,8 @@ void dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit)) { - (*func)(0, (uintptr_t)VM_MIN_KERNEL_ADDRESS); + (*func)(0, (uintptr_t)AARCH64_KSEG_START); + (*func)((uintptr_t)VM_KERNEL_IO_ADDRESS, ~(uintptr_t)0); } static void @@ -263,7 +264,7 @@ dtrace_invop_start(struct trapframe *fra int tmp; int i; - invop = dtrace_invop(frame->tf_pc, frame, frame->tf_pc); + invop = dtrace_invop(frame->tf_pc, frame, frame->tf_regs.r_reg[0]); tmp = (invop & LDP_STP_MASK); if (tmp == STP_64 || tmp == LDP_64) { Index: src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c diff -u src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.1.2.2 src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.1.2.3 --- src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.1.2.2 Mon Dec 9 15:19:31 2019 +++ src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c Wed Feb 12 19:55:57 2020 @@ -36,6 +36,11 @@ #include <sys/cpu.h> #include <sys/module.h> #include <sys/kmem.h> + +#include <uvm/uvm_extern.h> + +#include <dev/mm.h> + #include <machine/cpufunc.h> #include <sys/dtrace.h> @@ -49,8 +54,19 @@ #define FBT_ENTRY "entry" #define FBT_RETURN "return" +/* + * How many artificial frames appear between dtrace_probe and the + * interrupted function call? + * + * fbt_invop + * dtrace_invop + * dtrace_invop_start + * el1_trap_exit + */ +#define FBT_AFRAMES 4 + int -fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t rval) +fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t r0) { solaris_cpu_t *cpu; fbt_probe_t *fbt; @@ -67,6 +83,7 @@ fbt_invop(uintptr_t addr, struct trapfra frame->tf_regs.r_reg[3], frame->tf_regs.r_reg[4]); cpu->cpu_dtrace_caller = 0; + KASSERT(fbt->fbtp_savedval != 0); return (fbt->fbtp_savedval); } } @@ -77,9 +94,15 @@ fbt_invop(uintptr_t addr, struct trapfra void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { + paddr_t pa; + vaddr_t va; - *fbt->fbtp_patchpoint = val; - cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, 4); + if (!pmap_extract(pmap_kernel(), (vaddr_t)fbt->fbtp_patchpoint, &pa)) + return; + if (!mm_md_direct_mapped_phys(pa, &va)) + return; + *(fbt_patchval_t *)va = val; + cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, sizeof(val)); } #if defined(__FreeBSD__) @@ -138,6 +161,7 @@ fbt_provide_module_cb(const char *name, if (instr >= limit) return (0); + KASSERT(*instr != 0); #ifdef __FreeBSD__ fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); @@ -146,7 +170,7 @@ fbt_provide_module_cb(const char *name, #endif fbt->fbtp_name = name; fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_ENTRY, 3, fbt); + name, FBT_ENTRY, FBT_AFRAMES, fbt); fbt->fbtp_patchpoint = instr; #ifdef __FreeBSD__ fbt->fbtp_ctl = lf; @@ -157,7 +181,6 @@ fbt_provide_module_cb(const char *name, #endif fbt->fbtp_savedval = *instr; fbt->fbtp_patchval = FBT_PATCHVAL; - fbt->fbtp_rval = DTRACE_INVOP_PUSHM; fbt->fbtp_symindx = symindx; fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; @@ -188,6 +211,7 @@ again: if (instr >= limit) return (0); + KASSERT(*instr != 0); /* * We have a winner! @@ -200,7 +224,7 @@ again: fbt->fbtp_name = name; if (retfbt == NULL) { fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_RETURN, 3, fbt); + name, FBT_RETURN, FBT_AFRAMES, fbt); } else { retfbt->fbtp_next = fbt; fbt->fbtp_id = retfbt->fbtp_id; @@ -215,13 +239,10 @@ again: #ifdef __NetBSD__ fbt->fbtp_ctl = mod; #endif - fbt->fbtp_symindx = symindx; - if ((*instr & B_MASK) == B_INSTR) - fbt->fbtp_rval = DTRACE_INVOP_B; - else - fbt->fbtp_rval = DTRACE_INVOP_RET; fbt->fbtp_savedval = *instr; fbt->fbtp_patchval = FBT_PATCHVAL; + fbt->fbtp_symindx = symindx; + fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; fbt_probetab[FBT_ADDR2NDX(instr)] = fbt; Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h:1.8 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h:1.8.4.1 --- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h:1.8 Mon May 28 21:05:05 2018 +++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h Wed Feb 12 19:55:56 2020 @@ -750,8 +750,6 @@ extern int yylex(void); #endif #ifdef __NetBSD__ -extern const char *dt_bootfile(char *, size_t); - #define longlong_t long long #define u_longlong_t unsigned long long #define __DECONST(a, b) __UNCONST(b) Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c:1.17 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c:1.17.4.1 --- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c:1.17 Sat Jun 2 01:19:46 2018 +++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Wed Feb 12 19:55:56 2020 @@ -43,6 +43,7 @@ #endif #ifdef __NetBSD__ #include <sys/sysctl.h> +#include <paths.h> #endif #include <unistd.h> @@ -1185,9 +1186,7 @@ dt_module_update(dtrace_hdl_t *dtp, stru bool ismod; if (strcmp("netbsd", name) == 0) { - /* want the kernel, but it is not absolute */ - dt_bootfile(machine, sizeof(machine)); - snprintf(fname, sizeof(fname), "/%s", machine); + strlcpy(fname, _PATH_KSYMS, sizeof fname); ismod = false; } else { Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c:1.16 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c:1.16.2.1 --- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c:1.16 Wed Jul 24 16:57:45 2019 +++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c Wed Feb 12 19:55:56 2020 @@ -1025,24 +1025,15 @@ dt_get_sysinfo(int cmd, char *buf, size_ } #endif -#ifndef illumos -# ifdef __FreeBSD__ -# define DEFKERNEL "kernel" -# define BOOTFILE "kern.bootfile" -# endif -# ifdef __NetBSD__ -# define DEFKERNEL "netbsd" -# define BOOTFILE "machdep.booted_kernel" -# endif - -const char * +#ifdef __FreeBSD__ +static const char * dt_bootfile(char *bootfile, size_t len) { char *p; size_t olen = len; - if (sysctlbyname(BOOTFILE, bootfile, &len, NULL, 0) != 0) - strlcpy(bootfile, DEFKERNEL, olen); + if (sysctlbyname("kern.bootfile", bootfile, &len, NULL, 0) != 0) + strlcpy(bootfile, "kernel", olen); if ((p = strrchr(bootfile, '/')) != NULL) p++; @@ -1050,9 +1041,6 @@ dt_bootfile(char *bootfile, size_t len) p = bootfile; return p; } - -# undef DEFKERNEL -# undef BOOTFILE #endif static dtrace_hdl_t * Index: src/sys/arch/aarch64/aarch64/vectors.S diff -u src/sys/arch/aarch64/aarch64/vectors.S:1.9 src/sys/arch/aarch64/aarch64/vectors.S:1.9.4.1 --- src/sys/arch/aarch64/aarch64/vectors.S:1.9 Fri Oct 12 01:28:57 2018 +++ src/sys/arch/aarch64/aarch64/vectors.S Wed Feb 12 19:55:57 2020 @@ -1,8 +1,20 @@ -/* $NetBSD: vectors.S,v 1.9 2018/10/12 01:28:57 ryo Exp $ */ +/* $NetBSD: vectors.S,v 1.9.4.1 2020/02/12 19:55:57 martin Exp $ */ #include <aarch64/asm.h> #include "assym.h" #include "opt_ddb.h" +#include "opt_dtrace.h" + +#ifdef KDTRACE_HOOKS +/* + * dtrace needs to emulate stp x29,x30,[sp,#-FRAMESIZE]! where + * FRAMESIZE can be as large as 512, so create a 512-byte buffer + * between the interrupted code's frame and our struct trapframe. + */ +#define TRAP_FRAMESIZE (TF_SIZE + 512) +#else +#define TRAP_FRAMESIZE TF_SIZE +#endif /* * vector_entry macro must be small enough to fit 0x80 bytes! @@ -11,7 +23,7 @@ .align 7 /* aligned 0x80 */ .if \el == 1 - sub sp, sp, #TF_SIZE /* need to allocate stack on el1 */ + sub sp, sp, #TRAP_FRAMESIZE /* need to allocate stack on el1 */ .endif stp x0, x1, [sp, #TF_X0] @@ -35,7 +47,7 @@ .if \el == 0 mrs x20, sp_el0 .else - add x20, sp, #TF_SIZE /* sp is already adjusted */ + add x20, sp, #TRAP_FRAMESIZE /* sp is already adjusted */ .endif mrs x21, elr_el1 Index: src/sys/arch/aarch64/include/cpu.h diff -u src/sys/arch/aarch64/include/cpu.h:1.13.4.1 src/sys/arch/aarch64/include/cpu.h:1.13.4.2 --- src/sys/arch/aarch64/include/cpu.h:1.13.4.1 Wed Oct 23 19:14:19 2019 +++ src/sys/arch/aarch64/include/cpu.h Wed Feb 12 19:55:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.13.4.1 2019/10/23 19:14:19 martin Exp $ */ +/* $NetBSD: cpu.h,v 1.13.4.2 2020/02/12 19:55:57 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -130,7 +130,7 @@ extern uint64_t cpu_mpidr[]; /* MULTIPR bool cpu_hatched_p(u_int); /* MULTIPROCESSOR */ #define CPU_INFO_ITERATOR cpuid_t -#ifdef MULTIPROCESSOR +#if defined(MULTIPROCESSOR) || defined(_MODULE) #define cpu_number() (curcpu()->ci_index) #define CPU_IS_PRIMARY(ci) ((ci)->ci_index == 0) #define CPU_INFO_FOREACH(cii, ci) \ Index: src/sys/modules/cyclic/Makefile diff -u src/sys/modules/cyclic/Makefile:1.3.34.1 src/sys/modules/cyclic/Makefile:1.3.34.2 --- src/sys/modules/cyclic/Makefile:1.3.34.1 Mon Dec 9 15:19:31 2019 +++ src/sys/modules/cyclic/Makefile Wed Feb 12 19:55:56 2020 @@ -25,6 +25,6 @@ CPPFLAGS+= -I${OSNETDIR}/sys \ -I${OSNETDIR}/dev/cyclic/${ARCH} \ -I${OSNETDIR}/dist/uts/common -CPPFLAGS+= -Wno-unknown-pragmas -Wno-cast-qual +CPPFLAGS+= -Wno-unknown-pragmas -Wno-cast-qual -Wno-sign-compare .include <bsd.kmodule.mk>