CVS commit: [netbsd-5] src/sys/arch/i386/stand/boot

2013-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep  7 17:23:39 UTC 2013

Modified Files:
src/sys/arch/i386/stand/boot [netbsd-5]: boot2.c

Log Message:
Pull up following revision(s) (requested by he in ticket #1872):
sys/arch/i386/stand/lib/bootmenu.c: revision 1.11 via patch
sys/arch/i386/stand/lib/bootmenu.h: revision 1.3 via patch
sys/arch/i386/stand/boot/boot2.c: revision 1.59 via patch
Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:
 * Add a menu command which re-displays the menu and initiates
   the timed countdown
 * Use any default command defined in boot.cfg as default args
   if the user runs boot with no arguments
This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply boot netbsd is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.2 -r1.38.4.3 src/sys/arch/i386/stand/boot/boot2.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/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.38.4.2 src/sys/arch/i386/stand/boot/boot2.c:1.38.4.3
--- src/sys/arch/i386/stand/boot/boot2.c:1.38.4.2	Sun Feb 14 14:01:08 2010
+++ src/sys/arch/i386/stand/boot/boot2.c	Sat Sep  7 17:23:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.38.4.2 2010/02/14 14:01:08 bouyer Exp $	*/
+/*	$NetBSD: boot2.c,v 1.38.4.3 2013/09/07 17:23:39 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -131,9 +131,16 @@ void	command_quit(char *);
 void	command_boot(char *);
 void	command_dev(char *);
 void	command_consdev(char *);
+#ifndef SMALL
+void	command_menu(char *);
+#endif
 void	command_modules(char *);
 void	command_load(char *);
 void	command_multiboot(char *);
+#ifndef SMALL
+void	bootdefault(void);
+void	docommandchoice(int);
+#endif
 
 const struct bootblk_command commands[] = {
 	{ help,	command_help },
@@ -143,6 +150,9 @@ const struct bootblk_command commands[] 
 	{ boot,	command_boot },
 	{ dev,	command_dev },
 	{ consdev,	command_consdev },
+#ifndef SMALL
+	{ menu,	command_menu },
+#endif
 	{ modules,	command_modules },
 	{ load,	command_load },
 	{ multiboot,	command_multiboot },
@@ -508,10 +518,58 @@ static int getchoicefrominput(char *inpu
 }
 
 void
+docommandchoice(int choice)
+{
+	char input[80], *ic, *oc;
+ 
+	ic = bootconf.command[choice];
+	/* Split command string at ; into separate commands */
+	do {
+		oc = input;
+		/* Look for ; separator */
+		for (; *ic  *ic != COMMAND_SEPARATOR; ic++)
+			*oc++ = *ic;
+		if (*input == '\0')
+			continue;
+		/* Strip out any trailing spaces */
+		oc--;
+		for (; *oc == ' '  oc  input; oc--);
+		*++oc = '\0';
+		if (*ic == COMMAND_SEPARATOR)
+			ic++;
+		/* Stop silly command strings like ;;; */
+		if (*input != '\0')
+			docommand(input);
+		/* Skip leading spaces */
+		for (; *ic == ' '; ic++);
+	} while (*ic);
+}
+
+void
+bootdefault(void)
+{
+int choice;
+static int entered;
+ 
+if (bootconf.nummenu  0) {
+if (entered) {
+printf(default boot twice, skipping...\n);
+return;
+}
+entered = 1;
+choice = bootconf.def;
+printf(command(s): %s\n, bootconf.command[choice]);
+docommandchoice(choice);
+}
+}
+
+
+
+void
 doboottypemenu(void)
 {
 	int choice;
-	char input[80], *ic, *oc;
+	char input[80];
 		
 	printf(\n);
 	/* Display menu */
@@ -567,27 +625,7 @@ doboottypemenu(void)
 			printf(type \?\ or \help\ for help.\n);
 			bootmenu(); /* does not return */
 		} else {
-			ic = bootconf.command[choice];
-			/* Split command string at ; into separate commands */
-			do {
-oc = input;
-/* Look for ; separator */
-for (; *ic  *ic != COMMAND_SEPARATOR; ic++)
-	*oc++ = *ic;
-if (*input == '\0')
-	continue;
-/* Strip out any trailing spaces */
-oc--;
-for (; *oc ==' '  oc  input; oc--);
-*++oc = '\0';
-if (*ic == COMMAND_SEPARATOR)
-	ic++;
-/* Stop silly command strings like ;;; */
-if (*input != '\0')
-	docommand(input);
-/* Skip leading spaces */
-for (; *ic == ' '; ic++);
-			} while (*ic);
+			docommandchoice(choice);
 		}
 			
 	}
@@ -707,6 +745,9 @@ command_help(char *arg)
 	   dev xd[N[x]]:\n
 	   consdev {pc|com[0123]|com[0123]kbd|auto}\n
 	   modules {enabled|disabled}\n
+#ifndef SMALL
+	   menu (reenters boot menu, if defined in boot.cfg)\n
+#endif
 	   load {path_to_module}\n
 	   multiboot [xdNx:][filename] [args]\n
 	   help|?\n
