CVS commit: src/external/cddl/osnet/dev/fbt/arm

2023-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 22 15:12:54 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/fbt/arm: fbt_isa.c

Log Message:
dtrace_fbt: Read and write instructions appropriately-endian on arm.

arm is a little more complicated because it has three cases:
- big-endian data, big-endian instructions
- big-endian data, little-endian instructions
- little-endian data, little-endian instructions


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c

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/fbt/arm/fbt_isa.c
diff -u src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c:1.1 src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c:1.2
--- src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c:1.1	Mon May 28 23:47:39 2018
+++ src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c	Mon May 22 15:12:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt_isa.c,v 1.1 2018/05/28 23:47:39 chs Exp $	*/
+/*	$NetBSD: fbt_isa.c,v 1.2 2023/05/22 15:12:54 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -56,6 +56,26 @@
 #define	FBT_ENTRY	"entry"
 #define	FBT_RETURN	"return"
 
+static uint32_t
+ldinstr(const uint32_t *instr)
+{
+#ifdef _ARM_ARCH_BE8		/* big-endian data, big-endian instructions */
+	return *instr;
+#else/* little-endian instructions */
+	return le32toh(*instr);
+#endif
+}
+
+static void
+stinstr(uint32_t *instr, uint32_t val)
+{
+
+#ifdef _ARM_ARCH_BE8		/* big-endian data, big-endian instructions */
+	val = bswap32(val);
+#endif
+	ktext_write(instr, &val, sizeof(val)); /* write little-endian */
+}
+
 int
 fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t rval)
 {
@@ -98,9 +118,7 @@ fbt_patch_tracepoint(fbt_probe_t *fbt, f
 	dtrace_icookie_t c;
 
 	c = dtrace_interrupt_disable();
-
-	ktext_write(fbt->fbtp_patchpoint, &val, sizeof (val));
-
+	stinstr(fbt->fbtp_patchpoint, val);
 	dtrace_interrupt_enable(c);
 }
 
@@ -126,14 +144,14 @@ fbt_provide_module_function(linker_file_
 	 * va_arg functions has first instruction of
 	 * sub sp, sp, #?
 	 */
-	if ((*instr & 0xf000) == FBT_SUBSP)
+	if ((ldinstr(instr) & 0xf000) == FBT_SUBSP)
 		instr++;
 
 	/*
 	 * check if insn is a pushm with LR
 	 */
-	if ((*instr & 0x) != FBT_PUSHM ||
-	(*instr & (1 << LR)) == 0)
+	if ((ldinstr(instr) & 0x) != FBT_PUSHM ||
+	(ldinstr(instr) & (1 << LR)) == 0)
 		return (0);
 
 	fbt = kmem_zalloc(sizeof (fbt_probe_t), KM_SLEEP);
@@ -143,7 +161,7 @@ fbt_provide_module_function(linker_file_
 	fbt->fbtp_patchpoint = instr;
 	fbt->fbtp_ctl = lf;
 	fbt->fbtp_loadcnt = lf->loadcnt;
-	fbt->fbtp_savedval = *instr;
+	fbt->fbtp_savedval = ldinstr(instr);
 	fbt->fbtp_patchval = FBT_BREAKPOINT;
 	fbt->fbtp_rval = DTRACE_INVOP_PUSHM;
 	fbt->fbtp_symindx = symindx;
@@ -153,18 +171,18 @@ fbt_provide_module_function(linker_file_
 
 	lf->fbt_nentries++;
 
-	popm = FBT_POPM | ((*instr) & 0x3FFF) | 0x8000;
+	popm = FBT_POPM | (ldinstr(instr) & 0x3FFF) | 0x8000;
 
 	retfbt = NULL;
 again:
 	for (; instr < limit; instr++) {
-		if (*instr == popm)
+		if (ldinstr(instr) == popm)
 			break;
-		else if ((*instr & 0xff00) == FBT_JUMP) {
+		else if ((ldinstr(instr) & 0xff00) == FBT_JUMP) {
 			uint32_t *target, *start;
 			int offset;
 
-			offset = (*instr & 0xff);
+			offset = (ldinstr(instr) & 0xff);
 			offset <<= 8;
 			offset /= 64;
 			target = instr + (2 + offset);
@@ -195,11 +213,11 @@ again:
 	fbt->fbtp_ctl = lf;
 	fbt->fbtp_loadcnt = lf->loadcnt;
 	fbt->fbtp_symindx = symindx;
-	if ((*instr & 0xff00) == FBT_JUMP)
+	if ((ldinstr(instr) & 0xff00) == FBT_JUMP)
 		fbt->fbtp_rval = DTRACE_INVOP_B;
 	else
 		fbt->fbtp_rval = DTRACE_INVOP_POPM;
-	fbt->fbtp_savedval = *instr;
+	fbt->fbtp_savedval = ldinstr(instr);
 	fbt->fbtp_patchval = FBT_BREAKPOINT;
 	fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)];
 	fbt_probetab[FBT_ADDR2NDX(instr)] = fbt;
@@ -279,14 +297,14 @@ fbt_provide_module_cb(const char *name, 
 	instr = (uint32_t *) value;
 	limit = (uint32_t *)((uintptr_t)value + symsize);
 
-	if (!FBT_MOV_IP_SP_P(*instr)
-	&& !FBT_BX_LR_P(*instr)
-	&& !FBT_MOVW_P(*instr)
-	&& !FBT_MOV_IMM_P(*instr)
-	&& !FBT_B_LABEL_P(*instr)
-	&& !FBT_LDR_IMM_P(*instr)
-	&& !FBT_CMP_IMM_P(*instr)
-	&& !FBT_PUSH_P(*instr)
+	if (!FBT_MOV_IP_SP_P(ldinstr(instr))
+	&& !FBT_BX_LR_P(ldinstr(instr))
+	&& !FBT_MOVW_P(ldinstr(instr))
+	&& !FBT_MOV_IMM_P(ldinstr(instr))
+	&& !FBT_B_LABEL_P(ldinstr(instr))
+	&& !FBT_LDR_IMM_P(ldinstr(instr))
+	&& !FBT_CMP_IMM_P(ldinstr(instr))
+	&& !FBT_PUSH_P(ldinstr(instr))
 	) {
 		return 0;
 	}
@@ -298,31 +316,39 @@ fbt_provide_module_cb(const char *name, 
 	fbt->fbtp_patchpoint = instr;
 	fbt->fbtp_ctl = mod;
 	/* fbt->fbtp_loadcnt = lf->loadcnt; */
-	if (FBT_MOV_IP_SP_P(*instr))
-		fbt->fbtp_rval = BUILD_RVAL(*instr, DTRACE_INVOP_MOV_IP_SP);
-	

CVS commit: src/external/cddl/osnet/dev/fbt/arm

2023-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 22 15:12:54 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/fbt/arm: fbt_isa.c

Log Message:
dtrace_fbt: Read and write instructions appropriately-endian on arm.

arm is a little more complicated because it has three cases:
- big-endian data, big-endian instructions
- big-endian data, little-endian instructions
- little-endian data, little-endian instructions


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/dev/fbt/arm/fbt_isa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/fbt/aarch64

2023-05-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue May  9 21:29:07 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/fbt/aarch64: fbt_isa.c

Log Message:
dtrace_fbt: Read and write instruction words in little-endian.

Step toward making this work on aarch64eb.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/fbt/aarch64

2023-05-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue May  9 21:29:07 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/fbt/aarch64: fbt_isa.c

Log Message:
dtrace_fbt: Read and write instruction words in little-endian.

Step toward making this work on aarch64eb.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c

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/fbt/aarch64/fbt_isa.c
diff -u src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.7 src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.8
--- src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c:1.7	Wed Mar 24 04:46:41 2021
+++ src/external/cddl/osnet/dev/fbt/aarch64/fbt_isa.c	Tue May  9 21:29:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt_isa.c,v 1.7 2021/03/24 04:46:41 simonb Exp $	*/
+/*	$NetBSD: fbt_isa.c,v 1.8 2023/05/09 21:29:07 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -103,7 +103,7 @@ fbt_patch_tracepoint(fbt_probe_t *fbt, f
 		return;
 	if (!mm_md_direct_mapped_phys(pa, &va))
 		return;
-	*(fbt_patchval_t *)va = val;
+	*(fbt_patchval_t *)va = htole32(val);
 	cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, sizeof(val));
 }
 
@@ -157,7 +157,7 @@ fbt_provide_module_cb(const char *name, 
 
 	/* Look for stp (pre-indexed) operation */
 	for (; instr < limit; instr++) {
-		if ((*instr & LDP_STP_MASK) == STP_64)
+		if ((le32toh(*instr) & LDP_STP_MASK) == STP_64)
 			break;
 	}
 
@@ -181,7 +181,7 @@ fbt_provide_module_cb(const char *name, 
 #ifdef __NetBSD__
 	fbt->fbtp_ctl = mod;
 #endif
-	fbt->fbtp_savedval = *instr;
+	fbt->fbtp_savedval = le32toh(*instr);
 	fbt->fbtp_patchval = FBT_PATCHVAL;
 	fbt->fbtp_symindx = symindx;
 
@@ -195,10 +195,10 @@ fbt_provide_module_cb(const char *name, 
 	retfbt = NULL;
 again:
 	for (; instr < limit; instr++) {
-		if (*instr == RET_INSTR)
+		if (le32toh(*instr) == RET_INSTR)
 			break;
-		else if ((*instr & B_MASK) == B_INSTR) {
-			offs = (*instr & B_DATA_MASK);
+		else if ((le32toh(*instr) & B_MASK) == B_INSTR) {
+			offs = (le32toh(*instr) & B_DATA_MASK);
 			offs *= 4;
 			target = (instr + offs);
 #ifdef __FreeBSD__
@@ -241,7 +241,7 @@ again:
 #ifdef __NetBSD__
 	fbt->fbtp_ctl = mod;
 #endif
-	fbt->fbtp_savedval = *instr;
+	fbt->fbtp_savedval = le32toh(*instr);
 	fbt->fbtp_patchval = FBT_PATCHVAL;
 	fbt->fbtp_symindx = symindx;
 



CVS commit: src/external/cddl/osnet/dev/dtrace/aarch64

2023-04-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr 17 06:57:02 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/dtrace/aarch64: dtrace_subr.c

Log Message:
(missed in pervious commit)

Rename VM_KERNEL_IO_ADDRESS to VM_KERNEL_IO_BASE to match RISC-V

It's less letters, matches other similar variables and will help with
sharing code between the two architectures.

NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c

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_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.5 src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.6
--- src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.5	Tue Apr  6 12:48:36 2021
+++ src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c	Mon Apr 17 06:57:02 2023
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dtrace_subr.c,v 1.5 2021/04/06 12:48:36 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtrace_subr.c,v 1.6 2023/04/17 06:57:02 skrll Exp $");
 
 #include 
 #include 
@@ -129,7 +129,7 @@ dtrace_toxic_ranges(void (*func)(uintptr
 {
 
 	(*func)(0, (uintptr_t)AARCH64_DIRECTMAP_START);
-	(*func)((uintptr_t)VM_KERNEL_IO_ADDRESS, ~(uintptr_t)0);
+	(*func)((uintptr_t)VM_KERNEL_IO_BASE, ~(uintptr_t)0);
 }
 
 static void



CVS commit: src/external/cddl/osnet/dev/dtrace/aarch64

2023-04-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr 17 06:57:02 UTC 2023

Modified Files:
src/external/cddl/osnet/dev/dtrace/aarch64: dtrace_subr.c

Log Message:
(missed in pervious commit)

Rename VM_KERNEL_IO_ADDRESS to VM_KERNEL_IO_BASE to match RISC-V

It's less letters, matches other similar variables and will help with
sharing code between the two architectures.

NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/fbt

2022-09-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Sep  2 11:03:50 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/fbt: fbt.c

Log Message:
dtrace_fbt: Allow tracing names that start with `__'.

This was never relevant on FreeBSD and I don't think it is relevant on
NetBSD either.  The FreeBSD change to lift this restriction had the
following comment:

r306570 | markj | 2016-10-02 00:35:00 + (Sun, 02 Oct 2016) | 7 lines

Allow tracing of functions prefixed by "__".

This restriction was inherited from upstream but is not relevant on FreeBSD.
Furthermore, it hindered the tracing of locking primitive subroutines.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/cddl/osnet/dev/fbt/fbt.c

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/fbt/fbt.c
diff -u src/external/cddl/osnet/dev/fbt/fbt.c:1.28 src/external/cddl/osnet/dev/fbt/fbt.c:1.29
--- src/external/cddl/osnet/dev/fbt/fbt.c:1.28	Mon Mar 28 12:33:20 2022
+++ src/external/cddl/osnet/dev/fbt/fbt.c	Fri Sep  2 11:03:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt.c,v 1.28 2022/03/28 12:33:20 riastradh Exp $	*/
+/*	$NetBSD: fbt.c,v 1.29 2022/09/02 11:03:50 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -168,9 +168,6 @@ fbt_excluded(const char *name)
 #endif
 
 #ifdef __NetBSD__
-	if (name[0] == '_' && name[1] == '_')
-		return (1);
-
 	if (strcmp(name, "cpu_index") == 0 ||
 	strncmp(name, "db_", 3) == 0 ||
 	strncmp(name, "ddb_", 4) == 0 ||



CVS commit: src/external/cddl/osnet/dev/fbt

2022-09-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Sep  2 11:03:50 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/fbt: fbt.c

Log Message:
dtrace_fbt: Allow tracing names that start with `__'.

This was never relevant on FreeBSD and I don't think it is relevant on
NetBSD either.  The FreeBSD change to lift this restriction had the
following comment:

r306570 | markj | 2016-10-02 00:35:00 + (Sun, 02 Oct 2016) | 7 lines

Allow tracing of functions prefixed by "__".

This restriction was inherited from upstream but is not relevant on FreeBSD.
Furthermore, it hindered the tracing of locking primitive subroutines.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/cddl/osnet/dev/fbt/fbt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/sdt

2022-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug 31 12:34:04 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c

Log Message:
dtrace_sdt: Fix bug in builtin module reference counting.

Don't module_hold(NULL)!  This mistake was introduced in my attempt
to get dtrace working for sdt probes defined in non-builtin modules
like zfs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/cddl/osnet/dev/sdt/sdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/sdt

2022-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug 31 12:34:04 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c

Log Message:
dtrace_sdt: Fix bug in builtin module reference counting.

Don't module_hold(NULL)!  This mistake was introduced in my attempt
to get dtrace working for sdt probes defined in non-builtin modules
like zfs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/cddl/osnet/dev/sdt/sdt.c

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/sdt/sdt.c
diff -u src/external/cddl/osnet/dev/sdt/sdt.c:1.23 src/external/cddl/osnet/dev/sdt/sdt.c:1.24
--- src/external/cddl/osnet/dev/sdt/sdt.c:1.23	Sun Aug  7 23:42:09 2022
+++ src/external/cddl/osnet/dev/sdt/sdt.c	Wed Aug 31 12:34:04 2022
@@ -39,7 +39,7 @@
  * unloaded; in particular, probes may not span multiple kernel modules.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.23 2022/08/07 23:42:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.24 2022/08/31 12:34:04 riastradh Exp $");
 
 #include 
 #include 
@@ -270,7 +270,8 @@ sdt_enable(void *arg __unused, dtrace_id
 
 	probe->id = id;
 #ifdef __NetBSD__
-	module_hold(&probe->sdtp_lf->lf_mod);
+	if (probe->sdtp_lf)
+		module_hold(&probe->sdtp_lf->lf_mod);
 #endif
 #ifdef __FreeBSD__
 	probe->sdtp_lf->nenabled++;
@@ -286,7 +287,8 @@ sdt_disable(void *arg __unused, dtrace_i
 	struct sdt_probe *probe = parg;
 
 #ifdef __NetBSD__
-	module_rele(&probe->sdtp_lf->lf_mod);
+	if (probe->sdtp_lf)
+		module_rele(&probe->sdtp_lf->lf_mod);
 #endif
 #ifdef __FreeBSD__
 	SDT_KASSERT(probe->sdtp_lf->nenabled > 0, ("no probes enabled"));



CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 18:58:45 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c

Log Message:
dtrace/i386: Need machine/cpufunc.h for x86_read_flags and rcr2.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c

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/i386/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.13 src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.14
--- src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.13	Tue Apr  6 12:48:59 2021
+++ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c	Sun Aug 21 18:58:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.13 2021/04/06 12:48:59 simonb Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.14 2022/08/21 18:58:45 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 18:58:45 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c

Log Message:
dtrace/i386: Need machine/cpufunc.h for x86_read_flags and rcr2.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/fbt/x86

2019-11-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov 13 10:13:41 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/fbt/x86: fbt_isa.c

Log Message:
Use x86_patch_window_{open,close}. This also fixes a bug: the CR0/PSL
reloads were inverted.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/dev/fbt/x86/fbt_isa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/fbt/x86

2019-11-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov 13 10:13:41 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/fbt/x86: fbt_isa.c

Log Message:
Use x86_patch_window_{open,close}. This also fixes a bug: the CR0/PSL
reloads were inverted.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/dev/fbt/x86/fbt_isa.c

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/fbt/x86/fbt_isa.c
diff -u src/external/cddl/osnet/dev/fbt/x86/fbt_isa.c:1.1 src/external/cddl/osnet/dev/fbt/x86/fbt_isa.c:1.2
--- src/external/cddl/osnet/dev/fbt/x86/fbt_isa.c:1.1	Mon May 28 23:47:39 2018
+++ src/external/cddl/osnet/dev/fbt/x86/fbt_isa.c	Wed Nov 13 10:13:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt_isa.c,v 1.1 2018/05/28 23:47:39 chs Exp $	*/
+/*	$NetBSD: fbt_isa.c,v 1.2 2019/11/13 10:13:41 maxv Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -175,28 +175,15 @@ fbt_patch_tracepoint(fbt_probe_t *fbt, f
 void
 fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val)
 {
-	u_long psl;
-	u_long cr0;
+	u_long psl, cr0;
 
-	/* Disable interrupts. */
-	psl = x86_read_psl();
-	x86_disable_intr();
-
-	/* Disable write protection in supervisor mode. */
-	cr0 = rcr0();
-	lcr0(cr0 & ~CR0_WP);
+	x86_patch_window_open(&psl, &cr0);
 
 	for (; fbt != NULL; fbt = fbt->fbtp_next) {
 		*fbt->fbtp_patchpoint = val;
 	}
 
-	/* Write back and invalidate cache, flush pipelines. */
-	wbinvd();
-	x86_flush();
-	x86_write_psl(psl);
-
-	/* Re-enable write protection. */
-	lcr0(cr0);
+	x86_patch_window_close(psl, cr0);
 }
 #endif
 



CVS commit: src/external/cddl/osnet/dev/dtrace/amd64

2019-11-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Nov  8 11:06:21 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_subr.c

Log Message:
dtrace_trap() gets called from alltraps() -> trap() with interrupts enabled
so we cannot assert for interrupts disabled here.

Should fix PR kern/54603: kernel panic when running dtruss


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c

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/amd64/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.13 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.14
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.13	Fri Jul  5 08:29:18 2019
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c	Fri Nov  8 11:06:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.13 2019/07/05 08:29:18 hannken Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.14 2019/11/08 11:06:21 hannken Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -412,7 +412,11 @@ dtrace_trap(struct trapframe *frame, u_i
 	 */
 	nofault = (cpu_core[cpuid].cpuc_dtrace_flags & CPU_DTRACE_NOFAULT) != 0;
 	if (nofault) {
+#if 0
+		This assertion would always fire, we get called from
+		alltraps() -> trap() with interrupts enabled.
 		KASSERTMSG((x86_read_flags() & PSL_I) == 0, "interrupts enabled");
+#endif
 
 		/*
 		 * There are only a couple of trap types that are expected.



CVS commit: src/external/cddl/osnet/dev/dtrace/amd64

2019-11-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Nov  8 11:06:21 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_subr.c

Log Message:
dtrace_trap() gets called from alltraps() -> trap() with interrupts enabled
so we cannot assert for interrupts disabled here.

Should fix PR kern/54603: kernel panic when running dtruss


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/dtrace

2019-07-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jul 23 09:06:12 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/dtrace: dtrace_load.c

Log Message:
Create "dtrace_taskq" here like FreeBSD does.

PR kern/54397: Panic when loading a DTrace module whilst DTrace is running


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dev/dtrace/dtrace_load.c

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/dtrace_load.c
diff -u src/external/cddl/osnet/dev/dtrace/dtrace_load.c:1.4 src/external/cddl/osnet/dev/dtrace/dtrace_load.c:1.5
--- src/external/cddl/osnet/dev/dtrace/dtrace_load.c:1.4	Mon May 28 21:05:03 2018
+++ src/external/cddl/osnet/dev/dtrace/dtrace_load.c	Tue Jul 23 09:06:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_load.c,v 1.4 2018/05/28 21:05:03 chs Exp $	*/
+/*	$NetBSD: dtrace_load.c,v 1.5 2019/07/23 09:06:12 hannken Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -88,9 +88,9 @@ dtrace_load(void *dummy)
 	/* Hang our hook for exceptions. */
 	dtrace_invop_init();
 
-#ifdef __FreeBSD__
 	dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri, 0, 0, 0);
 
+#ifdef __FreeBSD__
 	dtrace_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx);
 
 	/* Register callbacks for linker file load and unload events. */



CVS commit: src/external/cddl/osnet/dev/dtrace

2019-07-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jul 23 09:06:12 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/dtrace: dtrace_load.c

Log Message:
Create "dtrace_taskq" here like FreeBSD does.

PR kern/54397: Panic when loading a DTrace module whilst DTrace is running


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dev/dtrace/dtrace_load.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/fbt

2019-07-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jul 16 07:26:00 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/fbt: fbt.c

Log Message:
Always exclude "fbt_*" from the list of FBT probes.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/external/cddl/osnet/dev/fbt/fbt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/fbt

2019-07-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jul 16 07:26:00 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/fbt: fbt.c

Log Message:
Always exclude "fbt_*" from the list of FBT probes.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/external/cddl/osnet/dev/fbt/fbt.c

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/fbt/fbt.c
diff -u src/external/cddl/osnet/dev/fbt/fbt.c:1.26 src/external/cddl/osnet/dev/fbt/fbt.c:1.27
--- src/external/cddl/osnet/dev/fbt/fbt.c:1.26	Sat Mar  9 18:53:52 2019
+++ src/external/cddl/osnet/dev/fbt/fbt.c	Tue Jul 16 07:26:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt.c,v 1.26 2019/03/09 18:53:52 kamil Exp $	*/
+/*	$NetBSD: fbt.c,v 1.27 2019/07/16 07:26:00 hannken Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -177,7 +177,8 @@ fbt_excluded(const char *name)
 	strncmp(name, "kdb_", 4) == 0 ||
 	strncmp(name, "lockdebug_", 10) == 0 ||
 	strncmp(name, "kauth_", 5) == 0 ||
-	strncmp(name, "ktext_write", 11) == 0) {
+	strncmp(name, "ktext_write", 11) == 0 ||
+	strncmp(name, "fbt_", 4) == 0) {
 		return (1);
 	}
 #endif



CVS commit: src/external/cddl/osnet/dev/dtrace/amd64

2019-07-05 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  5 08:29:19 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_subr.c

Log Message:
Change dtrace toxic range to "0 .. VM_MIN_KERNEL_ADDRESS_DEFAULT",
the direct map may be mapped below "VM_MIN_KERNEL_ADDRESS".


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c

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/amd64/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.12 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.13
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.12	Sat Jan 12 10:41:31 2019
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c	Fri Jul  5 08:29:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.12 2019/01/12 10:41:31 hannken Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.13 2019/07/05 08:29:18 hannken Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -115,7 +115,7 @@ dtrace_invop_remove(int (*func)(uintptr_
 void
 dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit))
 {
-	(*func)(0, VM_MIN_KERNEL_ADDRESS);
+	(*func)(0, VM_MIN_KERNEL_ADDRESS_DEFAULT);
 }
 
 static void



CVS commit: src/external/cddl/osnet/dev/dtrace/amd64

2019-07-05 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  5 08:29:19 UTC 2019

Modified Files:
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_subr.c

Log Message:
Change dtrace toxic range to "0 .. VM_MIN_KERNEL_ADDRESS_DEFAULT",
the direct map may be mapped below "VM_MIN_KERNEL_ADDRESS".


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/external/cddl/osnet/dev/dtrace/amd64

2018-08-16 Thread Kamil Rytarowski
On 12.08.2018 18:07, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Sun Aug 12 16:07:27 UTC 2018
> 
> Modified Files:
>   src/external/cddl/osnet/dev/dtrace/amd64: dtrace_isa.c
> 
> Log Message:
> handle variable kernel vm min address
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.8 -r1.9 \
> src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c
> 
> 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/amd64/dtrace_isa.c
> diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.8 
> src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.9
> --- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.8 Fri Jul 27 
> 03:32:59 2018
> +++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c Sun Aug 12 
> 12:07:27 2018
> @@ -1,4 +1,4 @@
> -/*   $NetBSD: dtrace_isa.c,v 1.8 2018/07/27 07:32:59 maxv Exp $  */
> +/*   $NetBSD: dtrace_isa.c,v 1.9 2018/08/12 16:07:27 christos Exp $  */
>  
>  /*
>   * CDDL HEADER START
> @@ -45,7 +45,11 @@ uint16_t dtrace_fuword16_nocheck(void *)
>  uint32_t dtrace_fuword32_nocheck(void *);
>  uint64_t dtrace_fuword64_nocheck(void *);
>  
> +#ifdef VM_MIN_KERNEL_ADDRESS_DEFAULT
> +__strong_alias(kernelbase, vm_min_kernel_address)
> +#else
>  uintptr_t kernelbase = (uintptr_t)VM_MIN_KERNEL_ADDRESS;
> +#endif
>  
>  #define INKERNEL(va) ((intptr_t)(va) < 0) /* XXX horror */
>  
> 

This broke dtrace and produced missing symbol for the kernel module:

[4.934652] kern.module.path=/stand/amd64/8.99.24/modules
[6.065073] kobj_checksyms, 988: [dtrace]: linker error: symbol
`kernelbase' not found
[6.065073] WARNING: module error: unable to affix module `dtrace',
error 8
[6.155107] kobj_checksyms, 988: [dtrace]: linker error: symbol
`kernelbase' not found
[6.155107] WARNING: module error: unable to affix module `dtrace',
error 8
[6.155107] WARNING: module error: recursive load failed for
`dtrace_sdt' (`dtrace' required), error 8
[6.165111] kobj_checksyms, 988: [dtrace]: linker error: symbol
`kernelbase' not found
[6.165111] WARNING: module error: unable to affix module `dtrace',
error 8
[6.165111] WARNING: module error: recursive load failed for
`dtrace_fbt' (`dtrace' required), error 8

etc

This probably comes from
external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c which uses extern
symbol to kernelbase.


Adding more context:

$ for w in *dtrace*/*.kmod; do echo $w; nm $w| grep kernelbase; done
dtrace/dtrace.kmod
 U kernelbase
dtrace_fbt/dtrace_fbt.kmod
dtrace_lockstat/dtrace_lockstat.kmod
dtrace_profile/dtrace_profile.kmod
dtrace_sdt/dtrace_sdt.kmod
dtrace_syscall/dtrace_syscall.kmod
dtrace_syscall_linux/dtrace_syscall_linux.kmod
dtrace_syscall_linux32/dtrace_syscall_linux32.kmod
dtrace_syscall_netbsd32/dtrace_syscall_netbsd32.kmod


Adding a weak or strong symbol in dtrace_subr.c didn't help.

diff -u -r1.10 dtrace_subr.c
--- external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c  5 Jun 2018
12:04:19 -   1.10
+++ external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c  16 Aug 2018
12:17:22 -
@@ -48,7 +48,11 @@
 #include 
 #include 

+#ifdef VM_MIN_KERNEL_ADDRESS_DEFAULT
+__weak_alias(kernelbase, vm_min_kernel_address)
+#else
 extern uintptr_t   kernelbase;
+#endif

 int dtrace_invop(uintptr_t, struct trapframe *, uintptr_t);


Produces:

/usr/src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c: In function
'dtrace_toxic_ranges':
/usr/src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:124:13:
error: 'kernelbase' undeclared (first use in this function)
  (*func)(0, kernelbase);
 ^~
/usr/src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:124:13:
note: each undeclared identifier is reported only once for each function
it appears in


On the other hand this seems to build and produce insertable kernel modules:

Index: external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
===
RCS file: /cvsroot/src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c,v
retrieving revision 1.10
diff -u -r1.10 dtrace_subr.c
--- external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c  5 Jun 2018
12:04:19 -  1.10
+++ external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c  16 Aug 2018
12:20:54 -
@@ -48,7 +48,11 @@
 #include 
 #include 

+#ifdef VM_MIN_KERNEL_ADDRESS_DEFAULT
+#define kernelbase vm_min_kernel_address
+#else
 extern uintptr_t   kernelbase;
+#endif

 int dtrace_invop(uintptr_t, struct trapframe *, uintptr_t);




signature.asc
Description: OpenPGP digital signature


Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2018-06-05 Thread Christos Zoulas
On Jun 5,  9:06am, k...@munnari.oz.au (Robert Elz) wrote:
-- Subject: Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

| Date:Mon, 4 Jun 2018 21:13:23 -0400
| From:chris...@zoulas.com (Christos Zoulas)
| Message-ID:  <20180605011323.e275017f...@rebar.astron.com>
| 
|   | It is unfortunate that the files have diverged unnecessarly. Perhaps we
|   | should fix that and push the changes upstream.
| 
| I had assumed that src/external/cddl/osnet/dist was upstream and the
| rest (src/external/cddl/osnet/*) was the local glue.

Yes, it is. I did not realize those were ours...

|   | Yes, I don't want to keep adding  to each architecture that
|   | includes that dtrace header file :-)
| 
| With that change the include of  can probably just be
| deleted from the amd64 version of dtrace_subr.c - but I have not tested
| that.

I removed it.

| Yes.I might clean up some of it.

Thanks!

christos


re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2018-06-04 Thread matthew green
>   | Sigh...
> 
> Yes.I might clean up some of it.

please do :-)


Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2018-06-04 Thread Robert Elz
Date:Mon, 4 Jun 2018 21:13:23 -0400
From:chris...@zoulas.com (Christos Zoulas)
Message-ID:  <20180605011323.e275017f...@rebar.astron.com>

  | It is unfortunate that the files have diverged unnecessarly. Perhaps we
  | should fix that and push the changes upstream.

I had assumed that src/external/cddl/osnet/dist was upstream and the
rest (src/external/cddl/osnet/*) was the local glue.

  | Yes, I don't want to keep adding  to each architecture that
  | includes that dtrace header file :-)

With that change the include of  can probably just be
deleted from the amd64 version of dtrace_subr.c - but I have not tested
that.

  | Sigh...

Yes.I might clean up some of it.

kre



Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2018-06-04 Thread Christos Zoulas
On Jun 5,  8:10am, k...@munnari.oz.au (Robert Elz) wrote:
-- Subject: Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

| Yes, that's what I would have thought  but I just copied the position in 
| the amd64 version of the file.

It is unfortunate that the files have diverged unnecessarly. Perhaps we
should fix that and push the changes upstream.

| I see you changed this - it would be a good idea to make the same
| change in the amd64 version, and avoid yet another meaningless
| difference between the two.

Yes, I don't want to keep adding  to each architecture that
includes that dtrace header file :-)

| For this (and an earlier, that someone else fixed) of the recent build
| failures, I have been looking at the i386 vs amd64 versions of the
| "same" files (not dtrace/cddl, I don't much care about that, but regular
| src/sys/arch/{amd64,i386}) - obviously there are differences because
| they are not the same architecture, but there are lots of other differences
| that seem completely pointless (eg: in one file, in both versions, there is
| a comment, where the wording is identical, but one of them ends with a
| period (full stop) and the other does not ... a completely pointless
| difference that makes looking to see what is actually different between
| the two much harder.
| 
| There are a whole lot more.

Sigh...

christos


Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2018-06-04 Thread Robert Elz
Date:Mon, 4 Jun 2018 21:31:34 + (UTC)
From:chris...@astron.com (Christos Zoulas)
Message-ID:  

  | That should come after ... In general "infrastructure"
  | headers before "feature" headers... I will fix it (it happens to work,
  | but)...

Yes, that's what I would have thought  but I just copied the position in 
the amd64 version of the file.

I see you changed this - it would be a good idea to make the same
change in the amd64 version, and avoid yet another meaningless
difference between the two.

For this (and an earlier, that someone else fixed) of the recent build
failures, I have been looking at the i386 vs amd64 versions of the
"same" files (not dtrace/cddl, I don't much care about that, but regular
src/sys/arch/{amd64,i386}) - obviously there are differences because
they are not the same architecture, but there are lots of other differences
that seem completely pointless (eg: in one file, in both versions, there is
a comment, where the wording is identical, but one of them ends with a
period (full stop) and the other does not ... a completely pointless
difference that makes looking to see what is actually different between
the two much harder.

There are a whole lot more.

kre



Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2018-06-04 Thread Christos Zoulas
In article <20180604201246.24cf1f...@cvs.netbsd.org>,
Robert Elz  wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  kre
>Date:  Mon Jun  4 20:12:46 UTC 2018
>
>Modified Files:
>   src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c
>
>Log Message:
>The (dtrace version of)  is needed for kthread_t
>(same as the amd64 version).   This should fix (one of) the
>current i386 build breakages.

That should come after ... In general "infrastructure"
headers before "feature" headers... I will fix it (it happens to work,
but)...

christos



Re: CVS commit: src/external/cddl/osnet/dev/systrace

2015-03-10 Thread Christos Zoulas
On Mar 10,  7:58pm, ozak...@netbsd.org (Ryota Ozaki) wrote:
-- Subject: Re: CVS commit: src/external/cddl/osnet/dev/systrace

| On Sun, Mar 8, 2015 at 2:47 AM, Christos Zoulas  wrote:
| > Module Name:src
| > Committed By:   christos
| > Date:   Sat Mar  7 17:47:09 UTC 2015
| >
| > Modified Files:
| > src/external/cddl/osnet/dev/systrace: systrace.c
| >
| > Log Message:
| > we have space for 2 more arguments so use it.
| >
| >
| > To generate a diff of this commit:
| > cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dev/systrace/systrace.c
| >
| > Please note that diffs are not public domain; they are subject to the
| > copyright notices on the relevant files.
| >
| 
| 
| diff --git a/external/cddl/osnet/dev/systrace/systrace.c
| b/external/cddl/osnet/dev/systrace/systrace.c
| index 7d2d328..50539ec 100644
| --- a/external/cddl/osnet/dev/systrace/systrace.c
| +++ b/external/cddl/osnet/dev/systrace/systrace.c
| @@ -1,4 +1,4 @@
| -/* $NetBSD: systrace.c,v 1.5 2015/03/07 15:14:09 christos Exp $*/
| +/* $NetBSD: systrace.c,v 1.6 2015/03/07 17:47:09 christos Exp $*/
| 
|  /*
|   * CDDL HEADER START
| @@ -139,17 +139,18 @@ systrace_probe(uint32_t id, register_t sysnum,
| const struct sysent *se,
|  const void *params, const register_t *ret, int error)
|  {
| size_t  n_args  = 0;
| -   uintptr_t   uargs[SYS_MAXSYSARGS];
| +   uintptr_t   uargs[SYS_MAXSYSARGS + 3];
| 
| memset(uargs, 0, sizeof(uargs));
| -   if (params) {
| +   if (ret) {
| /* entry syscall, convert params */
| systrace_args(sysnum, params, uargs, &n_args);
| } else {
| -   /* return syscall, set values (XXX: errno?) */
| +   /* return syscall, set values and params: */
| uargs[0] = ret[0];
| 
| When ret == NULL, it dies here with NULL pointer access...

The test is backwards...

christos


Re: CVS commit: src/external/cddl/osnet/dev/systrace

2015-03-10 Thread Ryota Ozaki
On Sun, Mar 8, 2015 at 2:47 AM, Christos Zoulas  wrote:
> Module Name:src
> Committed By:   christos
> Date:   Sat Mar  7 17:47:09 UTC 2015
>
> Modified Files:
> src/external/cddl/osnet/dev/systrace: systrace.c
>
> Log Message:
> we have space for 2 more arguments so use it.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dev/systrace/systrace.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>


diff --git a/external/cddl/osnet/dev/systrace/systrace.c
b/external/cddl/osnet/dev/systrace/systrace.c
index 7d2d328..50539ec 100644
--- a/external/cddl/osnet/dev/systrace/systrace.c
+++ b/external/cddl/osnet/dev/systrace/systrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: systrace.c,v 1.5 2015/03/07 15:14:09 christos Exp $*/
+/* $NetBSD: systrace.c,v 1.6 2015/03/07 17:47:09 christos Exp $*/

 /*
  * CDDL HEADER START
@@ -139,17 +139,18 @@ systrace_probe(uint32_t id, register_t sysnum,
const struct sysent *se,
 const void *params, const register_t *ret, int error)
 {
size_t  n_args  = 0;
-   uintptr_t   uargs[SYS_MAXSYSARGS];
+   uintptr_t   uargs[SYS_MAXSYSARGS + 3];

memset(uargs, 0, sizeof(uargs));
-   if (params) {
+   if (ret) {
/* entry syscall, convert params */
systrace_args(sysnum, params, uargs, &n_args);
} else {
-   /* return syscall, set values (XXX: errno?) */
+   /* return syscall, set values and params: */
uargs[0] = ret[0];

When ret == NULL, it dies here with NULL pointer access...

  ozaki-r

uargs[1] = ret[1];
uargs[2] = error;
+   systrace_args(sysnum, params, uargs + 3, &n_args);
}
/* Process the probe using the converted argments. */
/* XXX: fix for more arguments! */


Re: CVS commit: src/external/cddl/osnet/dev

2015-02-26 Thread Christos Zoulas
On Feb 27, 10:23am, ozak...@netbsd.org (Ryota Ozaki) wrote:
-- Subject: Re: CVS commit: src/external/cddl/osnet/dev

| Indeed. I followed other codes too simple. So such codes that return EBUSY
| when MODULE_CMD_AUTOUNLOAD may be also hiding bugs? I have no idea
| we have to specially prevent unloading at MODULE_CMD_AUTOUNLOAD instead of
| MODULE_CMD_FINI.

Some were complicated to fix and people took the easy way out.

christos


Re: CVS commit: src/external/cddl/osnet/dev

2015-02-26 Thread Ryota Ozaki
On Fri, Feb 27, 2015 at 3:25 AM, Christos Zoulas  wrote:
> In article <20150226091053.38be...@cvs.netbsd.org>,
> Ryota Ozaki  wrote:
>
>>- Forbid auto unloading (not supported for now)
>
> Why don't you let it autounload... It is probably hiding more bugs this
> way if it fails.

Indeed. I followed other codes too simple. So such codes that return EBUSY
when MODULE_CMD_AUTOUNLOAD may be also hiding bugs? I have no idea
we have to specially prevent unloading at MODULE_CMD_AUTOUNLOAD instead of
MODULE_CMD_FINI.

  ozaki-r

>
> christos
>


Re: CVS commit: src/external/cddl/osnet/dev

2015-02-26 Thread Christos Zoulas
In article <20150226091053.38be...@cvs.netbsd.org>,
Ryota Ozaki  wrote:

>- Forbid auto unloading (not supported for now)

Why don't you let it autounload... It is probably hiding more bugs this
way if it fails.

christos



Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2010-03-18 Thread Matthias Scheler
On Thu, Mar 18, 2010 at 11:44:40PM +0900, Izumi Tsutsui wrote:
> > Modified Files:
> > src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c
> > 
> > Log Message:
> > Fix the build:
> > 1.) "ifdef-out" unused functions and global variables.
> > 2.) Include "x86/include/cpu_counter.h" for amd64 and i386 to get the
> > prototype of "cpu_frequency".
> 
> Probably this should be rewritten to use MI timecounter(9)?

Well, it seems to be an architecture specific file anyway. But I don't
know the details, I just "mechanically" fixed the build.

Kind regards

-- 
Matthias Scheler  http://zhadum.org.uk/


Re: CVS commit: src/external/cddl/osnet/dev/dtrace/i386

2010-03-18 Thread Izumi Tsutsui
> Module Name:  src
> Committed By: tron
> Date: Thu Mar 18 11:00:03 UTC 2010
> 
> Modified Files:
>   src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c
> 
> Log Message:
> Fix the build:
> 1.) "ifdef-out" unused functions and global variables.
> 2.) Include "x86/include/cpu_counter.h" for amd64 and i386 to get the
> prototype of "cpu_frequency".

Probably this should be rewritten to use MI timecounter(9)?
---
Izumi Tsutsui


CVS commit: src/external/cddl/osnet/dev/sdt

2010-03-04 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Fri Mar  5 02:21:41 UTC 2010

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c

Log Message:
DTrace: add a dependency on the dtrace module.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dev/sdt/sdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/sdt

2010-03-04 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Fri Mar  5 02:21:41 UTC 2010

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c

Log Message:
DTrace: add a dependency on the dtrace module.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dev/sdt/sdt.c

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/sdt/sdt.c
diff -u src/external/cddl/osnet/dev/sdt/sdt.c:1.4 src/external/cddl/osnet/dev/sdt/sdt.c:1.5
--- src/external/cddl/osnet/dev/sdt/sdt.c:1.4	Mon Mar  1 22:38:29 2010
+++ src/external/cddl/osnet/dev/sdt/sdt.c	Fri Mar  5 02:21:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdt.c,v 1.4 2010/03/01 22:38:29 darran Exp $	*/
+/*	$NetBSD: sdt.c,v 1.5 2010/03/05 02:21:41 darran Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -475,4 +475,4 @@
 	return (0);
 }
 
-MODULE(MODULE_CLASS_MISC, sdt, NULL);
+MODULE(MODULE_CLASS_MISC, sdt, "dtrace");



CVS commit: src/external/cddl/osnet/dev/sdt

2010-03-01 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Mon Mar  1 22:38:30 UTC 2010

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c

Log Message:
DTrace: update sdt.c handlers to match latest OpenSolaris vendor import.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dev/sdt/sdt.c

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/sdt/sdt.c
diff -u src/external/cddl/osnet/dev/sdt/sdt.c:1.3 src/external/cddl/osnet/dev/sdt/sdt.c:1.4
--- src/external/cddl/osnet/dev/sdt/sdt.c:1.3	Mon Mar  1 21:10:19 2010
+++ src/external/cddl/osnet/dev/sdt/sdt.c	Mon Mar  1 22:38:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdt.c,v 1.3 2010/03/01 21:10:19 darran Exp $	*/
+/*	$NetBSD: sdt.c,v 1.4 2010/03/01 22:38:29 darran Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -54,9 +54,9 @@
 
 static int	sdt_unload(void);
 static void	sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *);
-static void	sdt_provide(void *, dtrace_probedesc_t *);
+static void	sdt_provide(void *, const dtrace_probedesc_t *);
 static void	sdt_destroy(void *, dtrace_id_t, void *);
-static void	sdt_enable(void *, dtrace_id_t, void *);
+static int	sdt_enable(void *, dtrace_id_t, void *);
 static void	sdt_disable(void *, dtrace_id_t, void *);
 static void	sdt_load(void *);
 
@@ -195,7 +195,7 @@
 }
 
 static void
-sdt_provide(void *arg, dtrace_probedesc_t *desc)
+sdt_provide(void *arg, const dtrace_probedesc_t *desc)
 {
 	sdt_provider_t *sprov = arg;
 	int res;
@@ -266,7 +266,7 @@
 	}
 }
 
-static void
+static int
 sdt_enable(void *arg, dtrace_id_t id, void *parg)
 {
 	sdt_provider_t *sprov = arg;
@@ -290,6 +290,8 @@
 			break;
 		}
 	}
+
+	return 0;
 }
 
 static void



CVS commit: src/external/cddl/osnet/dev/sdt

2010-03-01 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Mon Mar  1 22:38:30 UTC 2010

Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c

Log Message:
DTrace: update sdt.c handlers to match latest OpenSolaris vendor import.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dev/sdt/sdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/dtrace

2010-02-27 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 28 07:01:43 UTC 2010

Modified Files:
src/external/cddl/osnet/dev/dtrace: dtrace_hacks.c

Log Message:
DTrace: enable access to kernel space for DTrace scripts.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dev/dtrace/dtrace_hacks.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/dev/dtrace

2010-02-27 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 28 07:01:43 UTC 2010

Modified Files:
src/external/cddl/osnet/dev/dtrace: dtrace_hacks.c

Log Message:
DTrace: enable access to kernel space for DTrace scripts.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dev/dtrace/dtrace_hacks.c

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/dtrace_hacks.c
diff -u src/external/cddl/osnet/dev/dtrace/dtrace_hacks.c:1.2 src/external/cddl/osnet/dev/dtrace/dtrace_hacks.c:1.3
--- src/external/cddl/osnet/dev/dtrace/dtrace_hacks.c:1.2	Sun Feb 21 01:46:33 2010
+++ src/external/cddl/osnet/dev/dtrace/dtrace_hacks.c	Sun Feb 28 07:01:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_hacks.c,v 1.2 2010/02/21 01:46:33 darran Exp $	*/
+/*	$NetBSD: dtrace_hacks.c,v 1.3 2010/02/28 07:01:43 darran Exp $	*/
 
 /* $FreeBSD: src/sys/cddl/dev/dtrace/dtrace_hacks.c,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $ */
 /* XXX Hacks */
@@ -13,5 +13,5 @@
 boolean_t
 priv_policy_only(const cred_t *a, int b, boolean_t c)
 {
-	return 0;
+	return 1;
 }