CVS commit: [netbsd-6] src/sys/arch/i386/i386

2017-10-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Oct 13 08:03:04 UTC 2017

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: vector.S

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1505):
sys/arch/i386/i386/i386_trap.S: revision 1.12 via patch
Pfff, use %ss and not %ds. The latter is controlled by userland, the former
contains the kernel value (flat); FreeBSD fixed this too a few weeks ago.
As I said earlier, this dtrace code is complete bullshit.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.59.8.1 src/sys/arch/i386/i386/vector.S

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

Modified files:

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.59 src/sys/arch/i386/i386/vector.S:1.59.8.1
--- src/sys/arch/i386/i386/vector.S:1.59	Sun Jun 12 03:35:42 2011
+++ src/sys/arch/i386/i386/vector.S	Fri Oct 13 08:03:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.59 2011/06/12 03:35:42 rmind Exp $	*/
+/*	$NetBSD: vector.S,v 1.59.8.1 2017/10/13 08:03:03 snj Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.59 2011/06/12 03:35:42 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.59.8.1 2017/10/13 08:03:03 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -773,7 +773,7 @@ IDTVEC(trap05)
 	SUPERALIGN_TEXT
 IDTVEC(trap06)
 	/* Check if there is no DTrace hook registered. */
-	cmpl	$0,dtrace_invop_jump_addr
+	cmpl	$0,%ss:dtrace_invop_jump_addr
 	je	norm_ill
 
 	/* Check if this is a user fault. */



CVS commit: [netbsd-6] src/sys/arch/i386/i386

2012-12-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Dec 16 19:12:36 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: multiboot.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #749):
sys/arch/i386/i386/multiboot.c: revision 1.22
Fix off by one.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.14.1 src/sys/arch/i386/i386/multiboot.c

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

Modified files:

Index: src/sys/arch/i386/i386/multiboot.c
diff -u src/sys/arch/i386/i386/multiboot.c:1.21 src/sys/arch/i386/i386/multiboot.c:1.21.14.1
--- src/sys/arch/i386/i386/multiboot.c:1.21	Tue Jan 11 12:24:37 2011
+++ src/sys/arch/i386/i386/multiboot.c	Sun Dec 16 19:12:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: multiboot.c,v 1.21 2011/01/11 12:24:37 gsutre Exp $	*/
+/*	$NetBSD: multiboot.c,v 1.21.14.1 2012/12/16 19:12:36 riz Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: multiboot.c,v 1.21 2011/01/11 12:24:37 gsutre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: multiboot.c,v 1.21.14.1 2012/12/16 19:12:36 riz Exp $");
 
 #include "opt_multiboot.h"
 
@@ -506,7 +506,7 @@ setup_bootpath(struct multiboot_info *mi
 		*cl2 = '\0';
 		memcpy(bi.bootpath, cl, MIN(sizeof(bi.bootpath), len));
 		*cl2 = old;
-		bi.bootpath[MIN(sizeof(bi.bootpath), len)] = '\0';
+		bi.bootpath[MIN(sizeof(bi.bootpath) - 1, len)] = '\0';
 
 		bootinfo_add((struct btinfo_common *)&bi, BTINFO_BOOTPATH,
 		sizeof(struct btinfo_bootpath));



CVS commit: [netbsd-6] src/sys/arch/i386/i386

2012-10-31 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Oct 31 17:19:49 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: locore.S

Log Message:
Pull up following revision(s) (requested by chs in ticket #642):
sys/arch/i386/i386/locore.S: revision 1.103
in osyscall, set the PSL_I bit into the correct field of the trapframe.
it was going into tf_eip instead of tf_eflags, which would sometimes
corrupt %eip and always return to user mode with interrupts disabled.
this was found with a netbsd 1.0 binary, and dsl@ points out that
this should also fix PR 41342.


To generate a diff of this commit:
cvs rdiff -u -r1.95.10.2 -r1.95.10.3 src/sys/arch/i386/i386/locore.S

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

Modified files:

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.95.10.2 src/sys/arch/i386/i386/locore.S:1.95.10.3
--- src/sys/arch/i386/i386/locore.S:1.95.10.2	Fri Apr 20 23:32:14 2012
+++ src/sys/arch/i386/i386/locore.S	Wed Oct 31 17:19:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.95.10.2 2012/04/20 23:32:14 riz Exp $	*/
+/*	$NetBSD: locore.S,v 1.95.10.3 2012/10/31 17:19:49 riz Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -129,7 +129,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.95.10.2 2012/04/20 23:32:14 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.95.10.3 2012/10/31 17:19:49 riz Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_ddb.h"
@@ -1123,7 +1123,7 @@ IDTVEC(osyscall)
 #endif
 	pushfl			# set eflags in trap frame
 	popl	8(%esp)
-	orl	$PSL_I,(%esp)	# re-enable ints on return to user
+	orl	$PSL_I,8(%esp)	# re-enable ints on return to user
 	pushl	$7		# size of instruction for restart
 	jmp	syscall1
 IDTVEC_END(osyscall)



CVS commit: [netbsd-6] src/sys/arch/i386/i386

2012-09-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Sep  3 19:03:39 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: i386func.S

Log Message:
Pull up following revision(s) (requested by rmind in ticket #533):
sys/arch/i386/i386/i386func.S: revision 1.17
tlbflushg/i386: test for the PGE feature flag first, before checking the %cr4.
Add a comment explaining why need to check both and in such order.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.8.1 src/sys/arch/i386/i386/i386func.S

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

Modified files:

Index: src/sys/arch/i386/i386/i386func.S
diff -u src/sys/arch/i386/i386/i386func.S:1.16 src/sys/arch/i386/i386/i386func.S:1.16.8.1
--- src/sys/arch/i386/i386/i386func.S:1.16	Sun Jun 12 03:35:42 2011
+++ src/sys/arch/i386/i386/i386func.S	Mon Sep  3 19:03:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386func.S,v 1.16 2011/06/12 03:35:42 rmind Exp $	*/
+/*	$NetBSD: i386func.S,v 1.16.8.1 2012/09/03 19:03:39 riz Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i386func.S,v 1.16 2011/06/12 03:35:42 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386func.S,v 1.16.8.1 2012/09/03 19:03:39 riz Exp $");
 
 #include 
 #include 
@@ -99,9 +99,13 @@ END(lcr3)
  *
  * (the alternatives not quoted above are not an option here.)
  *
- * If PGE is not in use, we reload CR3.
+ * If PGE is not in use, we reload CR3.  Check for the PGE feature
+ * first since i486 does not have CR4.  Note: the feature flag may
+ * be present while the actual PGE functionality not yet enabled.
  */
 ENTRY(tlbflushg)
+	testl	$CPUID_PGE, _C_LABEL(cpu_feature)
+	jz	1f
 	movl	%cr4, %eax
 	testl	$CR4_PGE, %eax
 	jz	1f



CVS commit: [netbsd-6] src/sys/arch/i386/i386

2012-05-07 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon May  7 16:38:43 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: compat_16_machdep.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #221):
sys/arch/i386/i386/compat_16_machdep.c: revision 1.22
>From Bob Lee [glee at force10networks dot com], Preserve the have fpu context
bit for compat_16 signals, because the old 1.6 context does not deal with the
fpu.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.14.1 src/sys/arch/i386/i386/compat_16_machdep.c

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

Modified files:

Index: src/sys/arch/i386/i386/compat_16_machdep.c
diff -u src/sys/arch/i386/i386/compat_16_machdep.c:1.21 src/sys/arch/i386/i386/compat_16_machdep.c:1.21.14.1
--- src/sys/arch/i386/i386/compat_16_machdep.c:1.21	Sat Nov  6 11:40:24 2010
+++ src/sys/arch/i386/i386/compat_16_machdep.c	Mon May  7 16:38:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_16_machdep.c,v 1.21 2010/11/06 11:40:24 uebayasi Exp $	*/
+/*	$NetBSD: compat_16_machdep.c,v 1.21.14.1 2012/05/07 16:38:43 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.21 2010/11/06 11:40:24 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.21.14.1 2012/05/07 16:38:43 riz Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_vm86.h"
@@ -260,7 +260,9 @@ sendsig_sigcontext(const ksiginfo_t *ksi
 		/* NOTREACHED */
 	}
 
+	int svufpu = l->l_md.md_flags & MDL_USEDFPU;
 	buildcontext(l, sel, catcher, fp);
+	l->l_md.md_flags |= svufpu;
 
 	/* Remember that we're now on the signal stack. */
 	if (onstack)



CVS commit: [netbsd-6] src/sys/arch/i386/i386

2012-03-07 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Mar  7 23:31:42 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: machdep.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #93):
sys/arch/i386/i386/machdep.c: revision 1.725
cast xen_start_info.nr_pages to paddr_t, so that ctob() won't truncate
the addresses to 32bits. Fix avail memory when allocating more than 4GB
to a XEN3PAE domU.


To generate a diff of this commit:
cvs rdiff -u -r1.717.2.4 -r1.717.2.5 src/sys/arch/i386/i386/machdep.c

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

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.717.2.4 src/sys/arch/i386/i386/machdep.c:1.717.2.5
--- src/sys/arch/i386/i386/machdep.c:1.717.2.4	Mon Mar  5 20:18:02 2012
+++ src/sys/arch/i386/i386/machdep.c	Wed Mar  7 23:31:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.717.2.4 2012/03/05 20:18:02 sborrill Exp $	*/
+/*	$NetBSD: machdep.c,v 1.717.2.5 2012/03/07 23:31:41 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.4 2012/03/05 20:18:02 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.5 2012/03/07 23:31:41 riz Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -1404,9 +1404,9 @@ init386(paddr_t first_avail)
 	/* Make sure the end of the space used by the kernel is rounded. */
 	first_avail = round_page(first_avail);
 	avail_start = first_avail;
-	avail_end = ctob(xen_start_info.nr_pages) + XPMAP_OFFSET;
+	avail_end = ctob((paddr_t)xen_start_info.nr_pages) + XPMAP_OFFSET;
 	pmap_pa_start = (KERNTEXTOFF - KERNBASE);
-	pmap_pa_end = pmap_pa_start + ctob(xen_start_info.nr_pages);
+	pmap_pa_end = pmap_pa_start + ctob((paddr_t)xen_start_info.nr_pages);
 	mem_clusters[0].start = avail_start;
 	mem_clusters[0].size = avail_end - avail_start;
 	mem_cluster_cnt++;
@@ -1458,9 +1458,10 @@ init386(paddr_t first_avail)
 	initx86_load_memmap(first_avail);
 
 #else /* !XEN */
-	XENPRINTK(("load the memory cluster %p(%d) - %p(%ld)\n",
-	(void *)(long)avail_start, (int)atop(avail_start),
-	(void *)(long)avail_end, (int)atop(avail_end)));
+	XENPRINTK(("load the memory cluster 0x%" PRIx64 " (%" PRId64 ") - "
+	"0x%" PRIx64 " (%" PRId64 ")\n",
+	(uint64_t)avail_start, (uint64_t)atop(avail_start),
+	(uint64_t)avail_end, (uint64_t)atop(avail_end)));
 	uvm_page_physload(atop(avail_start), atop(avail_end),
 	atop(avail_start), atop(avail_end),
 	VM_FREELIST_DEFAULT);



CVS commit: [netbsd-6] src/sys/arch/i386/i386