@@ -740,10 +781,25 @@ void
 command_boot(char *arg)
 {
 	char *filename;
-	int howto;
+	int howto, tell;
 
-	if (parseboot(arg, filename, howto))
-		

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

2012-10-31 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Oct 31 15:34:58 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by chs in ticket #1810):
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.78.4.3 -r1.78.4.4 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.78.4.3 src/sys/arch/i386/i386/locore.S:1.78.4.4
--- src/sys/arch/i386/i386/locore.S:1.78.4.3	Sat Apr  4 17:39:09 2009
+++ src/sys/arch/i386/i386/locore.S	Wed Oct 31 15:34:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.78.4.3 2009/04/04 17:39:09 snj Exp $	*/
+/*	$NetBSD: locore.S,v 1.78.4.4 2012/10/31 15:34:58 riz Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -134,7 +134,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: locore.S,v 1.78.4.3 2009/04/04 17:39:09 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: locore.S,v 1.78.4.4 2012/10/31 15:34:58 riz Exp $);
 
 #include opt_compat_oldboot.h
 #include opt_ddb.h
@@ -1081,7 +1081,7 @@ IDTVEC(osyscall)
 	cli			# must be first instruction
 	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-5] src/sys/arch/i386

2012-03-21 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Wed Mar 21 21:29:32 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: gdt.c machdep.c
src/sys/arch/i386/include [netbsd-5]: segments.h

Log Message:
Apply patch (requested by bouyer in ticket #1738).

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.45.10.1 -r1.45.10.2 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.644.4.12 -r1.644.4.13 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.50.4.1 -r1.50.4.2 src/sys/arch/i386/include/segments.h

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/gdt.c
diff -u src/sys/arch/i386/i386/gdt.c:1.45.10.1 src/sys/arch/i386/i386/gdt.c:1.45.10.2
--- src/sys/arch/i386/i386/gdt.c:1.45.10.1	Sat Apr  4 17:39:09 2009
+++ src/sys/arch/i386/i386/gdt.c	Wed Mar 21 21:29:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.45.10.1 2009/04/04 17:39:09 snj Exp $	*/
+/*	$NetBSD: gdt.c,v 1.45.10.2 2012/03/21 21:29:31 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gdt.c,v 1.45.10.1 2009/04/04 17:39:09 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdt.c,v 1.45.10.2 2012/03/21 21:29:31 jdc Exp $);
 
 #include opt_multiprocessor.h
 #include opt_xen.h
@@ -66,7 +66,7 @@ void gdt_grow(int);
 int gdt_get_slot1(int);
 void gdt_put_slot1(int, int);
 
-static void
+void
 update_descriptor(union descriptor *table, union descriptor *entry)
 {
 #ifndef XEN

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.644.4.12 src/sys/arch/i386/i386/machdep.c:1.644.4.13
--- src/sys/arch/i386/i386/machdep.c:1.644.4.12	Thu Apr 22 20:02:48 2010
+++ src/sys/arch/i386/i386/machdep.c	Wed Mar 21 21:29:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.644.4.12 2010/04/22 20:02:48 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.644.4.13 2012/03/21 21:29:31 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.644.4.12 2010/04/22 20:02:48 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.644.4.13 2012/03/21 21:29:31 jdc Exp $);
 
 #include opt_beep.h
 #include opt_compat_ibcs2.h
@@ -577,6 +577,12 @@ i386_switch_context(lwp_t *l)
 
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb-pcb_esp0);
 
+	/* Update TLS segment pointers */
+	update_descriptor(ci-ci_gdt[GUFS_SEL],
+			  (union descriptor *) pcb-pcb_fsd);
+	update_descriptor(ci-ci_gdt[GUGS_SEL], 
+			  (union descriptor *) pcb-pcb_gsd);
+
 #ifdef XEN3
 	struct physdev_op physop;
 	physop.cmd = PHYSDEVOP_SET_IOPL;
@@ -754,13 +760,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;
@@ -1034,13 +1035,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;

Index: src/sys/arch/i386/include/segments.h
diff -u src/sys/arch/i386/include/segments.h:1.50.4.1 src/sys/arch/i386/include/segments.h:1.50.4.2
--- src/sys/arch/i386/include/segments.h:1.50.4.1	Tue Nov 18 01:56:59 2008
+++ src/sys/arch/i386/include/segments.h	Wed Mar 21 21:29:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.50.4.1 2008/11/18 01:56:59 snj Exp $	*/
+/*	$NetBSD: segments.h,v 1.50.4.2 2012/03/21 21:29:31 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -198,6 +198,7 @@ void setsegment(struct segment_descripto
 void setgdt(int, const void *, size_t, int, int, int, int);
 void unsetgate(struct gate_descriptor *);
 void cpu_init_idt(void);
+void update_descriptor(union descriptor *, union descriptor *);
 
 #if !defined(XEN)
 void idt_init(void);



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

2012-02-04 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Feb  4 17:04:09 UTC 2012

Modified Files:
src/sys/arch/i386/conf [netbsd-5]: INSTALL_FLOPPY

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1719):
sys/arch/i386/conf/INSTALL_FLOPPY: revision 1.15
Add virtio driver to INSTALL_FLOPPY.
Requested by Matthias Scheler t...@netbsd.org for particular cases like
http://mail-index.netbsd.org/netbsd-users/2011/09/13/msg009128.html


To generate a diff of this commit:
cvs rdiff -u -r1.1.16.2 -r1.1.16.3 src/sys/arch/i386/conf/INSTALL_FLOPPY

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/conf/INSTALL_FLOPPY
diff -u src/sys/arch/i386/conf/INSTALL_FLOPPY:1.1.16.2 src/sys/arch/i386/conf/INSTALL_FLOPPY:1.1.16.3
--- src/sys/arch/i386/conf/INSTALL_FLOPPY:1.1.16.2	Tue Nov 18 01:56:58 2008
+++ src/sys/arch/i386/conf/INSTALL_FLOPPY	Sat Feb  4 17:04:09 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_FLOPPY,v 1.1.16.2 2008/11/18 01:56:58 snj Exp $
+#	$NetBSD: INSTALL_FLOPPY,v 1.1.16.3 2012/02/04 17:04:09 bouyer Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -742,6 +742,11 @@ url*	at uhub? port ?		# Realtek RTL8150L
 # Planetconnect Satellite receiver driver.
 #satlink0 at isa? port 0x300 drq 1
 
+# Virtio devices
+virtio*	at pci? dev ? function ?	# Virtio PCI device
+viomb*	at virtio?			# Virtio memory balloon device
+ld*	at virtio?			# Virtio disk device
+vioif*	at virtio?			# Virtio network device
 
 # Pull in optional local configuration
 cinclude arch/i386/conf/INSTALL.local



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

2011-11-18 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Nov 18 21:09:24 UTC 2011

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

Log Message:
Pull up the following revisions(s) (requested by dholland in ticket #1687):
sys/arch/i386/i386/vector.S:revision 1.54

Keep interrupts disabled in NMI handler. Addresses PR/43007.


To generate a diff of this commit:
cvs rdiff -u -r1.42.6.3 -r1.42.6.4 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.42.6.3 src/sys/arch/i386/i386/vector.S:1.42.6.4
--- src/sys/arch/i386/i386/vector.S:1.42.6.3	Thu May 20 05:51:59 2010
+++ src/sys/arch/i386/i386/vector.S	Fri Nov 18 21:09:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.42.6.3 2010/05/20 05:51:59 snj Exp $	*/
+/*	$NetBSD: vector.S,v 1.42.6.4 2011/11/18 21:09:24 sborrill Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.42.6.3 2010/05/20 05:51:59 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.42.6.4 2011/11/18 21:09:24 sborrill Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -841,7 +841,10 @@ IDTVEC(trap00)
 IDTVEC(trap01)
 	BPTTRAP(T_TRCTRAP)
 IDTVEC(trap02)
-	ZTRAP(T_NMI)
+	pushl $0
+	pushl $(T_NMI)
+	INTRENTRY
+	jmp _C_LABEL(calltrap)
 IDTVEC(trap03)
 	BPTTRAP(T_BPTFLT)
 IDTVEC(trap04)



CVS commit: [netbsd-5] src/sys/arch/i386/stand/lib

2011-10-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Oct 16 23:38:52 UTC 2011

Modified Files:
src/sys/arch/i386/stand/lib [netbsd-5]: gatea20.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #923):
sys/arch/i386/stand/lib/gatea20.c: revision 1.12
PR# kern/39726: Soekris 5501-60 boot/bootxx 120 second delay
PR# port-i386/41162: A20 gate legacy hook cause long pxeboot delay on Soekris
net5501
Remove calls to delay() before polling KBD registers in gateA20().


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/i386/stand/lib/gatea20.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/stand/lib/gatea20.c
diff -u src/sys/arch/i386/stand/lib/gatea20.c:1.11 src/sys/arch/i386/stand/lib/gatea20.c:1.11.4.1
--- src/sys/arch/i386/stand/lib/gatea20.c:1.11	Tue Oct 14 14:18:11 2008
+++ src/sys/arch/i386/stand/lib/gatea20.c	Sun Oct 16 23:38:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: gatea20.c,v 1.11 2008/10/14 14:18:11 ad Exp $	*/
+/*	$NetBSD: gatea20.c,v 1.11.4.1 2011/10/16 23:38:52 riz Exp $	*/
 
 /* extracted from freebsd:sys/i386/boot/biosboot/io.c */
 
@@ -67,12 +67,10 @@ gateA20(void)
 
 		outb(K_CMD, KC_CMD_WOUT);
 
-		delay(100);
 		while (inb(K_STATUS)  K_IBUF_FUL);
 
 		outb(K_RDWR, x_20);
 
-		delay(100);
 		while (inb(K_STATUS)  K_IBUF_FUL);
 
 		while (inb(K_STATUS)  K_OBUF_FUL)



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

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:51:59 UTC 2010

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: trap.c vector.S

Log Message:
Pull up following revision(s) (requested by riz in ticket #1401):
sys/arch/i386/i386/trap.c: revisions 1.251-1.253 via patch
sys/arch/i386/i386/vector.S: revisions 1.50-1.51 via patch
If we fault on the 'iret' during return to userpace (eg if %eip is outside
the bounds of %cs) then hack the stack to contain a normal fault frame
for the signal setup code (etc).
Previously the code assumed that the original user trap frame was still
present - at it is for faults when loading the segment registers.
--
If we fault on the iret during return to userspace, see if we need to
do a lazy update of %cs to make the stack executable.
If a change is made, just retry the failing sequence.
Signal handlers as gcc nested local functions now work!
--
Fix 'fault on load of %gs during retirn to userspace' to look for the
 correct instruction bytes.
Take the 'fault on load segment register' through the same path as 'fault
 on iret' so we don't have to fixup the broken stackframe that contains a
 mix of user and kernel registers,
Update comments about how the faults during return to userspace are processed.
Setting an invalid %gs in the saved context of a signal handler causes
 a SIGSEGV handler to be entered with what look like valid registers.


To generate a diff of this commit:
cvs rdiff -u -r1.241.4.1 -r1.241.4.2 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.42.6.2 -r1.42.6.3 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/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.241.4.1 src/sys/arch/i386/i386/trap.c:1.241.4.2
--- src/sys/arch/i386/i386/trap.c:1.241.4.1	Fri Mar 27 17:25:15 2009
+++ src/sys/arch/i386/i386/trap.c	Thu May 20 05:51:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.241.4.1 2009/03/27 17:25:15 msaitoh Exp $	*/
+/*	$NetBSD: trap.c,v 1.241.4.2 2010/05/20 05:51:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.1 2009/03/27 17:25:15 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.2 2010/05/20 05:51:59 snj Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -131,6 +131,7 @@
 static inline int xmm_si_code(struct lwp *);
 void trap(struct trapframe *);
 void trap_tss(struct i386tss *, int, int);
+void trap_return_fault_return(struct trapframe *) __dead;
 
 #ifdef KVM86
 #include machine/kvm86.h
@@ -276,7 +277,7 @@
 	struct proc *p;
 	int type = frame-tf_trapno;
 	struct pcb *pcb;
-	extern char fusubail[], kcopy_fault[], trapreturn[], IDTVEC(osyscall)[];
+	extern char fusubail[], kcopy_fault[], IDTVEC(osyscall)[];
 	struct trapframe *vframe;
 	ksiginfo_t ksi;
 	void *onfault;
@@ -392,67 +393,76 @@
 
 		/*
 		 * Check for failure during return to user mode.
+		 * This can happen loading invalid values into the segment
+		 * registers, or during the 'iret' itself.
 		 *
 		 * We do this by looking at the instruction we faulted on.
 		 * The specific instructions we recognize only happen when
 		 * returning from a trap, syscall, or interrupt.
-		 *
-		 * At this point, there are (at least) two trap frames on
-		 * the kernel stack; we presume here that we faulted while
-		 * loading our registers out of the outer one.
 		 */
+
+		KSI_INIT_TRAP(ksi);
+		ksi.ksi_signo = SIGSEGV;
+		ksi.ksi_code = SEGV_ACCERR;
+		ksi.ksi_trap = type;
+
 		switch (*(u_char *)frame-tf_eip) {
 		case 0xcf:	/* iret */
-			vframe = (void *)((int)frame-tf_esp -
+			/*
+			 * The 'iret' instruction faulted, so we have the
+			 * 'user' registers saved after the kernel %eip:%cs:%fl
+			 * of the 'iret' and below that the user %eip:%cs:%fl
+			 * the 'iret' was processing.
+			 * We must delete the 3 words of kernel return address
+			 * from the stack to generate a normal stack frame
+			 * (eg for sending a SIGSEGV).
+			 */
+			vframe = (void *)((int *)frame + 3);
+			if (KERNELMODE(vframe-tf_cs, vframe-tf_eflags))
+goto we_re_toast;
+			memmove(vframe, frame,
 			offsetof(struct trapframe, tf_eip));
+			/* Set the faulting address to the user %eip */
+			ksi.ksi_addr = (void *)vframe-tf_eip;
 			break;
 		case 0x8e:
 			switch (*(uint32_t *)frame-tf_eip) {
-			case 0x0c245c8e:	/* movl 0xc(%esp,1),%ds */
-			case 0x0824448e:	/* movl 0x8(%esp,1),%es */
-			case 0x0424648e:	/* movl 0x4(%esp,1),%fs */
-			case 0x00246c8e:	/* movl 0x0(%esp,1),%gs */
+			case 0x8e242c8e:	/* mov (%esp,%gs), then */
+			case 0x0424648e:	/* mov 0x4(%esp),%fs */
+			case 0x0824448e:	/* mov 0x8(%esp),%es */
+			case 0x0c245c8e:	/* mov 0xc(%esp),%ds */
 break;
 			default:
 goto we_re_toast;
 			}
-			vframe = (void *)(int)frame-tf_esp;
+			/*
+			 * We faulted loading 

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

2010-02-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Feb 16 21:24:15 UTC 2010

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: ibcs2_machdep.c svr4_machdep.c

Log Message:
Pull up following revision(s) (requested by drochner in ticket #1307):
sys/arch/i386/i386/svr4_machdep.c: revision 1.96
sys/arch/i386/i386/ibcs2_machdep.c: revision 1.40
fix confused CS selector, fixes the panic reported by Mark Davis
per PR port-i386/42787 (the panic happens due to a GPF when a
privileged descriptor is tried to be loaded with the UPL bit set)
The original bug is very old (pre-2.0, i386/svr4_machdep.c rev. 1.69),
but it was relatively harmless until the order of GDT entries was
shuffled (pre-5.0, i386/segments.h rev. 1.42). Before, it caused
a userlevel data selector to be used for CS which broke the emulation
(likely the reason of PR port-i386/32424). The shuffle made that
a privileged selector was used, causing the GPF.
(recent -current doesn't panic on that GPF which seems to be a
side effect of another change)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.10.1 src/sys/arch/i386/i386/ibcs2_machdep.c
cvs rdiff -u -r1.92 -r1.92.4.1 src/sys/arch/i386/i386/svr4_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/ibcs2_machdep.c
diff -u src/sys/arch/i386/i386/ibcs2_machdep.c:1.36 src/sys/arch/i386/i386/ibcs2_machdep.c:1.36.10.1
--- src/sys/arch/i386/i386/ibcs2_machdep.c:1.36	Mon Apr 28 20:23:24 2008
+++ src/sys/arch/i386/i386/ibcs2_machdep.c	Tue Feb 16 21:24:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ibcs2_machdep.c,v 1.36 2008/04/28 20:23:24 martin Exp $	*/
+/*	$NetBSD: ibcs2_machdep.c,v 1.36.10.1 2010/02/16 21:24:15 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ibcs2_machdep.c,v 1.36 2008/04/28 20:23:24 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: ibcs2_machdep.c,v 1.36.10.1 2010/02/16 21:24:15 bouyer Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_vm86.h
@@ -78,7 +78,7 @@
 		pcb-pcb_savefpu.sv_87.sv_env.en_cw = __iBCS2_NPXCW__;
 	tf = l-l_md.md_regs;
 	tf-tf_eax = 0x200;		/* XXX base of heap */
-	tf-tf_cs = GSEL(LUCODEBIG_SEL, SEL_UPL);
+	tf-tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL);
 }
 
 /*

Index: src/sys/arch/i386/i386/svr4_machdep.c
diff -u src/sys/arch/i386/i386/svr4_machdep.c:1.92 src/sys/arch/i386/i386/svr4_machdep.c:1.92.4.1
--- src/sys/arch/i386/i386/svr4_machdep.c:1.92	Fri Sep 19 19:15:58 2008
+++ src/sys/arch/i386/i386/svr4_machdep.c	Tue Feb 16 21:24:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_machdep.c,v 1.92 2008/09/19 19:15:58 christos Exp $	 */
+/*	$NetBSD: svr4_machdep.c,v 1.92.4.1 2010/02/16 21:24:15 bouyer Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_machdep.c,v 1.92 2008/09/19 19:15:58 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_machdep.c,v 1.92.4.1 2010/02/16 21:24:15 bouyer Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_vm86.h
@@ -119,7 +119,7 @@
 		pcb-pcb_savefpu.sv_xmm.sv_env.en_cw = __SVR4_NPXCW__;
 	else
 		pcb-pcb_savefpu.sv_87.sv_env.en_cw = __SVR4_NPXCW__;
-	tf-tf_cs = GSEL(LUCODEBIG_SEL, SEL_UPL);
+	tf-tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL);
 }
 
 void *



CVS commit: [netbsd-5] src/sys/arch/i386/stand/boot

2010-02-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Feb 14 14:01:08 UTC 2010

Modified Files:
src/sys/arch/i386/stand/boot [netbsd-5]: boot2.c

Log Message:
Pull up following revision(s) (requested by hubertf in ticket #1304):
sys/arch/i386/stand/boot/boot2.c: revision 1.48
When a password is set for the bootloader (installboot -o password=...),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:
 ...
 Choose an option; RETURN for default; SPACE to stop countdown.
 Option 1 will be chosen in 0 seconds.
 Password: *
 Password: *
 Password: *
 unknown command
 commands are:
 boot [xdNx:][filename] [-12acdqsvxz]
  (ex. hd0a:netbsd.old -s
 ls [path]
 dev xd[N[x]]:
 consdev {pc|com[0123]|com[0123]kbd|auto}
 modules {enabled|disabled}
 load {path_to_module}
 multiboot [xdNx:][filename] [args]
 help|?
 quit
 Choose an option; RETURN for default; SPACE to stop countdown.
 Option 1 will be chosen in 0 seconds.
 ...
This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:
 ...
 Choose an option; RETURN for default; SPACE to stop countdown.
 Option 1 will be chosen in 0 seconds.
 Password: 
 Password: 
 Password: 
 Wrong password.
 Choose an option; RETURN for default; SPACE to stop countdown.
 ...
Implement the latter behaviour.


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.1 -r1.38.4.2 src/sys/arch/i386/stand/boot/boot2.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/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.38.4.1 src/sys/arch/i386/stand/boot/boot2.c:1.38.4.2
--- src/sys/arch/i386/stand/boot/boot2.c:1.38.4.1	Sun Oct 18 16:41:28 2009
+++ src/sys/arch/i386/stand/boot/boot2.c	Sun Feb 14 14:01:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.38.4.1 2009/10/18 16:41:28 bouyer Exp $	*/
+/*	$NetBSD: boot2.c,v 1.38.4.2 2010/02/14 14:01:08 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -664,11 +664,23 @@
 #else
 		c = awaitkey((bootconf.timeout  0) ? 0 : bootconf.timeout, 1);
 #endif
-		if ((c != '\r')  (c != '\n')  (c != '\0') 
-		((boot_params.bp_flags  X86_BP_FLAGS_PASSWORD) == 0
-		 || check_password(boot_params.bp_password))) {
-			printf(type \?\ or \help\ for help.\n);
+		if ((c != '\r')  (c != '\n')  (c != '\0')) {
+		if ((boot_params.bp_flags  X86_BP_FLAGS_PASSWORD) == 0) {
+			/* do NOT ask for password */
 			bootmenu(); /* does not return */
+		} else {
+			/* DO ask for password */
+			if (check_password(boot_params.bp_password)) {
+			/* password ok */
+			printf(type \?\ or \help\ for help.\n);
+			bootmenu(); /* does not return */
+			} else {
+			/* bad password */
+			printf(Wrong password.\n);
+			currname = 0;
+			continue;
+			}
+		}
 		}
 
 		/*



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

2009-12-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec  1 19:37:03 UTC 2009

Modified Files:
src/sys/arch/i386/pnpbios [netbsd-5]: fdc_pnpbios.c

Log Message:
Pull up following revision(s) (requested by cube in ticket #1161):
sys/arch/i386/pnpbios/fdc_pnpbios.c: revision 1.15
Properly fix f...@pnpbios as shown by Brian Buhrow in PR#42374.
I think it tells a lot about the relevancy of that attachment when it took
20 months for someone to experience the issue and even then, acpi had to be
disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.10.1 src/sys/arch/i386/pnpbios/fdc_pnpbios.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/pnpbios/fdc_pnpbios.c
diff -u src/sys/arch/i386/pnpbios/fdc_pnpbios.c:1.14 src/sys/arch/i386/pnpbios/fdc_pnpbios.c:1.14.10.1
--- src/sys/arch/i386/pnpbios/fdc_pnpbios.c:1.14	Mon Apr 28 20:23:25 2008
+++ src/sys/arch/i386/pnpbios/fdc_pnpbios.c	Tue Dec  1 19:37:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdc_pnpbios.c,v 1.14 2008/04/28 20:23:25 martin Exp $	*/
+/*	$NetBSD: fdc_pnpbios.c,v 1.14.10.1 2009/12/01 19:37:03 snj Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fdc_pnpbios.c,v 1.14 2008/04/28 20:23:25 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: fdc_pnpbios.c,v 1.14.10.1 2009/12/01 19:37:03 snj Exp $);
 
 #include rnd.h
 
@@ -92,6 +92,7 @@
 
 	aprint_normal(\n);
 
+	fdc-sc_dev = self;
 	fdc-sc_ic = aa-ic;
 
 	if (pnpbios_io_map(aa-pbt, aa-resc, 0, fdc-sc_iot,



CVS commit: [netbsd-5] src/sys/arch/i386/stand/lib

2009-11-28 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Nov 28 15:40:47 UTC 2009

Modified Files:
src/sys/arch/i386/stand/lib [netbsd-5]: pcio.c

Log Message:
Pull up following revision(s) (requested by mbalmer in ticket #1143):
sys/arch/i386/stand/lib/pcio.c: revision 1.26
Have the boot countdown on i386 display starting in N seconds. instead
of starting in N and eliminate a use of sprintf.  Note that on
some rare machines it can be that the BIOS does not provide the delay
function.  On such machines the countdown will almost immediately count down
to zero display starting in 0 seconds.; apparently the net4801 is such a
machine.
Feedback, ideas, and inspiration from tron, ok tron/tonnerre


To generate a diff of this commit:
cvs rdiff -u -r1.23.8.1 -r1.23.8.2 src/sys/arch/i386/stand/lib/pcio.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/stand/lib/pcio.c
diff -u src/sys/arch/i386/stand/lib/pcio.c:1.23.8.1 src/sys/arch/i386/stand/lib/pcio.c:1.23.8.2
--- src/sys/arch/i386/stand/lib/pcio.c:1.23.8.1	Sat Sep 26 18:25:46 2009
+++ src/sys/arch/i386/stand/lib/pcio.c	Sat Nov 28 15:40:47 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcio.c,v 1.23.8.1 2009/09/26 18:25:46 snj Exp $	 */
+/*	$NetBSD: pcio.c,v 1.23.8.2 2009/11/28 15:40:47 bouyer Exp $	 */
 
 /*
  * Copyright (c) 1996, 1997
@@ -331,15 +331,19 @@
 
 	for (;;) {
 		if (tell  (i % POLL_FREQ) == 0) {
-			char numbuf[20];
-			int len, j;
+			char numbuf[32];
+			int len;
 
-			sprintf(numbuf, %d , i/POLL_FREQ);
-			len = strlen(numbuf);
-			for (j = 0; j  len; j++)
-numbuf[len + j] = '\b';
-			numbuf[len + j] = '\0';
-			printf(numbuf);
+			len = snprintf(numbuf, sizeof(numbuf), %d seconds. ,
+			i/POLL_FREQ);
+			if (len  0  len  sizeof(numbuf)) {
+char *p = numbuf;
+
+printf(%s, numbuf);
+while (*p)
+	*p++ = '\b';
+printf(%s, numbuf);
+			}
 		}
 		if (iskey(1)) {
 			/* flush input buffer */
@@ -357,7 +361,7 @@
 
 out:
 	if (tell)
-		printf(0 \n);
+		printf(0 seconds. \n);
 
 	return c;
 }



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

2009-10-18 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Sun Oct 18 10:07:10 UTC 2009

Modified Files:
src/sys/arch/i386/pnpbios [netbsd-5]: ess_pnpbios.c

Log Message:
Pull up the following revisions(s) (requested by snj in ticket #1098):
sys/arch/i386/pnpbios/ess_pnpbios.c:revision 1.19

Fix identification of ESS1878 on Fujitsu FMV-5100 NC/S by PnPBIOS. Fixes
PR/41629.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.10.1 src/sys/arch/i386/pnpbios/ess_pnpbios.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/pnpbios/ess_pnpbios.c
diff -u src/sys/arch/i386/pnpbios/ess_pnpbios.c:1.17 src/sys/arch/i386/pnpbios/ess_pnpbios.c:1.17.10.1
--- src/sys/arch/i386/pnpbios/ess_pnpbios.c:1.17	Mon Apr 28 20:23:25 2008
+++ src/sys/arch/i386/pnpbios/ess_pnpbios.c	Sun Oct 18 10:07:10 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ess_pnpbios.c,v 1.17 2008/04/28 20:23:25 martin Exp $	*/
+/*	$NetBSD: ess_pnpbios.c,v 1.17.10.1 2009/10/18 10:07:10 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ess_pnpbios.c,v 1.17 2008/04/28 20:23:25 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: ess_pnpbios.c,v 1.17.10.1 2009/10/18 10:07:10 sborrill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -75,6 +75,7 @@
 	strcmp(aa-idstr, CPQB0AC)  /* 1869 */
 	strcmp(aa-idstr, CPQB0AD)  /* 1869 */
 	strcmp(aa-idstr, CPQB0F1)  /* 1869 */
+	strcmp(aa-idstr, ESS1878)  /* 1878 */
 	strcmp(aa-idstr, ESS1879))   /* 1879 */
 		return (0);
 