2012-02-27 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Feb 27 20:29:36 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: machdep.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #60):
sys/arch/i386/i386/machdep.c: revision 1.722
Do not special-case XEN and always use the proper selectors for %fs and %gs
in buildcontext() and setregs(). The consequence was that signal handlers
would have the wrong %fs/%gs. Found by running atf tests under Xen/i386.


To generate a diff of this commit:
cvs rdiff -u -r1.717.2.2 -r1.717.2.3 src/sys/arch/i386/i386/machdep.c

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

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.717.2.2 src/sys/arch/i386/i386/machdep.c:1.717.2.3
--- src/sys/arch/i386/i386/machdep.c:1.717.2.2	Thu Feb 23 18:37:32 2012
+++ src/sys/arch/i386/i386/machdep.c	Mon Feb 27 20:29:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.717.2.2 2012/02/23 18:37:32 riz Exp $	*/
+/*	$NetBSD: machdep.c,v 1.717.2.3 2012/02/27 20:29:36 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.2 2012/02/23 18:37:32 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.3 2012/02/27 20:29:36 riz Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -734,13 +734,8 @@ buildcontext(struct lwp *l, int sel, voi
 {
 	struct trapframe *tf = l->l_md.md_regs;
 
-#ifndef XEN
 	tf->tf_gs = GSEL(GUGS_SEL, SEL_UPL);
 	tf->tf_fs = GSEL(GUFS_SEL, SEL_UPL);
-#else
-	tf->tf_gs = GSEL(GUDATA_SEL, SEL_UPL);
-	tf->tf_fs = GSEL(GUDATA_SEL, SEL_UPL);
-#endif
 	tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
 	tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
 	tf->tf_eip = (int)catcher;
@@ -1019,13 +1014,8 @@ setregs(struct lwp *l, struct exec_packa
 	memcpy(&pcb->pcb_gsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_gsd));
 
 	tf = l->l_md.md_regs;
-#ifndef XEN
 	tf->tf_gs = GSEL(GUGS_SEL, SEL_UPL);
 	tf->tf_fs = GSEL(GUFS_SEL, SEL_UPL);
-#else
-	tf->tf_gs = LSEL(LUDATA_SEL, SEL_UPL);
-	tf->tf_fs = LSEL(LUDATA_SEL, SEL_UPL);
-#endif
 	tf->tf_es = LSEL(LUDATA_SEL, SEL_UPL);
 	tf->tf_ds = LSEL(LUDATA_SEL, SEL_UPL);
 	tf->tf_edi = 0;



CVS commit: [netbsd-6] src/sys/arch/i386/i386

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 19:07:31 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: machdep.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #32):
sys/arch/i386/i386/machdep.c: revision 1.719
i386_switch_context(): mimic code in cpu_switchto() and compare pcb->pcb_fpcpu
against ci to decide if we need to turn off FPU. Fix FPU corruption, e.g.
paranoia occasionally reporting flaws on Xen/MP systems.
XXX is ci_fpused still needed at all ?


To generate a diff of this commit:
cvs rdiff -u -r1.717 -r1.717.2.1 src/sys/arch/i386/i386/machdep.c

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

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.717 src/sys/arch/i386/i386/machdep.c:1.717.2.1
--- src/sys/arch/i386/i386/machdep.c:1.717	Thu Jan 12 19:49:37 2012
+++ src/sys/arch/i386/i386/machdep.c	Wed Feb 22 19:07:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.717 2012/01/12 19:49:37 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.717.2.1 2012/02/22 19:07:12 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717 2012/01/12 19:49:37 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.1 2012/02/22 19:07:12 riz Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -544,9 +544,8 @@ i386_switch_context(lwp_t *l)
 
 	pcb = lwp_getpcb(l);
 	ci = curcpu();
-	if (ci->ci_fpused) {
+	if (pcb->pcb_fpcpu != ci) {
 		HYPERVISOR_fpu_taskswitch(1);
-		ci->ci_fpused = 0;
 	}
 
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb->pcb_esp0);