CVS commit: [netbsd-5] src/sys/arch/i386/stand/boot

2009-10-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Oct 18 16:41:28 UTC 2009

Modified Files:
src/sys/arch/i386/stand/boot [netbsd-5]: boot2.c

Log Message:
Apply patch, requested by snj in ticket 1080:
sys/arch/i386/stand/boot/boot2.c: patch

- If the menuformat is not letter, do not allow letter keys to be
aliases for number keys.
- Don't treat timeouts or the return key as an invalid choice.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/arch/i386/stand/boot/boot2.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/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.38 src/sys/arch/i386/stand/boot/boot2.c:1.38.4.1
--- src/sys/arch/i386/stand/boot/boot2.c:1.38	Sat Oct 11 11:06:19 2008
+++ src/sys/arch/i386/stand/boot/boot2.c	Sun Oct 18 16:41:28 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.38 2008/10/11 11:06:19 joerg Exp $	*/
+/*	$NetBSD: boot2.c,v 1.38.4.1 2009/10/18 16:41:28 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -482,11 +482,15 @@
 
 static int getchoicefrominput(char *input, int def)
 {
-	int choice;
+	int choice, usedef;
+
 	choice = -1;
-	if (*input == '\0' || *input == '\r' || *input == '\n')
+	usedef = 0;
+
+	if (*input == '\0' || *input == '\r' || *input == '\n') {
 		choice = def;
-	else if (*input = 'A'  *input  bootconf.nummenu + 'A')
+		usedef = 1;
+	} else if (*input = 'A'  *input  bootconf.nummenu + 'A')
 		choice = (*input) - 'A';
 	else if (*input = 'a'  *input  bootconf.nummenu + 'a')
 		choice = (*input) - 'a';
@@ -495,6 +499,11 @@
 		if (choice  0 || choice = bootconf.nummenu)
 			choice = -1;
 	}
+
+	if (bootconf.menuformat != MENUFORMAT_LETTER 
+	!isnum(*input)  !usedef)
+		choice = -1;
+
 	return choice;
 }
 



CVS commit: [netbsd-5] src/sys/arch/i386/stand/lib

2009-09-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 26 18:25:46 UTC 2009

Modified Files:
src/sys/arch/i386/stand/lib [netbsd-5]: pcio.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #928):
sys/arch/i386/stand/lib/pcio.c: revision 1.27
int 15h/AH=86h (WAIT) doesn't work properly on all hardware and emulators, so
for the countdown use the more coarsely grained sleep implementation based
on int 1ah/AH=00h (GET SYSTEM TIME).
ok ad@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.8.1 src/sys/arch/i386/stand/lib/pcio.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/stand/lib/pcio.c
diff -u src/sys/arch/i386/stand/lib/pcio.c:1.23 src/sys/arch/i386/stand/lib/pcio.c:1.23.8.1
--- src/sys/arch/i386/stand/lib/pcio.c:1.23	Wed May 21 13:36:45 2008
+++ src/sys/arch/i386/stand/lib/pcio.c	Sat Sep 26 18:25:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcio.c,v 1.23 2008/05/21 13:36:45 ad Exp $	 */
+/*	$NetBSD: pcio.c,v 1.23.8.1 2009/09/26 18:25:46 snj Exp $	 */
 
 /*
  * Copyright (c) 1996, 1997
@@ -71,6 +71,20 @@
 
 #define POLL_FREQ 10
 
+static void
+wait(int us)
+{
+	int prev = biosgetsystime();
+	int tgt = prev + (20 * us) / 100;
+	int new;
+
+	while ((new = biosgetsystime())  tgt) {
+		if (new  prev) /* XXX timer wrapped */
+			break;
+		prev = new;
+	}
+}
+
 #ifdef SUPPORT_SERIAL
 static int
 getcomaddr(int idx)
@@ -336,7 +350,7 @@
 			goto out;
 		}
 		if (i--)
-			delay(100 / POLL_FREQ);
+			wait(100 / POLL_FREQ);
 		else
 			break;
 	}



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

2009-09-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Sep 13 22:11:14 UTC 2009

Modified Files:
src/sys/arch/i386/conf [netbsd-5]: ALL GENERIC

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/arch/i386/conf/ALL: revision 1.186
sys/arch/i386/conf/GENERIC: revision 1.921
add options PMS_ELANTECH_TOUCHPAD


To generate a diff of this commit:
cvs rdiff -u -r1.183.4.2 -r1.183.4.3 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.915.2.5 -r1.915.2.6 src/sys/arch/i386/conf/GENERIC

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/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.183.4.2 src/sys/arch/i386/conf/ALL:1.183.4.3
--- src/sys/arch/i386/conf/ALL:1.183.4.2	Fri May  1 01:20:41 2009
+++ src/sys/arch/i386/conf/ALL	Sun Sep 13 22:11:14 2009
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.183.4.2 2009/05/01 01:20:41 snj Exp $
+# $NetBSD: ALL,v 1.183.4.3 2009/09/13 22:11:14 snj Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.183.4.2 $
+#ident 		ALL-$Revision: 1.183.4.3 $
 
 maxusers	32		# estimated number of users
 
@@ -519,6 +519,7 @@
 pms*		at pckbc?		# PS/2 mouse for wsmouse
 options 	PMS_DISABLE_POWERHOOK	# Disable PS/2 reset on resume
 options 	PMS_SYNAPTICS_TOUCHPAD	# Enable support for Synaptics Touchpads
+options 	PMS_ELANTECH_TOUCHPAD	# Enable support for Elantech Touchpads
 vga0		at isa?
 vga*		at pci? dev ? function ?
 pcdisplay0	at isa?			# CGA, MDA, EGA, HGA

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.915.2.5 src/sys/arch/i386/conf/GENERIC:1.915.2.6
--- src/sys/arch/i386/conf/GENERIC:1.915.2.5	Sun May  3 23:45:46 2009
+++ src/sys/arch/i386/conf/GENERIC	Sun Sep 13 22:11:14 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.915.2.5 2009/05/03 23:45:46 snj Exp $
+# $NetBSD: GENERIC,v 1.915.2.6 2009/09/13 22:11:14 snj Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.915.2.5 $
+#ident 		GENERIC-$Revision: 1.915.2.6 $
 
 maxusers	64		# estimated number of users
 
@@ -528,6 +528,7 @@
 pms*		at pckbc?		# PS/2 mouse for wsmouse
 #options 	PMS_DISABLE_POWERHOOK	# Disable PS/2 reset on resume
 options 	PMS_SYNAPTICS_TOUCHPAD	# Enable support for Synaptics Touchpads
+options 	PMS_ELANTECH_TOUCHPAD	# Enable support for Elantech Touchpads
 vga0		at isa?
 vga*		at pci? dev ? function ?
 pcdisplay0	at isa?			# CGA, MDA, EGA, HGA



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

2009-08-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug  7 18:28:20 UTC 2009

Modified Files:
src/sys/arch/i386 [netbsd-5]: Makefile

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #904):
sys/arch/i386/Makefile: revision 1.37 via patch
For the 'tags' target, use the right path to the Atheros HAL sources.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/arch/i386/Makefile

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/Makefile
diff -u src/sys/arch/i386/Makefile:1.35 src/sys/arch/i386/Makefile:1.35.4.1
--- src/sys/arch/i386/Makefile:1.35	Sat Oct 25 22:27:37 2008
+++ src/sys/arch/i386/Makefile	Fri Aug  7 18:28:20 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2008/10/25 22:27:37 apb Exp $
+#	$NetBSD: Makefile,v 1.35.4.1 2009/08/07 18:28:20 snj Exp $
 
 # Makefile for i386 tags file and boot blocks
 
@@ -11,9 +11,9 @@
 	${SYSDIR}/arch/i386/mca/*.[ch] \
 	${SYSDIR}/arch/i386/pci/*.[ch] \
 	${SYSDIR}/arch/i386/pnpbios/*.[ch] \
-	${SYSDIR}/contrib/dev/ath/*.[ch] \
-	${SYSDIR}/contrib/dev/ath/netbsd/*.[ch] \
-	${SYSDIR}/contrib/dev/ath/public/*.[ch]
+	${SYSDIR}/external/isc/atheros_hal/dist/*.[ch] \
+	${SYSDIR}/external/isc/atheros_hal/dist/*/*.[ch] \
+	${SYSDIR}/external/isc/atheros_hal/ic/*.[ch]
 SI386+=	${SYSDIR}/arch/x86/x86/*.[ch] \
 	${SYSDIR}/arch/x86/acpi/*.[ch] \
 	${SYSDIR}/arch/x86/include/*.h \



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

2009-04-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri May  1 01:20:42 UTC 2009

Modified Files:
src/sys/arch/i386/conf [netbsd-5]: ALL GENERIC

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #260):
sys/arch/i386/conf/ALL: revision 1.187
sys/arch/i386/conf/GENERIC: revision 1.922
PR# port-i386/40284: add AMD Geode CS5536 audio driver; add gcscaudio(4)
to i386 GENERIC and ALL kernels


To generate a diff of this commit:
cvs rdiff -u -r1.183.4.1 -r1.183.4.2 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.915.2.3 -r1.915.2.4 src/sys/arch/i386/conf/GENERIC

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/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.183.4.1 src/sys/arch/i386/conf/ALL:1.183.4.2
--- src/sys/arch/i386/conf/ALL:1.183.4.1	Tue Nov 18 01:56:58 2008
+++ src/sys/arch/i386/conf/ALL	Fri May  1 01:20:41 2009
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.183.4.1 2008/11/18 01:56:58 snj Exp $
+# $NetBSD: ALL,v 1.183.4.2 2009/05/01 01:20:41 snj Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.183.4.1 $
+#ident 		ALL-$Revision: 1.183.4.2 $
 
 maxusers	32		# estimated number of users
 
@@ -1270,6 +1270,7 @@
 esm*	at pci? dev ? function ?	# ESS Maestro-1/2/2e PCI Audio Accelerator
 eso*	at pci? dev ? function ?	# ESS Solo-1 PCI AudioDrive
 fms*	at pci? dev ? function ?	# Forte Media FM801
+gcscaudio* at pci? dev ? function ?	# AMD Geode CS5536 Companion Audio
 neo*	at pci? dev ? function ?	# NeoMagic 256 AC'97 Audio
 sv*	at pci? dev ? function ?	# S3 SonicVibes
 yds*	at pci? dev ? function ?	# Yamaha DS-1 PCI Audio

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.915.2.3 src/sys/arch/i386/conf/GENERIC:1.915.2.4
--- src/sys/arch/i386/conf/GENERIC:1.915.2.3	Thu Feb 19 20:23:46 2009
+++ src/sys/arch/i386/conf/GENERIC	Fri May  1 01:20:42 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.915.2.3 2009/02/19 20:23:46 snj Exp $
+# $NetBSD: GENERIC,v 1.915.2.4 2009/05/01 01:20:42 snj Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.915.2.3 $
+#ident 		GENERIC-$Revision: 1.915.2.4 $
 
 maxusers	64		# estimated number of users
 
@@ -1263,6 +1263,7 @@
 esm*	at pci? dev ? function ?	# ESS Maestro-1/2/2e PCI Audio Accelerator
 eso*	at pci? dev ? function ?	# ESS Solo-1 PCI AudioDrive
 fms*	at pci? dev ? function ?	# Forte Media FM801
+gcscaudio* at pci? dev ? function ?	# AMD Geode CS5536 Companion Audio
 neo*	at pci? dev ? function ?	# NeoMagic 256 AC'97 Audio
 sv*	at pci? dev ? function ?	# S3 SonicVibes
 yds*	at pci? dev ? function ?	# Yamaha DS-1 PCI Audio



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

2009-04-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri May  1 01:39:25 UTC 2009

Modified Files:
src/sys/arch/i386/acpi [netbsd-5]: npx_acpi.c spic_acpi.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #498):
sys/arch/i386/acpi/npx_acpi.c: revision 1.18
sys/arch/i386/acpi/spic_acpi.c: revision 1.21
Adjust for acpi_resource_parse aprint changes, noted by Jukka Salmi


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.14.1 src/sys/arch/i386/acpi/npx_acpi.c
cvs rdiff -u -r1.20 -r1.20.10.1 src/sys/arch/i386/acpi/spic_acpi.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/acpi/npx_acpi.c
diff -u src/sys/arch/i386/acpi/npx_acpi.c:1.17 src/sys/arch/i386/acpi/npx_acpi.c:1.17.14.1
--- src/sys/arch/i386/acpi/npx_acpi.c:1.17	Tue Mar  4 14:53:38 2008
+++ src/sys/arch/i386/acpi/npx_acpi.c	Fri May  1 01:39:24 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: npx_acpi.c,v 1.17 2008/03/04 14:53:38 cube Exp $ */
+/* $NetBSD: npx_acpi.c,v 1.17.14.1 2009/05/01 01:39:24 snj Exp $ */
 
 /*
  * Copyright (c) 2002 Jared D. McNeill jmcne...@invisible.ca
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npx_acpi.c,v 1.17 2008/03/04 14:53:38 cube Exp $);
+__KERNEL_RCSID(0, $NetBSD: npx_acpi.c,v 1.17.14.1 2009/05/01 01:39:24 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -88,9 +88,6 @@
 	struct acpi_irq *irq;
 	ACPI_STATUS rv;
 
-	aprint_naive(\n);
-	aprint_normal(\n);
-
 	sc-sc_dev = self;
 
 	/* parse resources */

Index: src/sys/arch/i386/acpi/spic_acpi.c
diff -u src/sys/arch/i386/acpi/spic_acpi.c:1.20 src/sys/arch/i386/acpi/spic_acpi.c:1.20.10.1
--- src/sys/arch/i386/acpi/spic_acpi.c:1.20	Sun May  4 16:13:35 2008
+++ src/sys/arch/i386/acpi/spic_acpi.c	Fri May  1 01:39:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: spic_acpi.c,v 1.20 2008/05/04 16:13:35 xtraeme Exp $	*/
+/*	$NetBSD: spic_acpi.c,v 1.20.10.1 2009/05/01 01:39:24 snj Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: spic_acpi.c,v 1.20 2008/05/04 16:13:35 xtraeme Exp $);
+__KERNEL_RCSID(0, $NetBSD: spic_acpi.c,v 1.20.10.1 2009/05/01 01:39:24 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -88,9 +88,6 @@
 
 	ACPI_STATUS rv;
 
-	aprint_naive(: Sony Programmable I/O Controller\n);
-	aprint_normal(: Sony Programmable I/O Controller\n);
-
 	sc-sc_spic.sc_dev = self;
 	sc-sc_node = aa-aa_node;
 



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

2009-04-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Apr 10 18:10:46 UTC 2009

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: kvm86.c

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #683):
sys/arch/i386/i386/kvm86.c: revision 1.18
Add missing cpu.h include required by last commit.


To generate a diff of this commit:
cvs rdiff -u -r1.15.12.1 -r1.15.12.2 src/sys/arch/i386/i386/kvm86.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/kvm86.c
diff -u src/sys/arch/i386/i386/kvm86.c:1.15.12.1 src/sys/arch/i386/i386/kvm86.c:1.15.12.2
--- src/sys/arch/i386/i386/kvm86.c:1.15.12.1	Sat Apr  4 17:39:09 2009
+++ src/sys/arch/i386/i386/kvm86.c	Fri Apr 10 18:10:46 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm86.c,v 1.15.12.1 2009/04/04 17:39:09 snj Exp $ */
+/* $NetBSD: kvm86.c,v 1.15.12.2 2009/04/10 18:10:46 snj Exp $ */
 
 /*
  * Copyright (c) 2002
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kvm86.c,v 1.15.12.1 2009/04/04 17:39:09 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: kvm86.c,v 1.15.12.2 2009/04/10 18:10:46 snj Exp $);
 
 #include opt_multiprocessor.h
 
@@ -37,6 +37,7 @@
 #include sys/user.h
 #include sys/malloc.h
 #include sys/mutex.h
+#include sys/cpu.h
 
 #include uvm/uvm.h