CVS commit: src/sys/arch/amd64/include

2021-04-17 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 17 20:12:55 UTC 2021

Modified Files:
src/sys/arch/amd64/include: asm.h byte_swap.h cpu.h db_machdep.h
frame_regs.h frameasm.h i82093reg.h int_limits.h profile.h
segments.h

Log Message:
sys/arch/amd64: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/asm.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/include/byte_swap.h \
src/sys/arch/amd64/include/frame_regs.h
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/amd64/include/cpu.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/db_machdep.h
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/amd64/include/frameasm.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/amd64/include/i82093reg.h \
src/sys/arch/amd64/include/int_limits.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/include/profile.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/amd64/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/amd64/include/asm.h
diff -u src/sys/arch/amd64/include/asm.h:1.21 src/sys/arch/amd64/include/asm.h:1.22
--- src/sys/arch/amd64/include/asm.h:1.21	Sat Apr 25 15:26:16 2020
+++ src/sys/arch/amd64/include/asm.h	Sat Apr 17 20:12:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.21 2020/04/25 15:26:16 bouyer Exp $	*/
+/*	$NetBSD: asm.h,v 1.22 2021/04/17 20:12:55 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -81,12 +81,12 @@
 	ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name:
 #define	IDTVEC_END(name) \
 	.size X ## name, . - X ## name
-#else 
+#else
 #define	IDTVEC(name) \
 	ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name:
 #define	IDTVEC_END(name) \
 	.size X/**/name, . - X/**/name
-#endif /* __STDC__ */ 
+#endif /* __STDC__ */
 #endif /* _KERNEL */
 
 #ifdef __STDC__

Index: src/sys/arch/amd64/include/byte_swap.h
diff -u src/sys/arch/amd64/include/byte_swap.h:1.7 src/sys/arch/amd64/include/byte_swap.h:1.8
--- src/sys/arch/amd64/include/byte_swap.h:1.7	Thu Jan 14 02:06:04 2010
+++ src/sys/arch/amd64/include/byte_swap.h	Sat Apr 17 20:12:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: byte_swap.h,v 1.7 2010/01/14 02:06:04 joerg Exp $	*/
+/*	$NetBSD: byte_swap.h,v 1.8 2021/04/17 20:12:55 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2010 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@ static __inline uint16_t __byte_swap_u16
 static __inline uint16_t
 __byte_swap_u16_variable(uint16_t x)
 {
-	__asm volatile ("rorw $8, %w1" : "=r" (x) : "0" (x)); 
+	__asm volatile ("rorw $8, %w1" : "=r" (x) : "0" (x));
 	return (x);
 }
 
Index: src/sys/arch/amd64/include/frame_regs.h
diff -u src/sys/arch/amd64/include/frame_regs.h:1.7 src/sys/arch/amd64/include/frame_regs.h:1.8
--- src/sys/arch/amd64/include/frame_regs.h:1.7	Sun Apr 26 18:49:39 2015
+++ src/sys/arch/amd64/include/frame_regs.h	Sat Apr 17 20:12:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame_regs.h,v 1.7 2015/04/26 18:49:39 mrg Exp $	*/
+/*	$NetBSD: frame_regs.h,v 1.8 2021/04/17 20:12:55 rillig Exp $	*/
 
 #ifndef _AMD64_FRAME_REGS_H_
 #define _AMD64_FRAME_REGS_H_
@@ -11,7 +11,7 @@
  * has been changed to improve syscall efficiency.
  *
  * Notes:
- * 1) gdb (amd64nbsd-tdep.c) has a lookup table that assumes the __greg_t 
+ * 1) gdb (amd64nbsd-tdep.c) has a lookup table that assumes the __greg_t
  *ordering.
  * 2) src/lib/libc/arch/x86_64/gen/makecontext.c assumes that the first
  *6 entries in the __greg_t array match the registers used to pass

Index: src/sys/arch/amd64/include/cpu.h
diff -u src/sys/arch/amd64/include/cpu.h:1.68 src/sys/arch/amd64/include/cpu.h:1.69
--- src/sys/arch/amd64/include/cpu.h:1.68	Tue Mar 17 17:18:49 2020
+++ src/sys/arch/amd64/include/cpu.h	Sat Apr 17 20:12:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.68 2020/03/17 17:18:49 maxv Exp $	*/
+/*	$NetBSD: cpu.h,v 1.69 2021/04/17 20:12:55 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -84,7 +84,7 @@ x86_curlwp(void)
 #define CLKF_INTR(frame)	(curcpu()->ci_idepth > 0)
 #define LWP_PC(l)		((l)->l_md.md_regs->tf_rip)
 
-void *cpu_uarea_alloc(bool);		
+void *cpu_uarea_alloc(bool);
 bool cpu_uarea_free(void *);
 
 #endif	/* _KERNEL */

Index: src/sys/arch/amd64/include/db_machdep.h
diff -u src/sys/arch/amd64/include/db_machdep.h:1.16 src/sys/arch/amd64/include/db_machdep.h:1.17
--- src/sys/arch/amd64/include/db_machdep.h:1.16	Mon Nov  6 03:47:45 2017
+++ src/sys/arch/amd64/include/db_machdep.h	Sat Apr 17 20:12:55 2021
@@ -1,27 +1,27 @@
-/*	$NetBSD: db_machdep.h,v 1.16 2017/11/06 03:47:45 christos Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.17 2021/04/17 20:12:55 rillig Exp $	*/
 
-/* 
+/*
  * Mach Operating System
  * Copyright (c) 1991,1990 Carnegie Mellon University
  * All Rights Reserved.
- * 
+ *
  * Permission to use, copy, modify and distribute this software and its
  * 

CVS commit: src/sys/arch/amd64/include

2020-11-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 26 20:50:45 UTC 2020

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
make the max text size the same as the max data size


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.53 src/sys/arch/amd64/include/vmparam.h:1.54
--- src/sys/arch/amd64/include/vmparam.h:1.53	Tue Oct  6 09:42:03 2020
+++ src/sys/arch/amd64/include/vmparam.h	Thu Nov 26 15:50:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.53 2020/10/06 13:42:03 christos Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.54 2020/11/26 20:50:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -88,7 +88,7 @@
 /*
  * Virtual memory related constants, all in bytes
  */
-#define	MAXTSIZ		(256*1024*1024)		/* max text size */
+#define	MAXTSIZ		(8L*1024*1024*1024)	/* max text size */
 #ifndef DFLDSIZ
 #define	DFLDSIZ		(256*1024*1024)		/* initial data size limit */
 #endif



CVS commit: src/sys/arch/amd64/include

2020-11-18 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Nov 18 16:13:34 UTC 2020

Modified Files:
src/sys/arch/amd64/include: msan.h

Log Message:
Make this at least compile.
Looks like a missing part from "Round of uvm.h cleanup (2020-09-05 18:30)".


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/include/msan.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/amd64/include/msan.h
diff -u src/sys/arch/amd64/include/msan.h:1.5 src/sys/arch/amd64/include/msan.h:1.6
--- src/sys/arch/amd64/include/msan.h:1.5	Wed Sep  9 16:29:59 2020
+++ src/sys/arch/amd64/include/msan.h	Wed Nov 18 16:13:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msan.h,v 1.5 2020/09/09 16:29:59 maxv Exp $	*/
+/*	$NetBSD: msan.h,v 1.6 2020/11/18 16:13:34 hannken Exp $	*/
 
 /*
  * Copyright (c) 2019-2020 Maxime Villard, m00nbsd.net
@@ -30,6 +30,8 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
 



CVS commit: src/sys/arch/amd64/include

2020-06-29 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Jun 29 09:56:51 UTC 2020

Modified Files:
src/sys/arch/amd64/include: param.h

Log Message:
increase UPAGES (used for lwp kernel stack) for SVS so the the
amount of actually usable kernel stack is the same for SVS and
non-SVS kernels (currently 12 KiB)

discussed with maxv@, part of investigation for PR kern/S55402


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/amd64/include/param.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/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.37 src/sys/arch/amd64/include/param.h:1.38
--- src/sys/arch/amd64/include/param.h:1.37	Tue Mar 17 17:18:49 2020
+++ src/sys/arch/amd64/include/param.h	Mon Jun 29 09:56:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.37 2020/03/17 17:18:49 maxv Exp $	*/
+/*	$NetBSD: param.h,v 1.38 2020/06/29 09:56:51 jdolecek Exp $	*/
 
 #ifdef __x86_64__
 
@@ -12,6 +12,7 @@
 #if defined(_KERNEL_OPT)
 #include "opt_kasan.h"
 #include "opt_kmsan.h"
+#include "opt_svs.h"
 #endif
 #endif
 
@@ -69,6 +70,8 @@
 
 #if defined(KASAN) || defined(KMSAN)
 #define	UPAGES		8
+#elif defined(SVS)
+#define	UPAGES		6		/* 1 page used internally by SVS */
 #else
 #define	UPAGES		5		/* pages of u-area (1 for redzone) */
 #endif



CVS commit: src/sys/arch/amd64/include

2020-06-21 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jun 21 16:53:37 UTC 2020

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Fix comment


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.50 src/sys/arch/amd64/include/frameasm.h:1.51
--- src/sys/arch/amd64/include/frameasm.h:1.50	Mon Jun  1 22:58:06 2020
+++ src/sys/arch/amd64/include/frameasm.h	Sun Jun 21 16:53:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.50 2020/06/01 22:58:06 ad Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.51 2020/06/21 16:53:37 bouyer Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -48,7 +48,7 @@
 #define STI(temp_reg) sti
 #define PUSHF(temp_reg) pushf
 #define POPL popl
-#endif	/* XEN */
+#endif	/* XENPV */
 
 #define HP_NAME_CLAC		1
 #define HP_NAME_STAC		2



CVS commit: src/sys/arch/amd64/include

2020-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun  7 23:15:51 UTC 2020

Modified Files:
src/sys/arch/amd64/include: msan.h

Log Message:
make this compile.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/include/msan.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/amd64/include/msan.h
diff -u src/sys/arch/amd64/include/msan.h:1.3 src/sys/arch/amd64/include/msan.h:1.4
--- src/sys/arch/amd64/include/msan.h:1.3	Sat Apr 25 11:26:16 2020
+++ src/sys/arch/amd64/include/msan.h	Sun Jun  7 19:15:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msan.h,v 1.3 2020/04/25 15:26:16 bouyer Exp $	*/
+/*	$NetBSD: msan.h,v 1.4 2020/06/07 23:15:51 christos Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@ kmsan_md_shadow_map_page(vaddr_t va)
 			L2_BASE[pl2_i(va)] = pa | pteflags | PTE_PS |
 			pmap_pg_g;
 			__insn_barrier();
-			__builtin_memset(va, 0, NBPD_L2);
+			__builtin_memset((void *)va, 0, NBPD_L2);
 			return;
 		}
 		pa = __md_palloc();



CVS commit: src/sys/arch/amd64/include

2020-04-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Apr 15 17:00:08 UTC 2020

Modified Files:
src/sys/arch/amd64/include: asan.h

Log Message:
Use large pages for the kASan shadow, same as kMSan.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/include/asan.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/amd64/include/asan.h
diff -u src/sys/arch/amd64/include/asan.h:1.3 src/sys/arch/amd64/include/asan.h:1.4
--- src/sys/arch/amd64/include/asan.h:1.3	Sat Mar  9 08:42:25 2019
+++ src/sys/arch/amd64/include/asan.h	Wed Apr 15 17:00:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: asan.h,v 1.3 2019/03/09 08:42:25 maxv Exp $	*/
+/*	$NetBSD: asan.h,v 1.4 2020/04/15 17:00:07 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -92,29 +92,60 @@ __md_palloc(void)
 	else
 		pa = pmap_get_physpage();
 
+	/* The page is zeroed. */
 	return pa;
 }
 
+static inline paddr_t
+__md_palloc_large(void)
+{
+	struct pglist pglist;
+	int ret;
+
+	if (__predict_false(__md_early))
+		return 0;
+	if (!uvm.page_init_done)
+		return 0;
+
+	ret = uvm_pglistalloc(NBPD_L2, 0, ~0UL, NBPD_L2, 0,
+	, 1, 0);
+	if (ret != 0)
+		return 0;
+
+	/* The page may not be zeroed. */
+	return VM_PAGE_TO_PHYS(TAILQ_FIRST());
+}
+
 static void
 kasan_md_shadow_map_page(vaddr_t va)
 {
+	const pt_entry_t pteflags = PTE_W | pmap_pg_nx | PTE_P;
 	paddr_t pa;
 
 	if (!pmap_valid_entry(L4_BASE[pl4_i(va)])) {
 		pa = __md_palloc();
-		L4_BASE[pl4_i(va)] = pa | PTE_W | pmap_pg_nx | PTE_P;
+		L4_BASE[pl4_i(va)] = pa | pteflags;
 	}
 	if (!pmap_valid_entry(L3_BASE[pl3_i(va)])) {
 		pa = __md_palloc();
-		L3_BASE[pl3_i(va)] = pa | PTE_W | pmap_pg_nx | PTE_P;
+		L3_BASE[pl3_i(va)] = pa | pteflags;
 	}
 	if (!pmap_valid_entry(L2_BASE[pl2_i(va)])) {
+		if ((pa = __md_palloc_large()) != 0) {
+			L2_BASE[pl2_i(va)] = pa | pteflags | PTE_PS |
+			pmap_pg_g;
+			__insn_barrier();
+			__builtin_memset((void *)va, 0, NBPD_L2);
+			return;
+		}
 		pa = __md_palloc();
-		L2_BASE[pl2_i(va)] = pa | PTE_W | pmap_pg_nx | PTE_P;
+		L2_BASE[pl2_i(va)] = pa | pteflags;
+	} else if (L2_BASE[pl2_i(va)] & PTE_PS) {
+		return;
 	}
 	if (!pmap_valid_entry(L1_BASE[pl1_i(va)])) {
 		pa = __md_palloc();
-		L1_BASE[pl1_i(va)] = pa | PTE_W | pmap_pg_g | pmap_pg_nx | PTE_P;
+		L1_BASE[pl1_i(va)] = pa | pteflags | pmap_pg_g;
 	}
 }
 



CVS commit: src/sys/arch/amd64/include

2020-01-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jan 22 16:52:46 UTC 2020

Modified Files:
src/sys/arch/amd64/include: param.h vmparam.h

Log Message:
Move the UBC defaults into vmparam.h


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/amd64/include/vmparam.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/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.34 src/sys/arch/amd64/include/param.h:1.35
--- src/sys/arch/amd64/include/param.h:1.34	Fri Jan 17 21:14:16 2020
+++ src/sys/arch/amd64/include/param.h	Wed Jan 22 16:52:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.34 2020/01/17 21:14:16 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.35 2020/01/22 16:52:46 ad Exp $	*/
 
 #ifdef __x86_64__
 
@@ -113,17 +113,6 @@
 #define	NKMEMPAGES_MAX_UNLIMITED 1
 
 /*
- * Defaults for Unified Buffer Cache parameters.
- */
-
-#ifndef UBC_WINSHIFT
-#define	UBC_WINSHIFT	16	/* 64kB */
-#endif
-#ifndef UBC_NWINS
-#define	UBC_NWINS	4096	/* 256MB */
-#endif
-
-/*
  * XXXfvdl the PD* stuff is different from i386.
  */
 /*

Index: src/sys/arch/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.51 src/sys/arch/amd64/include/vmparam.h:1.52
--- src/sys/arch/amd64/include/vmparam.h:1.51	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/include/vmparam.h	Wed Jan 22 16:52:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.51 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.52 2020/01/22 16:52:46 ad Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -63,6 +63,17 @@
 #define	PAGER_MAP_DEFAULT_SIZE (512 * 1024 * 1024)
 
 /*
+ * Defaults for Unified Buffer Cache parameters.
+ */
+
+#ifndef UBC_WINSHIFT
+#define	UBC_WINSHIFT	16	/* 64kB */
+#endif
+#ifndef UBC_NWINS
+#define	UBC_NWINS	4096	/* 256MB */
+#endif
+
+/*
  * USRSTACK is the top (end) of the user stack. Immediately above the
  * user stack resides the user structure, which is UPAGES long and contains
  * the kernel stack.



CVS commit: src/sys/arch/amd64/include

2020-01-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Jan 17 21:14:16 UTC 2020

Modified Files:
src/sys/arch/amd64/include: param.h

Log Message:
Bump UBC_WINSHIFT & UBC_NWINS to more reasonable values for amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/include/param.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/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.33 src/sys/arch/amd64/include/param.h:1.34
--- src/sys/arch/amd64/include/param.h:1.33	Thu Nov 14 16:23:52 2019
+++ src/sys/arch/amd64/include/param.h	Fri Jan 17 21:14:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.33 2019/11/14 16:23:52 maxv Exp $	*/
+/*	$NetBSD: param.h,v 1.34 2020/01/17 21:14:16 ad Exp $	*/
 
 #ifdef __x86_64__
 
@@ -113,6 +113,17 @@
 #define	NKMEMPAGES_MAX_UNLIMITED 1
 
 /*
+ * Defaults for Unified Buffer Cache parameters.
+ */
+
+#ifndef UBC_WINSHIFT
+#define	UBC_WINSHIFT	16	/* 64kB */
+#endif
+#ifndef UBC_NWINS
+#define	UBC_NWINS	4096	/* 256MB */
+#endif
+
+/*
  * XXXfvdl the PD* stuff is different from i386.
  */
 /*



CVS commit: src/sys/arch/amd64/include

2019-12-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Dec  2 19:17:27 UTC 2019

Modified Files:
src/sys/arch/amd64/include: ptrace.h

Log Message:
Define PT_GETXMMREGS and PT_SETXMMREGS in PT_MACHDEP_STRINGS/amd64


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/include/ptrace.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/amd64/include/ptrace.h
diff -u src/sys/arch/amd64/include/ptrace.h:1.19 src/sys/arch/amd64/include/ptrace.h:1.20
--- src/sys/arch/amd64/include/ptrace.h:1.19	Wed Nov 27 09:16:58 2019
+++ src/sys/arch/amd64/include/ptrace.h	Mon Dec  2 19:17:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.19 2019/11/27 09:16:58 rin Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.20 2019/12/02 19:17:27 kamil Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -69,7 +69,9 @@
 	"PT_SETSTEP", \
 	"PT_CLEARSTEP", \
 	"PT_GETXSTATE", \
-	"PT_SETXSTATE"
+	"PT_SETXSTATE", \
+	"PT_GETXMMREGS", \
+	"PT_SETXMMREGS"
 
 #include 
 #define PTRACE_REG_PC(r)	(r)->regs[_REG_RIP]



CVS commit: src/sys/arch/amd64/include

2019-03-16 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Mar 16 11:50:48 UTC 2019

Modified Files:
src/sys/arch/amd64/include: param.h

Log Message:
Bump STACK_ALIGNBYTES to (16 - 1) to satisfy requirement by AMD64
System V ABI in kernel level. This is because

(1) for LLDB, we want to bypass libc/csu (and therefore manual stack
alignment in _start), and

(2) rtld in glibc >= 2.23 for Linux/x86_64 requires it.

Fix SEGV for Linux/x86_64 binaries with glibc >= 2.23, reported as
PR port-amd64/54052.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/include/param.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/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.29 src/sys/arch/amd64/include/param.h:1.30
--- src/sys/arch/amd64/include/param.h:1.29	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/include/param.h	Sat Mar 16 11:50:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.29 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: param.h,v 1.30 2019/03/16 11:50:48 rin Exp $	*/
 
 #ifdef __x86_64__
 
@@ -23,6 +23,13 @@
 
 #define ALIGNED_POINTER(p,t)	1
 
+/*
+ * Align stack as required by AMD64 System V ABI. This is because
+ * (1) we want to bypass libc/csu in LLDB, and
+ * (2) rtld in glibc >= 2.23 for Linux/x86_64 requires it.
+ */
+#define STACK_ALIGNBYTES	(16 - 1)
+
 #define ALIGNBYTES32		(sizeof(int) - 1)
 #define ALIGN32(p)		(((u_long)(p) + ALIGNBYTES32) &~ALIGNBYTES32)
 



CVS commit: src/sys/arch/amd64/include

2019-02-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Feb  7 00:19:54 UTC 2019

Modified Files:
src/sys/arch/amd64/include: ptrace.h

Log Message:
Define PTRACE_ILLEGAL_ASM for NetBSD/amd64 in ptrace.h

Use ud2 instruction that is guaranteed to raise an invalid instruction
exception (through SIGILL).

On NetBSD and FreeBSD this instruction raises ILL_PRVOPC, on Linux
ILL_ILLOPN. It's not clear which opion is better "Privileged opcode" vs
"Illegal operand", because ud2 doesn't seem to be a privileged operation
and it doesn't take any operand.

Assume in future changes that this opcode will raise ILL_PRVOPC and keep
it purely for testing purposes of the SIGILL crash type.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/include/ptrace.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/amd64/include/ptrace.h
diff -u src/sys/arch/amd64/include/ptrace.h:1.12 src/sys/arch/amd64/include/ptrace.h:1.13
--- src/sys/arch/amd64/include/ptrace.h:1.12	Wed Apr 12 18:17:59 2017
+++ src/sys/arch/amd64/include/ptrace.h	Thu Feb  7 00:19:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.12 2017/04/12 18:17:59 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.13 2019/02/07 00:19:54 kamil Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -63,6 +63,8 @@
 #define PTRACE_REG_SP(r)	(r)->regs[_REG_RSP]
 #define PTRACE_REG_INTRV(r)	(r)->regs[_REG_RAX]
 
+#define PTRACE_ILLEGAL_ASM	__asm __volatile ("ud2" : : : "memory")
+
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xcc })
 #define PTRACE_BREAKPOINT_ASM	__asm __volatile ("int3" : : : "memory")
 #define PTRACE_BREAKPOINT_SIZE	1



CVS commit: src/sys/arch/amd64/include

2019-02-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb  4 15:07:35 UTC 2019

Modified Files:
src/sys/arch/amd64/include: asan.h

Log Message:
Add more symbols to the unwinder, in case we get a KASAN message inside
an exception handler.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/include/asan.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/amd64/include/asan.h
diff -u src/sys/arch/amd64/include/asan.h:1.1 src/sys/arch/amd64/include/asan.h:1.2
--- src/sys/arch/amd64/include/asan.h:1.1	Wed Oct 31 06:26:26 2018
+++ src/sys/arch/amd64/include/asan.h	Mon Feb  4 15:07:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: asan.h,v 1.1 2018/10/31 06:26:26 maxv Exp $	*/
+/*	$NetBSD: asan.h,v 1.2 2019/02/04 15:07:34 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -165,7 +165,9 @@ static inline bool
 __md_unwind_end(const char *name)
 {
 	if (!strcmp(name, "syscall") ||
+	!strcmp(name, "alltraps") ||
 	!strcmp(name, "handle_syscall") ||
+	!strncmp(name, "Xtrap", 5) ||
 	!strncmp(name, "Xintr", 5) ||
 	!strncmp(name, "Xhandle", 7) ||
 	!strncmp(name, "Xresume", 7) ||



CVS commit: src/sys/arch/amd64/include

2019-01-21 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 21 20:22:48 UTC 2019

Modified Files:
src/sys/arch/amd64/include: limits.h

Log Message:
Fix wrong scoping of {U,}LLONG_MAX.
PR 53298 from Roberto E. Vargas Caballero.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/include/limits.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/amd64/include/limits.h
diff -u src/sys/arch/amd64/include/limits.h:1.14 src/sys/arch/amd64/include/limits.h:1.15
--- src/sys/arch/amd64/include/limits.h:1.14	Mon Apr 21 10:53:47 2014
+++ src/sys/arch/amd64/include/limits.h	Mon Jan 21 20:22:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: limits.h,v 1.14 2014/04/21 10:53:47 matt Exp $	*/
+/*	$NetBSD: limits.h,v 1.15 2019/01/21 20:22:48 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988 The Regents of the University of California.
@@ -56,10 +56,6 @@
 #define	LONG_MAX	0x7fffL	/* max value for a long */
 #define	LONG_MIN	(-0x7fffL-1)	/* min value for a long */
 
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-defined(_NETBSD_SOURCE)
-#define	SSIZE_MAX	LONG_MAX		/* max value for a ssize_t */
-
 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
 defined(_NETBSD_SOURCE)
 #define	ULLONG_MAX	0xULL	/* max unsigned long long */
@@ -67,6 +63,10 @@
 #define	LLONG_MIN	(-0x7fffLL-1) /* min signed long long */
 #endif
 
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+defined(_NETBSD_SOURCE)
+#define	SSIZE_MAX	LONG_MAX		/* max value for a ssize_t */
+
 #if defined(_NETBSD_SOURCE)
 #define	SSIZE_MIN	LONG_MIN		/* min value for a ssize_t */
 #define	SIZE_T_MAX	ULONG_MAX	/* max value for a size_t */



CVS commit: src/sys/arch/amd64/include

2019-01-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jan 17 19:26:03 UTC 2019

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Increase VM_PHYSSEG_MAX from 32 to 64. Saw an example on tech-kern@ of a
heavily fragmented memory map.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.49 src/sys/arch/amd64/include/vmparam.h:1.50
--- src/sys/arch/amd64/include/vmparam.h:1.49	Mon Oct 29 19:43:16 2018
+++ src/sys/arch/amd64/include/vmparam.h	Thu Jan 17 19:26:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.49 2018/10/29 19:43:16 maya Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.50 2019/01/17 19:26:03 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -159,7 +159,7 @@ extern vaddr_t vm_max_kernel_address;
 /* virtual sizes (bytes) for various kernel submaps */
 #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
 
-#define VM_PHYSSEG_MAX		32	/* 1 "hole" + 31 free lists */
+#define VM_PHYSSEG_MAX		64	/* 1 "hole" + 63 free lists */
 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
 
 #define	VM_NFREELIST		6



CVS commit: src/sys/arch/amd64/include

2018-11-19 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Nov 19 15:43:32 UTC 2018

Modified Files:
src/sys/arch/amd64/include: frame.h

Log Message:
Fix editing screwup in previous...   noted by Rin Okuyama (thanks!)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/include/frame.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/amd64/include/frame.h
diff -u src/sys/arch/amd64/include/frame.h:1.19 src/sys/arch/amd64/include/frame.h:1.20
--- src/sys/arch/amd64/include/frame.h:1.19	Mon Nov 19 10:05:09 2018
+++ src/sys/arch/amd64/include/frame.h	Mon Nov 19 15:43:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.19 2018/11/19 10:05:09 kre Exp $	*/
+/*	$NetBSD: frame.h,v 1.20 2018/11/19 15:43:32 kre Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -101,8 +101,8 @@ struct intrframe {
 /*
  * Need arch independany way to access IP and CS from intrframe
  */
-#define	_INTRFRAME_IP	if_tf.tf_cs
-#define	_INTRFRAME_CS	if_tf.tf_rip
+#define	_INTRFRAME_CS	if_tf.tf_cs
+#define	_INTRFRAME_IP	if_tf.tf_rip
 #endif
 
 /*



CVS commit: src/sys/arch/amd64/include

2018-10-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Oct 31 18:35:05 UTC 2018

Modified Files:
src/sys/arch/amd64/include: Makefile

Log Message:
Revert my kasan addition in this makefile, it looks like it causes
asan.h to be installed, while we don't want it to be.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/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/amd64/include/Makefile
diff -u src/sys/arch/amd64/include/Makefile:1.21 src/sys/arch/amd64/include/Makefile:1.22
--- src/sys/arch/amd64/include/Makefile:1.21	Wed Oct 31 06:26:26 2018
+++ src/sys/arch/amd64/include/Makefile	Wed Oct 31 18:35:04 2018
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.21 2018/10/31 06:26:26 maxv Exp $
+#	$NetBSD: Makefile,v 1.22 2018/10/31 18:35:04 maxv Exp $
 
 INCSDIR= /usr/include/amd64
 
-INCS=	ansi.h aout_machdep.h asan.h asm.h \
+INCS=	ansi.h aout_machdep.h asm.h \
 	bootinfo.h bswap.h byte_swap.h \
 	cdefs.h cpu.h cpu_rng.h\
 	disklabel.h \



CVS commit: src/sys/arch/amd64/include

2018-10-29 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Oct 29 19:43:17 UTC 2018

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Make VM_MIN_KERNEL_ADDRESS and others available in the _KMEMUSER case
as well. This affects ddb. Tested by htodd.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.48 src/sys/arch/amd64/include/vmparam.h:1.49
--- src/sys/arch/amd64/include/vmparam.h:1.48	Sun Oct 28 14:12:16 2018
+++ src/sys/arch/amd64/include/vmparam.h	Mon Oct 29 19:43:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.48 2018/10/28 14:12:16 maxv Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.49 2018/10/29 19:43:16 maya Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -133,7 +133,7 @@
 #define VM_MAX_KERNEL_ADDRESS_DEFAULT	0xc000
 #endif
 
-#ifdef _KERNEL
+#if defined(_KMEMUSER) || defined(_KERNEL)
 extern vaddr_t vm_min_kernel_address;
 extern vaddr_t vm_max_kernel_address;
 #define VM_MIN_KERNEL_ADDRESS	vm_min_kernel_address



CVS commit: src/sys/arch/amd64/include

2018-10-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Oct 28 14:12:16 UTC 2018

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Add #ifdef _KERNEL, vaddr_t does not exist in userland, and we don't want
externs anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.47 src/sys/arch/amd64/include/vmparam.h:1.48
--- src/sys/arch/amd64/include/vmparam.h:1.47	Sun Aug 12 10:50:35 2018
+++ src/sys/arch/amd64/include/vmparam.h	Sun Oct 28 14:12:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.47 2018/08/12 10:50:35 maxv Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.48 2018/10/28 14:12:16 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -133,10 +133,12 @@
 #define VM_MAX_KERNEL_ADDRESS_DEFAULT	0xc000
 #endif
 
+#ifdef _KERNEL
 extern vaddr_t vm_min_kernel_address;
 extern vaddr_t vm_max_kernel_address;
 #define VM_MIN_KERNEL_ADDRESS	vm_min_kernel_address
 #define VM_MAX_KERNEL_ADDRESS	vm_max_kernel_address
+#endif
 
 /*
  * The address to which unspecified mapping requests default



CVS commit: src/sys/arch/amd64/include

2018-08-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 17 14:39:51 UTC 2018

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
Remove big outdated comment, remove unused macros, remove XXX that has
nothing to do here, style.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.53 src/sys/arch/amd64/include/pmap.h:1.54
--- src/sys/arch/amd64/include/pmap.h:1.53	Sun Aug 12 15:31:01 2018
+++ src/sys/arch/amd64/include/pmap.h	Fri Aug 17 14:39:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.53 2018/08/12 15:31:01 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.54 2018/08/17 14:39:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -81,60 +81,14 @@
 #ifdef XEN
 #include 
 #include 
-#endif /* XEN */
-
-/*
- * The x86_64 pmap module closely resembles the i386 one and it 
- * uses the same recursive entry scheme. See the i386 pmap.h
- * for a description. The obvious difference is that 3 extra
- * levels of page table need to be dealt with. The level 1 page
- * table pages are at:
- *
- * l1: 0x7f80 - 0x7fff (39 bits, needs PML4 entry)
- *
- * The rest is kept as physical pages in 3 UVM objects, and is
- * temporarily mapped for virtual access when needed.
- *
- * Note that address space is signed, so the layout for 48 bits is:
- *
- *  +-+ 0x
- *  | |
- *  | Unused  |
- *  | |
- *  +-+ 0xff80
- *  ~ ~
- *  | |
- *  | Kernel Space|
- *  | |
- *  | |
- *  +-+ 0x8000 = 0x8000
- *  | |
- *  |alt.L1 table (PTE pages) |
- *  | |
- *  +-+ 0x7f80
- *  ~ ~
- *  | |
- *  | User Space  |
- *  | |
- *  | |
- *  +-+ 0x
- *
- * In other words, there is a 'VA hole' at 0x8000 -
- * 0x8000 which will trap, just as on, for example,
- * sparcv9.
- *
- * The unused space can be used if needed, but it adds a little more
- * complexity to the calculations.
- */
+#endif
 
 /*
  * Mask to get rid of the sign-extended part of addresses.
  */
 #define VA_SIGN_MASK		0x
 #define VA_SIGN_NEG(va)		((va) | VA_SIGN_MASK)
-/*
- * XXXfvdl this one's not right.
- */
+/* XXXfvdl this one's not right. */
 #define VA_SIGN_POS(va)		((va) & ~VA_SIGN_MASK)
 
 #ifndef XEN
@@ -154,7 +108,6 @@
  * data structures:
  * PTE_BASE: the base VA of the linear PTE mappings
  * PDP_BASE: the base VA of the recursive mapping of the PTD
- * PDP_PDE: the VA of the PDE that points back to the PDP
  */
 
 #ifndef XEN
@@ -169,8 +122,6 @@ extern pt_entry_t *pte_base;
 #define L3_BASE	((pd_entry_t *)((char *)L2_BASE + L4_SLOT_PTE * NBPD_L2))
 #define L4_BASE	((pd_entry_t *)((char *)L3_BASE + L4_SLOT_PTE * NBPD_L1))
 
-#define PDP_PDE		(L4_BASE + PDIR_SLOT_PTE)
-
 #define PDP_BASE	L4_BASE
 
 #define NKL4_MAX_ENTRIES	(unsigned long)64
@@ -189,11 +140,7 @@ extern pt_entry_t *pte_base;
 #define NKL4_START_ENTRIES	0
 #define NKL3_START_ENTRIES	0
 #define NKL2_START_ENTRIES	0
-#define NKL1_START_ENTRIES	0	/* XXX */
-
-#define NTOPLEVEL_PDES		(PAGE_SIZE / (sizeof (pd_entry_t)))
-
-#define NPDPG			(PAGE_SIZE / sizeof (pd_entry_t))
+#define NKL1_START_ENTRIES	0
 
 #define PTP_MASK_INITIALIZER	{ L1_FRAME, L2_FRAME, L3_FRAME, L4_FRAME }
 #define PTP_SHIFT_INITIALIZER	{ L1_SHIFT, L2_SHIFT, L3_SHIFT, L4_SHIFT }



CVS commit: src/sys/arch/amd64/include

2018-07-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jul 27 07:35:10 UTC 2018

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
Remove KERN_BASE, unused. It has always been wrong anyway, the value
should have been passed into VA_SIGN_NEG().


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.47 src/sys/arch/amd64/include/pmap.h:1.48
--- src/sys/arch/amd64/include/pmap.h:1.47	Wed Jul 25 11:47:07 2018
+++ src/sys/arch/amd64/include/pmap.h	Fri Jul 27 07:35:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.47 2018/07/25 11:47:07 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.48 2018/07/27 07:35:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -158,7 +158,6 @@
  */
 
 #define PTE_BASE	((pt_entry_t *)(L4_SLOT_PTE * NBPD_L4))
-#define KERN_BASE	((pt_entry_t *)(L4_SLOT_KERN * NBPD_L4))
 
 #define L1_BASE	PTE_BASE
 #define L2_BASE	((pd_entry_t *)((char *)L1_BASE + L4_SLOT_PTE * NBPD_L3))



CVS commit: src/sys/arch/amd64/include

2018-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul 13 14:11:02 UTC 2018

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Provide empty SVS_ENTER_NMI/SVS_LEAVE_NMI for kernels w/o options SVS


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.39 src/sys/arch/amd64/include/frameasm.h:1.40
--- src/sys/arch/amd64/include/frameasm.h:1.39	Thu Jul 12 19:48:16 2018
+++ src/sys/arch/amd64/include/frameasm.h	Fri Jul 13 14:11:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.39 2018/07/12 19:48:16 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.40 2018/07/13 14:11:02 martin Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -185,7 +185,9 @@
 
 #else
 #define SVS_ENTER	/* nothing */
+#define SVS_ENTER_NMI	/* nothing */
 #define SVS_LEAVE	/* nothing */
+#define SVS_LEAVE_NMI	/* nothing */
 #define SVS_ENTER_ALTSTACK	/* nothing */
 #define SVS_LEAVE_ALTSTACK	/* nothing */
 #endif



CVS commit: src/sys/arch/amd64/include

2018-03-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 16 12:21:50 UTC 2018

Modified Files:
src/sys/arch/amd64/include: cpu.h

Log Message:
Remove the prototypes for cpu_uarea_*, I removed these functions two
minutes ago.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/amd64/include/cpu.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/amd64/include/cpu.h
diff -u src/sys/arch/amd64/include/cpu.h:1.61 src/sys/arch/amd64/include/cpu.h:1.62
--- src/sys/arch/amd64/include/cpu.h:1.61	Sun Sep 17 09:41:35 2017
+++ src/sys/arch/amd64/include/cpu.h	Fri Mar 16 12:21:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.61 2017/09/17 09:41:35 maxv Exp $	*/
+/*	$NetBSD: cpu.h,v 1.62 2018/03/16 12:21:50 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -88,9 +88,6 @@ cpu_set_curpri(int pri)
 #define CLKF_INTR(frame)	(curcpu()->ci_idepth > 0)
 #define LWP_PC(l)		((l)->l_md.md_regs->tf_rip)
 
-void	*cpu_uarea_alloc(bool);
-bool	cpu_uarea_free(void *);
-
 #endif	/* _KERNEL */
 
 #else	/*	__x86_64__	*/



CVS commit: src/sys/arch/amd64/include

2018-03-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 16 08:21:56 UTC 2018

Modified Files:
src/sys/arch/amd64/include: param.h

Log Message:
Add one more page for the stack, to compensate for the fact that SVS's
stack switching mechanism consumes approximately one page.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/include/param.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/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.24 src/sys/arch/amd64/include/param.h:1.25
--- src/sys/arch/amd64/include/param.h:1.24	Mon Feb 19 13:02:47 2018
+++ src/sys/arch/amd64/include/param.h	Fri Mar 16 08:21:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.24 2018/02/19 13:02:47 sborrill Exp $	*/
+/*	$NetBSD: param.h,v 1.25 2018/03/16 08:21:56 maxv Exp $	*/
 
 #ifdef __x86_64__
 
@@ -58,9 +58,9 @@
 #define	SSIZE		1		/* initial stack size/NBPG */
 #define	SINCR		1		/* increment of stack/NBPG */
 #ifdef DIAGNOSTIC
-#define	UPAGES		4		/* pages of u-area (1 for redzone) */
+#define	UPAGES		5		/* pages of u-area (1 for redzone) */
 #else
-#define	UPAGES		3		/* pages of u-area */
+#define	UPAGES		4		/* pages of u-area */
 #endif
 #define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
 



CVS commit: src/sys/arch/amd64/include

2018-02-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Feb 25 13:14:27 UTC 2018

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Remove INTRENTRY_L, it's not used anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.36 src/sys/arch/amd64/include/frameasm.h:1.37
--- src/sys/arch/amd64/include/frameasm.h:1.36	Thu Feb 22 10:42:11 2018
+++ src/sys/arch/amd64/include/frameasm.h	Sun Feb 25 13:14:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.36 2018/02/22 10:42:11 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.37 2018/02/25 13:14:27 maxv Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -150,23 +150,19 @@
 #define SVS_LEAVE_ALTSTACK	/* nothing */
 #endif
 
-#define	INTRENTRY_L(kernel_trap, usertrap) \
+#define	INTRENTRY \
 	subq	$TF_REGSIZE,%rsp	; \
 	INTR_SAVE_GPRS			; \
 	cld; \
 	SMAP_ENABLE			; \
 	testb	$SEL_UPL,TF_CS(%rsp)	; \
-	je	kernel_trap		; \
-usertrap; \
+	je	98f			; \
 	SWAPGS; \
 	SVS_ENTER			; \
 	movw	%gs,TF_GS(%rsp)		; \
 	movw	%fs,TF_FS(%rsp)		; \
 	movw	%es,TF_ES(%rsp)		; \
-	movw	%ds,TF_DS(%rsp)	
-
-#define	INTRENTRY \
-	INTRENTRY_L(98f,)		; \
+	movw	%ds,TF_DS(%rsp)		; \
 98:
 
 #define INTRFASTEXIT \



CVS commit: src/sys/arch/amd64/include

2018-01-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 27 18:27:08 UTC 2018

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Put the default %cs value in INTR_RECURSE_HWFRAME. Pushing an immediate
costs less than reading the %cs register and pushing its value. This
value is not allowed to be != GSEL(GCODE_SEL,SEL_KPL) in all cases.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.33 src/sys/arch/amd64/include/frameasm.h:1.34
--- src/sys/arch/amd64/include/frameasm.h:1.33	Sat Jan 27 18:17:57 2018
+++ src/sys/arch/amd64/include/frameasm.h	Sat Jan 27 18:27:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.33 2018/01/27 18:17:57 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.34 2018/01/27 18:27:08 maxv Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -168,8 +168,7 @@ usertrap; \
 	pushq	%r11			; \
 	pushq	%r10			; \
 	pushfq; \
-	movl	%cs,%r11d		; \
-	pushq	%r11			; \
+	pushq	$GSEL(GCODE_SEL,SEL_KPL); \
 /* XEN: We must fixup CS, as even kernel mode runs at CPL 3 */ \
  	XEN_ONLY2(andb	$0xfc,(%rsp);)	  \
 	pushq	%r13			;



CVS commit: src/sys/arch/amd64/include

2018-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 20 14:39:21 UTC 2018

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Use .pushsection/.popsection, we will soon embed macros in several layers
of nested sections.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.29 src/sys/arch/amd64/include/frameasm.h:1.30
--- src/sys/arch/amd64/include/frameasm.h:1.29	Thu Jan 18 07:25:34 2018
+++ src/sys/arch/amd64/include/frameasm.h	Sat Jan 20 14:39:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.29 2018/01/18 07:25:34 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.30 2018/01/20 14:39:21 maxv Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -43,11 +43,11 @@
 
 #define HOTPATCH(name, size) \
 123:		; \
-	.section	.rodata.hotpatch, "a"	; \
+	.pushsection	.rodata.hotpatch, "a"	; \
 	.byte		name			; \
 	.byte		size			; \
 	.quad		123b			; \
-	.previous
+	.popsection
 
 #define SMAP_ENABLE \
 	HOTPATCH(HP_NAME_CLAC, 3)		; \



CVS commit: src/sys/arch/amd64/include

2017-12-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 31 07:23:09 UTC 2017

Modified Files:
src/sys/arch/amd64/include: pcb.h

Log Message:
gc unused


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amd64/include/pcb.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/amd64/include/pcb.h
diff -u src/sys/arch/amd64/include/pcb.h:1.27 src/sys/arch/amd64/include/pcb.h:1.28
--- src/sys/arch/amd64/include/pcb.h:1.27	Tue Oct 31 12:02:20 2017
+++ src/sys/arch/amd64/include/pcb.h	Sun Dec 31 07:23:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.27 2017/10/31 12:02:20 maxv Exp $	*/
+/*	$NetBSD: pcb.h,v 1.28 2017/12/31 07:23:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -79,8 +79,7 @@
 
 struct pcb {
 	int	  pcb_flags;
-#define	PCB_USER_LDT	0x01		/* has user-set LDT */
-#define	PCB_COMPAT32	0x02
+#define	PCB_COMPAT32	0x01
 	u_int	  pcb_cr0;		/* saved image of CR0 */
 	uint64_t pcb_rsp0;
 	uint64_t pcb_cr2;		/* page fault address (CR2) */



CVS commit: src/sys/arch/amd64/include

2017-11-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Nov 13 07:06:49 UTC 2017

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Remove superfluous word in comment. Noted by Geoff Wing.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.44 src/sys/arch/amd64/include/vmparam.h:1.45
--- src/sys/arch/amd64/include/vmparam.h:1.44	Sat Nov 11 20:23:49 2017
+++ src/sys/arch/amd64/include/vmparam.h	Mon Nov 13 07:06:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.44 2017/11/11 20:23:49 mrg Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.45 2017/11/13 07:06:49 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -57,7 +57,7 @@
 #define	PAGE_MASK	(PAGE_SIZE - 1)
 
 /*
- * Default pager_map of 16MB is awfully small.  There is have plenty
+ * Default pager_map of 16MB is awfully small.  There is plenty
  * of VA so use it.
  */
 #define	PAGER_MAP_DEFAULT_SIZE (512 * 1024 * 1024)



CVS commit: src/sys/arch/amd64/include

2017-11-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Nov 11 20:23:49 UTC 2017

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
bump PAGER_MAP_DEFAULT_SIZE to 512MB.  this should allow more
concurrent IOs to be possible, and i'm unable to see pager_map
contention any more.

other larger platforms should probably do this too.

ok chs@.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.43 src/sys/arch/amd64/include/vmparam.h:1.44
--- src/sys/arch/amd64/include/vmparam.h:1.43	Sat Jun 24 13:43:36 2017
+++ src/sys/arch/amd64/include/vmparam.h	Sat Nov 11 20:23:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.43 2017/06/24 13:43:36 joerg Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.44 2017/11/11 20:23:49 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -57,6 +57,12 @@
 #define	PAGE_MASK	(PAGE_SIZE - 1)
 
 /*
+ * Default pager_map of 16MB is awfully small.  There is have plenty
+ * of VA so use it.
+ */
+#define	PAGER_MAP_DEFAULT_SIZE (512 * 1024 * 1024)
+
+/*
  * USRSTACK is the top (end) of the user stack. Immediately above the
  * user stack resides the user structure, which is UPAGES long and contains
  * the kernel stack.



CVS commit: src/sys/arch/amd64/include

2017-11-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov  1 07:14:29 UTC 2017

Modified Files:
src/sys/arch/amd64/include: segments.h

Log Message:
Remove unused macros and LDT entries.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/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/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.31 src/sys/arch/amd64/include/segments.h:1.32
--- src/sys/arch/amd64/include/segments.h:1.31	Sun Oct 15 12:49:53 2017
+++ src/sys/arch/amd64/include/segments.h	Wed Nov  1 07:14:29 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: segments.h,v 1.31 2017/10/15 12:49:53 maxv Exp $	*/
+/*	$NetBSD: segments.h,v 1.32 2017/11/01 07:14:29 maxv Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
  *
@@ -34,7 +34,7 @@
  *	@(#)segments.h	7.1 (Berkeley) 5/9/91
  */
 
-/*-
+/*
  * Copyright (c) 1995, 1997
  *	Charles M. Hannum.  All rights reserved.
  * Copyright (c) 1989, 1990 William F. Jolitz
@@ -297,27 +297,6 @@ void cpu_fsgs_reload(struct lwp *, int, 
 #define SDT_MEMERC	30	/* memory execute read conforming */
 #define SDT_MEMERAC	31	/* memory execute read accessed conforming */
 
-/* is memory segment descriptor pointer ? */
-#define ISMEMSDP(s)	((s->d_type) >= SDT_MEMRO && \
-			 (s->d_type) <= SDT_MEMERAC)
-
-/* is 286 gate descriptor pointer ? */
-#define IS286GDP(s)	((s->d_type) >= SDT_SYS286CGT && \
-			 (s->d_type) < SDT_SYS286TGT)
-
-/* is 386 gate descriptor pointer ? */
-#define IS386GDP(s)	((s->d_type) >= SDT_SYS386CGT && \
-			 (s->d_type) < SDT_SYS386TGT)
-
-/* is gate descriptor pointer ? */
-#define ISGDP(s)	(IS286GDP(s) || IS386GDP(s))
-
-/* is segment descriptor pointer ? */
-#define ISSDP(s)	(ISMEMSDP(s) || !ISGDP(s))
-
-/* is system segment descriptor pointer ? */
-#define ISSYSSDP(s)	(!ISMEMSDP(s) && !ISGDP(s))
-
 /*
  * Segment Protection Exception code bits
  */
@@ -365,24 +344,18 @@ void cpu_fsgs_reload(struct lwp *, int, 
 #define GDT_ADDR_MEM(s,i)	\
 ((struct mem_segment_descriptor *)((s) + ((i) << 3)))
 #define GDT_ADDR_SYS(s,i)	\
-   ((struct sys_segment_descriptor *)((s) + (((i) << 4) + SYSSEL_START)))
+((struct sys_segment_descriptor *)((s) + (((i) << 4) + SYSSEL_START)))
 
 /*
  * Byte offsets in the Local Descriptor Table (LDT)
  * Strange order because of syscall/sysret insns
  */
-#define LSYS5CALLS_SEL	0	/* iBCS system call gate */
-/*			8	   second half */
-#define LSOL26CALLS_SEL	32	/* Solaris 2.6 system call gate */
-/*			40	   second half */
 #define LUCODE32_SEL	48	/* 32 bit user code descriptor */
 #define LUDATA_SEL	56	/* User data descriptor */
 #define LUCODE_SEL	64	/* User code descriptor */
 #define LUDATA32_SEL	72	/* 32 bit user data descriptor (needed?)*/
-#define LBSDICALLS_SEL	128	/* BSDI system call gate */
-/*			136	   second half */
 
-#define LDT_SIZE	144
+#define LDT_SIZE	80
 
 #define LSYSRETBASE_SEL	LUCODE32_SEL
 



CVS commit: src/sys/arch/amd64/include

2017-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 12 17:52:18 UTC 2017

Modified Files:
src/sys/arch/amd64/include: tss.h

Log Message:
rsp2, not 3


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/include/tss.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/amd64/include/tss.h
diff -u src/sys/arch/amd64/include/tss.h:1.5 src/sys/arch/amd64/include/tss.h:1.6
--- src/sys/arch/amd64/include/tss.h:1.5	Sun Oct 26 00:08:15 2008
+++ src/sys/arch/amd64/include/tss.h	Wed Jul 12 17:52:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tss.h,v 1.5 2008/10/26 00:08:15 mrg Exp $	*/
+/*	$NetBSD: tss.h,v 1.6 2017/07/12 17:52:18 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -50,7 +50,7 @@ struct x86_64_tss {
 	uint32_t	tss_reserved1;
 	uint64_t	tss_rsp0;
 	uint64_t	tss_rsp1;
-	uint64_t	tss_rsp3;
+	uint64_t	tss_rsp2;
 	uint32_t	tss_reserved2;
 	uint32_t	tss_reserved3;
 	uint64_t	tss_ist[7];



CVS commit: src/sys/arch/amd64/include

2017-06-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun 17 08:40:46 UTC 2017

Modified Files:
src/sys/arch/amd64/include: pmap.h vmparam.h

Log Message:
Increase the kernel heap size from 512GB to 32TB, in such a way that it
is able to map the maximum amount of ram supported twice (16TB x 2).


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/amd64/include/vmparam.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.39 src/sys/arch/amd64/include/pmap.h:1.40
--- src/sys/arch/amd64/include/pmap.h:1.39	Fri Nov 11 12:06:31 2016
+++ src/sys/arch/amd64/include/pmap.h	Sat Jun 17 08:40:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.39 2016/11/11 12:06:31 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.40 2017/06/17 08:40:46 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -169,7 +169,7 @@
 
 #define PDP_BASE	L4_BASE
 
-#define NKL4_MAX_ENTRIES	(unsigned long)1
+#define NKL4_MAX_ENTRIES	(unsigned long)64
 #define NKL3_MAX_ENTRIES	(unsigned long)(NKL4_MAX_ENTRIES * 512)
 #define NKL2_MAX_ENTRIES	(unsigned long)(NKL3_MAX_ENTRIES * 512)
 #define NKL1_MAX_ENTRIES	(unsigned long)(NKL2_MAX_ENTRIES * 512)

Index: src/sys/arch/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.40 src/sys/arch/amd64/include/vmparam.h:1.41
--- src/sys/arch/amd64/include/vmparam.h:1.40	Thu Jun 15 11:25:52 2017
+++ src/sys/arch/amd64/include/vmparam.h	Sat Jun 17 08:40:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.40 2017/06/15 11:25:52 maxv Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.41 2017/06/17 08:40:46 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -121,10 +121,10 @@
  */
 #ifndef XEN
 #define VM_MIN_KERNEL_ADDRESS	0x8000
-#define VM_MAX_KERNEL_ADDRESS	0x8080
+#define VM_MAX_KERNEL_ADDRESS	0xa000
 #else
 #define VM_MIN_KERNEL_ADDRESS	0xa000
-#define VM_MAX_KERNEL_ADDRESS	0xa080
+#define VM_MAX_KERNEL_ADDRESS	0xc000
 #endif
 
 /*



CVS commit: src/sys/arch/amd64/include

2017-06-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 15 11:25:52 UTC 2017

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Correct these values. They must be consistent with NKL4_MAX_ENTRIES,
otherwise the kernel thinks it has ~126TB of va while pmap knows it
has only 512GB.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.39 src/sys/arch/amd64/include/vmparam.h:1.40
--- src/sys/arch/amd64/include/vmparam.h:1.39	Sat Feb 11 15:05:15 2017
+++ src/sys/arch/amd64/include/vmparam.h	Thu Jun 15 11:25:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.39 2017/02/11 15:05:15 maxv Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.40 2017/06/15 11:25:52 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -108,22 +108,24 @@
  */
 #define	USRIOSIZE 	300
 
-/*
- * Mach derived constants
- */
-
-/* user/kernel map constants */
+/* User map constants */
 #define VM_MIN_ADDRESS		0
 #define VM_MAXUSER_ADDRESS	(0x7f80 - PAGE_SIZE)
+#define VM_MAXUSER_ADDRESS32	0xf000
 #define VM_MAX_ADDRESS		0x7fbfdfeff000
+
+/*
+ * Kernel map constants.
+ * MIN = VA_SIGN_NEG(L4_SLOT_KERN * NBPD_L4)
+ * MAX = MIN + NKL4_MAX_ENTRIES * NBPD_L4
+ */
 #ifndef XEN
 #define VM_MIN_KERNEL_ADDRESS	0x8000
-#else /* XEN */
+#define VM_MAX_KERNEL_ADDRESS	0x8080
+#else
 #define VM_MIN_KERNEL_ADDRESS	0xa000
+#define VM_MAX_KERNEL_ADDRESS	0xa080
 #endif
-#define VM_MAX_KERNEL_ADDRESS	0xfe80
-
-#define VM_MAXUSER_ADDRESS32	0xf000
 
 /*
  * The address to which unspecified mapping requests default



CVS commit: src/sys/arch/amd64/include

2017-02-05 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Feb  5 08:58:39 UTC 2017

Modified Files:
src/sys/arch/amd64/include: segments.h

Log Message:
Remove misleading comment; these macros should not be used if a user LDT
is active.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/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/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.28 src/sys/arch/amd64/include/segments.h:1.29
--- src/sys/arch/amd64/include/segments.h:1.28	Fri Sep  2 08:52:12 2016
+++ src/sys/arch/amd64/include/segments.h	Sun Feb  5 08:58:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.28 2016/09/02 08:52:12 maxv Exp $	*/
+/*	$NetBSD: segments.h,v 1.29 2017/02/05 08:58:39 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -386,9 +386,7 @@ void cpu_fsgs_reload(struct lwp *, int, 
 #define LSYSRETBASE_SEL	LUCODE32_SEL
 
 /*
- * Checks for valid user selectors. If USER_LDT ever gets implemented
- * for amd64, these must check the ldt length and SEL_UPL if a user
- * ldt is active.
+ * Checks for valid user selectors.
  */
 #define VALID_USER_DSEL32(s) \
 (((s) & 0x) == GSEL(GUDATA32_SEL, SEL_UPL) || \



CVS commit: src/sys/arch/amd64/include

2017-01-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jan 16 21:19:35 UTC 2017

Modified Files:
src/sys/arch/amd64/include: userret.h

Log Message:
Allow to mix single-step with hardware assisted watchpoints on amd64

This case needs new handling in trap recognition.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amd64/include/userret.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/amd64/include/userret.h
diff -u src/sys/arch/amd64/include/userret.h:1.10 src/sys/arch/amd64/include/userret.h:1.11
--- src/sys/arch/amd64/include/userret.h:1.10	Thu Dec 15 12:04:17 2016
+++ src/sys/arch/amd64/include/userret.h	Mon Jan 16 21:19:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: userret.h,v 1.10 2016/12/15 12:04:17 kamil Exp $	*/
+/*	$NetBSD: userret.h,v 1.11 2017/01/16 21:19:35 kamil Exp $	*/
 
 /*
  * XXXfvdl same as i386 counterpart, but should probably be independent.
@@ -83,12 +83,9 @@ userret(struct lwp *l)
 	mi_userret(l);
 
 	/*
-	 * Never mix debug registers with single step, while technically
-	 * possible on x86 CPUs, it adds unnecessary complications we do
-	 * not want to handle it.
+	 * Allow to mix debug registers with single step.
 	 */
-	if ((l->l_md.md_regs->tf_rflags & PSL_T) == 0 &&
-	l->l_md.md_flags & MDL_X86_HW_WATCHPOINTS)
+	if (l->l_md.md_flags & MDL_X86_HW_WATCHPOINTS)
 		set_x86_hw_watchpoints(l);
 	else
 		clear_x86_hw_watchpoints();



CVS commit: src/sys/arch/amd64/include

2016-11-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 11 12:06:31 UTC 2016

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
Remove useless values, and explain where some others come from


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.38 src/sys/arch/amd64/include/pmap.h:1.39
--- src/sys/arch/amd64/include/pmap.h:1.38	Fri Jul 22 14:08:33 2016
+++ src/sys/arch/amd64/include/pmap.h	Fri Nov 11 12:06:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.38 2016/07/22 14:08:33 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.39 2016/11/11 12:06:31 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -128,17 +128,6 @@
  */
 
 /*
- * The first generation of Hammer processors can use 48 bits of
- * virtual memory, and 40 bits of physical memory. This will be
- * more for later generations. These defines can be changed to
- * variable names containing the # of bits, extracted from an
- * extended cpuid instruction (variables are harder to use during
- * bootstrap, though)
- */
-#define VIRT_BITS	48
-#define PHYS_BITS	40
-
-/*
  * Mask to get rid of the sign-extended part of addresses.
  */
 #define VA_SIGN_MASK		0x
@@ -150,10 +139,10 @@
 
 #define L4_SLOT_PTE		255
 #ifndef XEN
-#define L4_SLOT_KERN		256
+#define L4_SLOT_KERN		256 /* pl4_i(VM_MIN_KERNEL_ADDRESS) */
 #else
 /* Xen use slots 256-272, let's move farther */
-#define L4_SLOT_KERN		320
+#define L4_SLOT_KERN		320 /* pl4_i(VM_MIN_KERNEL_ADDRESS) */
 #endif
 #define L4_SLOT_KERNBASE	511 /* pl4_i(KERNBASE) */
 



CVS commit: src/sys/arch/amd64/include

2016-09-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep  2 08:52:13 UTC 2016

Modified Files:
src/sys/arch/amd64/include: segments.h

Log Message:
Give the structure sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amd64/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/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.27 src/sys/arch/amd64/include/segments.h:1.28
--- src/sys/arch/amd64/include/segments.h:1.27	Sat Aug 27 14:19:47 2016
+++ src/sys/arch/amd64/include/segments.h	Fri Sep  2 08:52:12 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.27 2016/08/27 14:19:47 maxv Exp $	*/
+/*	$NetBSD: segments.h,v 1.28 2016/09/02 08:52:12 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -147,7 +147,7 @@
  */
 
 /*
- * Below is used for TSS and LDT.
+ * System segment descriptor (16 bytes): used for TSS and LDT.
  */
 struct sys_segment_descriptor {
 	uint64_t sd_lolimit:16;	/* segment extent (lsb) */
@@ -165,7 +165,7 @@ struct sys_segment_descriptor {
 } __packed;
 
 /*
- * Below is used for cs, ds, etc.
+ * Memory segment descriptor (8 bytes): used for cs, ds, etc.
  */
 struct mem_segment_descriptor {
 	unsigned sd_lolimit:16;	/* segment extent (lsb) */
@@ -192,7 +192,7 @@ struct common_segment_descriptor {
 } __packed;
 
 /*
- * Gate descriptors (e.g. indirect descriptors)
+ * Gate descriptors (16 bytes).
  */
 struct gate_descriptor {
 	uint64_t gd_looffset:16;/* gate offset (lsb) */
@@ -209,7 +209,8 @@ struct gate_descriptor {
 } __packed;
 
 /*
- * Generic descriptor
+ * Generic descriptor (8 bytes). Note: it does not include system segment
+ * descriptors and gate descriptors, since these are 16-byte-long.
  */
 union descriptor {
 	struct mem_segment_descriptor sd;
@@ -218,7 +219,7 @@ union descriptor {
 } __packed;
 
 /*
- * region descriptors, used to load gdt/idt tables before segments yet exist.
+ * Region descriptors, used to load gdt/idt tables before segments yet exist.
  */
 struct region_descriptor {
 	uint16_t rd_limit;	/* segment extent */
@@ -226,9 +227,6 @@ struct region_descriptor {
 } __packed;
 
 #ifdef _KERNEL
-#if 0
-extern struct sys_segment_descriptor *ldt;
-#endif
 #ifdef XEN
 extern struct trap_info *idt;
 #else



CVS commit: src/sys/arch/amd64/include

2016-08-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Aug 21 11:48:59 UTC 2016

Modified Files:
src/sys/arch/amd64/include: segments.h

Log Message:
KNF, and typo.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/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/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.24 src/sys/arch/amd64/include/segments.h:1.25
--- src/sys/arch/amd64/include/segments.h:1.24	Mon Jan  7 17:03:06 2013
+++ src/sys/arch/amd64/include/segments.h	Sun Aug 21 11:48:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.24 2013/01/07 17:03:06 chs Exp $	*/
+/*	$NetBSD: segments.h,v 1.25 2016/08/21 11:48:59 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -95,17 +95,17 @@
  * Selectors
  */
 
-#define	ISPL(s)		((s) & SEL_RPL)	/* what is the priority level of a selector */
+#define ISPL(s)		((s) & SEL_RPL)	/* what is the priority level of a selector */
 #ifdef XEN
-#define	SEL_KPL		3		/* kernel privilege level */	
-#define	SEL_XPL		0		/* Xen Hypervisor privilege level */	
+#define SEL_KPL		3		/* kernel privilege level */
+#define SEL_XPL		0		/* Xen Hypervisor privilege level */
 #else
-#define	SEL_KPL		0		/* kernel privilege level */	
+#define SEL_KPL		0		/* kernel privilege level */
 #endif
-#define	SEL_UPL		3		/* user privilege level */	
-#define	SEL_RPL		3		/* requester's privilege level mask */
-#define	ISLDT(s)	((s) & SEL_LDT)	/* is it local or global */
-#define	SEL_LDT		4		/* local descriptor table */	
+#define SEL_UPL		3		/* user privilege level */
+#define SEL_RPL		3		/* requester's privilege level mask */
+#define ISLDT(s)	((s) & SEL_LDT)	/* is it local or global */
+#define SEL_LDT		4		/* local descriptor table */
 
 /* Dynamically allocated TSSs and LDTs start (byte offset) */
 #define SYSSEL_START	(NGDT_MEM << 3)
@@ -120,24 +120,24 @@
  * The rest is 16-byte descriptors for TSS and LDT.
  */
 
-#define	IDXSEL(s)	(((s) >> 3) & 0x1fff)
+#define IDXSEL(s)	(((s) >> 3) & 0x1fff)
 #define IDXDYNSEL(s)	s) & ~SEL_RPL) - DYNSEL_START) >> 4)
 
-#define	GSEL(s,r)	(((s) << 3) | r)
-#define	GSYSSEL(s,r)	s) << 4) + SYSSEL_START) | r)
+#define GSEL(s,r)	(((s) << 3) | r)
+#define GSYSSEL(s,r)	s) << 4) + SYSSEL_START) | r)
 #define GDYNSEL(s,r)	s) << 4) + DYNSEL_START) | r | SEL_KPL)
 
 #define LSEL(s,r)	((s) | r | SEL_LDT)
 
-#define	USERMODE(c, f)		(ISPL(c) == SEL_UPL)
+#define USERMODE(c, f)		(ISPL(c) == SEL_UPL)
 #ifdef XEN
 /*
  * As KPL == UPL, Xen emulate interrupt in kernel context by pushing
  * a fake CS with XPL privilege
  */
-#define	KERNELMODE(c, f)	(ISPL(c) == SEL_XPL)
+#define KERNELMODE(c, f)	(ISPL(c) == SEL_XPL)
 #else
-#define	KERNELMODE(c, f)	(ISPL(c) == SEL_KPL)
+#define KERNELMODE(c, f)	(ISPL(c) == SEL_KPL)
 #endif
 
 #ifndef _LOCORE
@@ -150,35 +150,35 @@
  * Below is used for TSS and LDT.
  */
 struct sys_segment_descriptor {
-/*BITFIELDTYPE*/ uint64_t sd_lolimit:16;/* segment extent (lsb) */
-/*BITFIELDTYPE*/ uint64_t sd_lobase:24;/* segment base address (lsb) */
-/*BITFIELDTYPE*/ uint64_t sd_type:5;	/* segment type */
-/*BITFIELDTYPE*/ uint64_t sd_dpl:2;	/* segment descriptor priority level */
-/*BITFIELDTYPE*/ uint64_t sd_p:1;	/* segment descriptor present */
-/*BITFIELDTYPE*/ uint64_t sd_hilimit:4;/* segment extent (msb) */
-/*BITFIELDTYPE*/ uint64_t sd_xx1:3;	/* avl, long and def32 (not used) */
-/*BITFIELDTYPE*/ uint64_t sd_gran:1;	/* limit granularity (byte/page) */
-/*BITFIELDTYPE*/ uint64_t sd_hibase:40;/* segment base address (msb) */
-/*BITFIELDTYPE*/ uint64_t sd_xx2:8;	/* reserved */
-/*BITFIELDTYPE*/ uint64_t sd_zero:5;	/* must be zero */
-/*BITFIELDTYPE*/ uint64_t sd_xx3:19;	/* reserved */
+	uint64_t sd_lolimit:16;	/* segment extent (lsb) */
+	uint64_t sd_lobase:24;	/* segment base address (lsb) */
+	uint64_t sd_type:5;	/* segment type */
+	uint64_t sd_dpl:2;	/* segment descriptor priority level */
+	uint64_t sd_p:1;	/* segment descriptor present */
+	uint64_t sd_hilimit:4;	/* segment extent (msb) */
+	uint64_t sd_xx1:3;	/* avl, long and def32 (not used) */
+	uint64_t sd_gran:1;	/* limit granularity (byte/page) */
+	uint64_t sd_hibase:40;	/* segment base address (msb) */
+	uint64_t sd_xx2:8;	/* reserved */
+	uint64_t sd_zero:5;	/* must be zero */
+	uint64_t sd_xx3:19;	/* reserved */
 } __packed;
 
 /*
  * Below is used for cs, ds, etc.
  */
 struct mem_segment_descriptor {
-	unsigned sd_lolimit:16; /* segment extent (lsb) */
-	unsigned sd_lobase:24;  /* segment base address (lsb) */
-	unsigned sd_type:5; /* segment type */
-	unsigned sd_dpl:2;  /* segment descriptor priority level */
-	unsigned sd_p:1;/* segment descriptor present */
-	unsigned sd_hilimit:4;  /* segment extent (msb) */
-	unsigned sd_avl:1;		/* available */
-	unsigned sd_long:1;		/* 

CVS commit: src/sys/arch/amd64/include

2016-08-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Aug 11 15:45:39 UTC 2016

Modified Files:
src/sys/arch/amd64/include: i82093reg.h

Log Message:
Use absolute addressing mode, just like the rest.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/include/i82093reg.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/amd64/include/i82093reg.h
diff -u src/sys/arch/amd64/include/i82093reg.h:1.5 src/sys/arch/amd64/include/i82093reg.h:1.6
--- src/sys/arch/amd64/include/i82093reg.h:1.5	Thu Jul  3 14:02:25 2008
+++ src/sys/arch/amd64/include/i82093reg.h	Thu Aug 11 15:45:39 2016
@@ -1,4 +1,4 @@
-/*	 $NetBSD: i82093reg.h,v 1.5 2008/07/03 14:02:25 drochner Exp $ */
+/*	 $NetBSD: i82093reg.h,v 1.6 2016/08/11 15:45:39 maxv Exp $ */
 
 #include 
 
@@ -9,7 +9,7 @@
 #endif
 
 #define ioapic_asm_ack(num) \
-	movl	$0,(_C_LABEL(local_apic)+LAPIC_EOI)(%rip)
+	movl	$0,_C_LABEL(local_apic)+LAPIC_EOI
 
 #ifdef MULTIPROCESSOR
 



CVS commit: src/sys/arch/amd64/include

2016-05-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 21 07:00:18 UTC 2016

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
Explain where this value comes from.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.36 src/sys/arch/amd64/include/pmap.h:1.37
--- src/sys/arch/amd64/include/pmap.h:1.36	Sat May 14 12:48:31 2016
+++ src/sys/arch/amd64/include/pmap.h	Sat May 21 07:00:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.36 2016/05/14 12:48:31 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.37 2016/05/21 07:00:18 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -155,7 +155,7 @@
 /* Xen use slots 256-272, let's move farther */
 #define L4_SLOT_KERN		320
 #endif
-#define L4_SLOT_KERNBASE	511
+#define L4_SLOT_KERNBASE	511 /* pl4_i(KERNBASE) */
 
 #define PDIR_SLOT_KERN	L4_SLOT_KERN
 #define PDIR_SLOT_PTE	L4_SLOT_PTE



CVS commit: src/sys/arch/amd64/include

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 12:48:31 UTC 2016

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
KNF so it appears aligned on NXR, and fix a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.35 src/sys/arch/amd64/include/pmap.h:1.36
--- src/sys/arch/amd64/include/pmap.h:1.35	Fri Jan  9 01:08:49 2015
+++ src/sys/arch/amd64/include/pmap.h	Sat May 14 12:48:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.35 2015/01/09 01:08:49 riastradh Exp $	*/
+/*	$NetBSD: pmap.h,v 1.36 2016/05/14 12:48:31 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -161,21 +161,20 @@
 #define PDIR_SLOT_PTE	L4_SLOT_PTE
 
 /*
- * the following defines give the virtual addresses of various MMU
+ * The following defines give the virtual addresses of various MMU
  * data structures:
  * PTE_BASE: the base VA of the linear PTE mappings
- * PTD_BASE: the base VA of the recursive mapping of the PTD
+ * PDP_BASE: the base VA of the recursive mapping of the PTD
  * PDP_PDE: the VA of the PDE that points back to the PDP
- *
  */
 
-#define PTE_BASE  ((pt_entry_t *) (L4_SLOT_PTE * NBPD_L4))
-#define KERN_BASE  ((pt_entry_t *) (L4_SLOT_KERN * NBPD_L4))
+#define PTE_BASE	((pt_entry_t *)(L4_SLOT_PTE * NBPD_L4))
+#define KERN_BASE	((pt_entry_t *)(L4_SLOT_KERN * NBPD_L4))
 
-#define L1_BASE		PTE_BASE
-#define L2_BASE ((pd_entry_t *)((char *)L1_BASE + L4_SLOT_PTE * NBPD_L3))
-#define L3_BASE ((pd_entry_t *)((char *)L2_BASE + L4_SLOT_PTE * NBPD_L2))
-#define L4_BASE ((pd_entry_t *)((char *)L3_BASE + L4_SLOT_PTE * NBPD_L1))
+#define L1_BASE	PTE_BASE
+#define L2_BASE	((pd_entry_t *)((char *)L1_BASE + L4_SLOT_PTE * NBPD_L3))
+#define L3_BASE	((pd_entry_t *)((char *)L2_BASE + L4_SLOT_PTE * NBPD_L2))
+#define L4_BASE	((pd_entry_t *)((char *)L3_BASE + L4_SLOT_PTE * NBPD_L1))
 
 #define PDP_PDE		(L4_BASE + PDIR_SLOT_PTE)
 
@@ -307,7 +306,7 @@ pmap_pte_setbits(volatile pt_entry_t *pt
 
 static __inline void
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
-{	
+{
 	mutex_enter(_lock);
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
 	(*pte) & ~bits);



CVS commit: src/sys/arch/amd64/include

2016-05-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May 13 11:17:20 UTC 2016

Modified Files:
src/sys/arch/amd64/include: pte.h

Log Message:
KNF, so it appears aligned on NXR.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amd64/include/pte.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/amd64/include/pte.h
diff -u src/sys/arch/amd64/include/pte.h:1.8 src/sys/arch/amd64/include/pte.h:1.9
--- src/sys/arch/amd64/include/pte.h:1.8	Sat Jul 24 17:43:47 2010
+++ src/sys/arch/amd64/include/pte.h	Fri May 13 11:17:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pte.h,v 1.8 2010/07/24 17:43:47 njoly Exp $	*/
+/*	$NetBSD: pte.h,v 1.9 2016/05/13 11:17:20 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  * amd64 MMU hardware structure:
  *
  * the (first generation) amd64 MMU is a 4-level MMU which maps 2^48 bytes
- * of  virtual memory. The  pagesize we use is 4K (4096 [0x1000] bytes), 
+ * of virtual memory. The pagesize we use is 4K (4096 [0x1000] bytes),
  * although 2M and 4M can be used as well. The indexes in the levels
  * are 9 bits wide (512 64bit entries per level), dividing the bits
  * 9-9-9-9-12.
@@ -65,28 +65,24 @@
  */
 
 #if !defined(_LOCORE)
-
 /*
- * here we define the data types for PDEs and PTEs
+ * Here we define the data types for PDEs and PTEs.
  */
-
 typedef uint64_t pd_entry_t;		/* PDE */
 typedef uint64_t pt_entry_t;		/* PTE */
-
 #endif
 
 /*
- * now we define various for playing with virtual addresses
+ * Now we define various constants for playing with virtual addresses.
  */
-
 #define L1_SHIFT	12
-#define	L2_SHIFT	21
-#define	L3_SHIFT	30
-#define	L4_SHIFT	39
-#define	NBPD_L1		(1UL << L1_SHIFT) /* # bytes mapped by L1 ent (4K) */
-#define	NBPD_L2		(1UL << L2_SHIFT) /* # bytes mapped by L2 ent (2MB) */
-#define	NBPD_L3		(1UL << L3_SHIFT) /* # bytes mapped by L3 ent (1G) */
-#define	NBPD_L4		(1UL << L4_SHIFT) /* # bytes mapped by L4 ent (512G) */
+#define L2_SHIFT	21
+#define L3_SHIFT	30
+#define L4_SHIFT	39
+#define NBPD_L1		(1UL << L1_SHIFT) /* # bytes mapped by L1 ent (4K) */
+#define NBPD_L2		(1UL << L2_SHIFT) /* # bytes mapped by L2 ent (2MB) */
+#define NBPD_L3		(1UL << L3_SHIFT) /* # bytes mapped by L3 ent (1G) */
+#define NBPD_L4		(1UL << L4_SHIFT) /* # bytes mapped by L4 ent (512G) */
 
 #define L4_MASK		0xff80
 #define L3_MASK		0x007fc000
@@ -101,16 +97,15 @@ typedef uint64_t pt_entry_t;		/* PTE */
 /*
  * PDE/PTE bits. These are no different from their i386 counterparts.
  */
-
-#define	PG_V		0x0001	/* valid */
-#define	PG_RO		0x	/* read-only */
-#define	PG_RW		0x0002	/* read-write */
-#define	PG_u		0x0004	/* user accessible */
-#define	PG_PROT		0x0006
+#define PG_V		0x0001	/* valid */
+#define PG_RO		0x	/* read-only */
+#define PG_RW		0x0002	/* read-write */
+#define PG_u		0x0004	/* user accessible */
+#define PG_PROT		0x0006
 #define PG_WT		0x0008	/* write-through */
-#define	PG_N		0x0010	/* non-cacheable */
-#define	PG_U		0x0020	/* used */
-#define	PG_M		0x0040	/* modified */
+#define PG_N		0x0010	/* non-cacheable */
+#define PG_U		0x0020	/* used */
+#define PG_M		0x0040	/* modified */
 #define PG_PAT		0x0080	/* PAT (on pte) */
 #define PG_PS		0x0080	/* 2MB page size (on pde) */
 #define PG_G		0x0100	/* not flushed */
@@ -118,19 +113,18 @@ typedef uint64_t pt_entry_t;		/* PTE */
 #define PG_AVAIL2	0x0400
 #define PG_AVAIL3	0x0800
 #define PG_LGPAT	0x1000	/* PAT on large pages */
-#define	PG_FRAME	0x000ff000
-#define	PG_NX		0x8000
+#define PG_FRAME	0x000ff000
+#define PG_NX		0x8000
 
 #define PG_2MFRAME	0x000fffe0	/* large (2M) page frame mask */
 #define PG_1GFRAME	0x000fc000	/* large (1G) page frame mask */
-#define	PG_LGFRAME	PG_2MFRAME
+#define PG_LGFRAME	PG_2MFRAME
 
 /*
- * short forms of protection codes
+ * Short forms of protection codes.
  */
-
-#define	PG_KR		0x	/* kernel read-only */
-#define	PG_KW		0x0002	/* kernel read-write */
+#define PG_KR		0x	/* kernel read-only */
+#define PG_KW		0x0002	/* kernel read-write */
 
 #include 
 



CVS commit: src/sys/arch/amd64/include

2016-04-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Apr 11 14:15:30 UTC 2016

Modified Files:
src/sys/arch/amd64/include: profile.h

Log Message:
x86_lfence() calls mcount(), so inline lfence instructions in mcount
helper functions


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/amd64/include/profile.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/amd64/include/profile.h
diff -u src/sys/arch/amd64/include/profile.h:1.17 src/sys/arch/amd64/include/profile.h:1.18
--- src/sys/arch/amd64/include/profile.h:1.17	Sun Jan 10 09:04:32 2016
+++ src/sys/arch/amd64/include/profile.h	Mon Apr 11 14:15:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.h,v 1.17 2016/01/10 09:04:32 ryo Exp $	*/
+/*	$NetBSD: profile.h,v 1.18 2016/04/11 14:15:30 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -83,8 +83,9 @@ __asm(" .globl __mcount		\n"			\
 static inline void
 mcount_disable_intr(void)
 {
-	/* works because __cli is a macro */
-	__cli();
+	/* should be __cli() but this calls x86_lfence() which calls mcount */
+	curcpu()->ci_vcpu->evtchn_upcall_mask = 1;
+	__asm volatile("lfence" ::: "memory"); /* x86_lfence() */
 }
 
 static inline u_long
@@ -97,7 +98,8 @@ static inline void
 mcount_write_psl(u_long psl)
 {
 	curcpu()->ci_vcpu->evtchn_upcall_mask = psl;
-	x86_lfence();
+	/* can't call x86_lfence because it calls mcount() */
+	__asm volatile("lfence" ::: "memory"); /* x86_lfence() */
 	/* XXX can't call hypervisor_force_callback() because we're in mcount*/ 
 }
 



CVS commit: src/sys/arch/amd64/include

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  2 20:13:59 UTC 2016

Modified Files:
src/sys/arch/amd64/include: elf_machdep.h

Log Message:
Add more relocation constants


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/include/elf_machdep.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/amd64/include/elf_machdep.h
diff -u src/sys/arch/amd64/include/elf_machdep.h:1.4 src/sys/arch/amd64/include/elf_machdep.h:1.5
--- src/sys/arch/amd64/include/elf_machdep.h:1.4	Thu Mar 18 04:28:33 2010
+++ src/sys/arch/amd64/include/elf_machdep.h	Tue Feb  2 15:13:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_machdep.h,v 1.4 2010/03/18 08:28:33 cegger Exp $	*/
+/*	$NetBSD: elf_machdep.h,v 1.5 2016/02/02 20:13:59 christos Exp $	*/
 
 #if !defined __i386__
 
@@ -46,6 +46,26 @@
 #define R_X86_64_GOTTPOFF	22
 #define R_X86_64_TPOFF32	23
 
+#define R_X86_64_PC64		24
+#define R_X86_64_GOTOFF64	25
+#define R_X86_64_GOTPC32	26
+#define R_X86_64_GOT64		27
+#define R_X86_64_GOTPCREL64	28
+#define R_X86_64_GOTPC64	29
+#define R_X86_64_GOTPLT64	30
+#define R_X86_64_PLTOFF64	31
+#define R_X86_64_SIZE32		32
+#define R_X86_64_SIZE64		33
+#define R_X86_64_GOTPC32_TLSDESC 34
+#define R_X86_64_TLSDESC_CALL	35
+#define R_X86_64_TLSDESC	36
+#define R_X86_64_IRELATIVE	37
+#define R_X86_64_RELATIVE64	38
+#define R_X86_64_PC32_BND	39
+#define R_X86_64_PLT32_BND	40
+#define R_X86_64_GOTPCRELX	41
+#define R_X86_64_REX_GOTPCRELX	42
+
 #define	R_TYPE(name)	__CONCAT(R_X86_64_,name)
 
 #else	/*	!__i386__	*/



CVS commit: src/sys/arch/amd64/include

2015-09-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 17 14:39:35 UTC 2015

Modified Files:
src/sys/arch/amd64/include: ptrace.h

Log Message:
fix 32 bit build.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/include/ptrace.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/amd64/include/ptrace.h
diff -u src/sys/arch/amd64/include/ptrace.h:1.4 src/sys/arch/amd64/include/ptrace.h:1.5
--- src/sys/arch/amd64/include/ptrace.h:1.4	Tue Sep 15 11:49:02 2015
+++ src/sys/arch/amd64/include/ptrace.h	Thu Sep 17 10:39:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.4 2015/09/15 15:49:02 christos Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.5 2015/09/17 14:39:35 christos Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -29,7 +29,10 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+#ifndef _AMD64_PTRACE_H_
+#define _AMD64_PTRACE_H_
 
+#ifdef __x86_64__
 /*
  * i386-dependent ptrace definitions
  */
@@ -63,5 +66,13 @@
 
 #define process_reg32		struct reg32
 #define process_fpreg32		struct fpreg32
-#endif
-#endif
+#endif	/* COMPAT_NETBSD32 */
+#endif	/* _KERNEL_OPT */
+
+#else	/* !__x86_64__ */
+
+#include 
+
+#endif	/* __x86_64__ */
+
+#endif	/* _AMD64_PTRACE_H_ */



CVS commit: src/sys/arch/amd64/include

2015-06-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 10 23:16:27 UTC 2015

Modified Files:
src/sys/arch/amd64/include: sljit_machdep.h

Log Message:
Include i386/sljit_machdep.h for i386 compat build.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/include/sljit_machdep.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/amd64/include/sljit_machdep.h
diff -u src/sys/arch/amd64/include/sljit_machdep.h:1.1 src/sys/arch/amd64/include/sljit_machdep.h:1.2
--- src/sys/arch/amd64/include/sljit_machdep.h:1.1	Wed Jul 23 18:19:43 2014
+++ src/sys/arch/amd64/include/sljit_machdep.h	Wed Jun 10 23:16:27 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sljit_machdep.h,v 1.1 2014/07/23 18:19:43 alnsn Exp $	*/
+/*	$NetBSD: sljit_machdep.h,v 1.2 2015/06/10 23:16:27 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2012-2013 The NetBSD Foundation, Inc.
@@ -29,8 +29,16 @@
 #ifndef _AMD64_SLJITARCH_H
 #define _AMD64_SLJITARCH_H
 
+#if !defined __i386__
+
 #define SLJIT_CONFIG_X86_64 1
 
 #define SLJIT_CACHE_FLUSH(from, to)
 
+#else	/*	!__i386__	*/
+
+#include i386/sljit_machdep.h
+
+#endif
+
 #endif



CVS commit: src/sys/arch/amd64/include

2015-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 26 12:44:08 UTC 2015

Modified Files:
src/sys/arch/amd64/include: frame_regs.h

Log Message:
PR/49859: Kamil Rytarowski: Invalid path to amd64nbsd-tdep.c in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/include/frame_regs.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/amd64/include/frame_regs.h
diff -u src/sys/arch/amd64/include/frame_regs.h:1.5 src/sys/arch/amd64/include/frame_regs.h:1.6
--- src/sys/arch/amd64/include/frame_regs.h:1.5	Wed Nov 26 23:41:55 2014
+++ src/sys/arch/amd64/include/frame_regs.h	Sun Apr 26 08:44:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame_regs.h,v 1.5 2014/11/27 04:41:55 uebayasi Exp $	*/
+/*	$NetBSD: frame_regs.h,v 1.6 2015/04/26 12:44:08 christos Exp $	*/
 
 #ifndef _AMD64_FRAME_REGS_H_
 #define _AMD64_FRAME_REGS_H_
@@ -11,8 +11,8 @@
  * has been changed to improve syscall efficiency.
  *
  * Notes:
- * 1) gdb (src/gnu/dist/gdb6/gdb/amd64nbsd-tdep.c) has a lookup table that
- *assumes the __greg_t ordering.
+ * 1) gdb (src/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c) has a lookup
+ *table that assumes the __greg_t ordering.
  * 2) src/lib/libc/arch/x86_64/gen/makecontext.c assumes that the first
  *6 entries in the __greg_t array match the registers used to pass
  *function arguments.



CVS commit: src/sys/arch/amd64/include

2015-04-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Apr 26 18:49:39 UTC 2015

Modified Files:
src/sys/arch/amd64/include: frame_regs.h

Log Message:
remove any pathname for gdb's amd64nbsd-tdep.c, so it doesn't really
matter where it lives.  PR#49859.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/include/frame_regs.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/amd64/include/frame_regs.h
diff -u src/sys/arch/amd64/include/frame_regs.h:1.6 src/sys/arch/amd64/include/frame_regs.h:1.7
--- src/sys/arch/amd64/include/frame_regs.h:1.6	Sun Apr 26 12:44:08 2015
+++ src/sys/arch/amd64/include/frame_regs.h	Sun Apr 26 18:49:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame_regs.h,v 1.6 2015/04/26 12:44:08 christos Exp $	*/
+/*	$NetBSD: frame_regs.h,v 1.7 2015/04/26 18:49:39 mrg Exp $	*/
 
 #ifndef _AMD64_FRAME_REGS_H_
 #define _AMD64_FRAME_REGS_H_
@@ -11,8 +11,8 @@
  * has been changed to improve syscall efficiency.
  *
  * Notes:
- * 1) gdb (src/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c) has a lookup
- *table that assumes the __greg_t ordering.
+ * 1) gdb (amd64nbsd-tdep.c) has a lookup table that assumes the __greg_t 
+ *ordering.
  * 2) src/lib/libc/arch/x86_64/gen/makecontext.c assumes that the first
  *6 entries in the __greg_t array match the registers used to pass
  *function arguments.



CVS commit: src/sys/arch/amd64/include

2015-01-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan  9 01:08:49 UTC 2015

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
Bump amd64 module map size to 32 MB.

For lack of anything better to do, after no progress in discussion on
the matter:

https://mail-index.netbsd.org/port-amd64/2014/08/22/msg002108.html

Needed in order to load the (solaris module needed by) dtrace module.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.34 src/sys/arch/amd64/include/pmap.h:1.35
--- src/sys/arch/amd64/include/pmap.h:1.34	Sat Jun 30 22:50:36 2012
+++ src/sys/arch/amd64/include/pmap.h	Fri Jan  9 01:08:49 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.34 2012/06/30 22:50:36 jym Exp $	*/
+/*	$NetBSD: pmap.h,v 1.35 2015/01/09 01:08:49 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -188,7 +188,7 @@
 
 #define NKL4_KIMG_ENTRIES	1
 #define NKL3_KIMG_ENTRIES	1
-#define NKL2_KIMG_ENTRIES	16
+#define NKL2_KIMG_ENTRIES	32
 
 /*
  * Since kva space is below the kernel in its entirety, we start off



CVS commit: src/sys/arch/amd64/include

2014-11-26 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 27 04:41:55 UTC 2014

Modified Files:
src/sys/arch/amd64/include: frame_regs.h

Log Message:
Improve grep'ability..


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/include/frame_regs.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/amd64/include/frame_regs.h
diff -u src/sys/arch/amd64/include/frame_regs.h:1.4 src/sys/arch/amd64/include/frame_regs.h:1.5
--- src/sys/arch/amd64/include/frame_regs.h:1.4	Wed Feb  6 22:02:17 2008
+++ src/sys/arch/amd64/include/frame_regs.h	Thu Nov 27 04:41:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame_regs.h,v 1.4 2008/02/06 22:02:17 dsl Exp $	*/
+/*	$NetBSD: frame_regs.h,v 1.5 2014/11/27 04:41:55 uebayasi Exp $	*/
 
 #ifndef _AMD64_FRAME_REGS_H_
 #define _AMD64_FRAME_REGS_H_
@@ -29,38 +29,40 @@
  * than 6 args (SYS_MAXSYSARGS is 8, + 2 entries for SYS___SYSCALL).
  */
 #define _FRAME_REG(greg, freg) 	\
-	greg(rdi, RDI, 0)	\
-	greg(rsi, RSI, 1)	\
-	greg(rdx, RDX, 2)	\
-	greg(r10, R10, 6)	\
-	greg(r8,  R8,  4)	\
-	greg(r9,  R9,  5)	\
-	freg(arg6, @,  @)	/* syscall arg from stack */ \
-	freg(arg7, @,  @)	/* syscall arg from stack */ \
-	freg(arg8, @,  @)	/* syscall arg from stack */ \
-	freg(arg9, @,  @)	/* syscall arg from stack */ \
-	greg(rcx, RCX, 3)	\
-	greg(r11, R11, 7)	\
-	greg(r12, R12, 8)	\
-	greg(r13, R13, 9)	\
-	greg(r14, R14, 10)	\
-	greg(r15, R15, 11)	\
-	greg(rbp, RBP, 12)	\
-	greg(rbx, RBX, 13)	\
-	greg(rax, RAX, 14)	\
-	greg(gs,  GS,  15)	\
-	greg(fs,  FS,  16)	\
-	greg(es,  ES,  17)	\
-	greg(ds,  DS,  18)	\
-	greg(trapno, TRAPNO, 19)	\
-	/* below portion defined in hardware */ \
-	greg(err, ERR, 20)	/* Dummy inserted if not defined */ \
-	greg(rip, RIP, 21)	\
-	greg(cs,  CS,  22)	\
-	greg(rflags, RFLAGS, 23)	\
+	greg(rdi, RDI, 0)	/* tf_rdi */ \
+	greg(rsi, RSI, 1)	/* tf_rsi */ \
+	greg(rdx, RDX, 2)	/* tf_rdx */ \
+	greg(r10, R10, 6)	/* tf_r10 */ \
+	greg(r8,  R8,  4)	/* tf_r8 */ \
+	greg(r9,  R9,  5)	/* tf_r9 */ \
+	freg(arg6, @,  @)	/* tf_arg6: syscall arg from stack */ \
+	freg(arg7, @,  @)	/* tf_arg7: syscall arg from stack */ \
+	freg(arg8, @,  @)	/* tf_arg8: syscall arg from stack */ \
+	freg(arg9, @,  @)	/* tf_arg9: syscall arg from stack */ \
+	greg(rcx, RCX, 3)	/* tf_rcx */ \
+	greg(r11, R11, 7)	/* tf_r11 */ \
+	greg(r12, R12, 8)	/* tf_r12 */ \
+	greg(r13, R13, 9)	/* tf_r13 */ \
+	greg(r14, R14, 10)	/* tf_r14 */ \
+	greg(r15, R15, 11)	/* tf_r15 */ \
+	greg(rbp, RBP, 12)	/* tf_rbp */ \
+	greg(rbx, RBX, 13)	/* tf_rbx */ \
+	greg(rax, RAX, 14)	/* tf_rax */ \
+	greg(gs,  GS,  15)	/* tf_gs */ \
+	greg(fs,  FS,  16)	/* tf_fs */ \
+	greg(es,  ES,  17)	/* tf_es */ \
+	greg(ds,  DS,  18)	/* tf_ds */ \
+	greg(trapno, TRAPNO,	/* tf_trapno */ \
+	19) \
+	/* Below portion defined in hardware */ \
+	greg(err, ERR, 20)	/* tf_err: Dummy inserted if not defined */ \
+	greg(rip, RIP, 21)	/* tf_rip */ \
+	greg(cs,  CS,  22)	/* tf_cs */ \
+	greg(rflags, RFLAGS,	/* tf_rflags */ \
+	23) \
 	/* These are pushed unconditionally on the x86-64 */ \
-	greg(rsp, RSP, 24)	\
-	greg(ss,  SS,  25)
+	greg(rsp, RSP, 24)	/* tf_rsp */ \
+	greg(ss,  SS,  25)	/* tf_ss */
 
 #define _FRAME_NOREG(reg, REG, idx)
 



CVS commit: src/sys/arch/amd64/include

2014-05-22 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu May 22 14:59:01 UTC 2014

Modified Files:
src/sys/arch/amd64/include: asm.h

Log Message:
Indent.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/include/asm.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/amd64/include/asm.h
diff -u src/sys/arch/amd64/include/asm.h:1.18 src/sys/arch/amd64/include/asm.h:1.19
--- src/sys/arch/amd64/include/asm.h:1.18	Thu Sep 12 15:36:17 2013
+++ src/sys/arch/amd64/include/asm.h	Thu May 22 14:59:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.18 2013/09/12 15:36:17 joerg Exp $	*/
+/*	$NetBSD: asm.h,v 1.19 2014/05/22 14:59:01 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -47,7 +47,7 @@
 #define PIC_GOT(x)	x
 #endif
 
-# define _C_LABEL(x)	x
+#define _C_LABEL(x)	x
 #define	_ASM_LABEL(x)	x
 
 #define CVAROFF(x,y)		(_C_LABEL(x)+y)(%rip)



CVS commit: src/sys/arch/amd64/include

2014-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  3 15:22:36 UTC 2014

Modified Files:
src/sys/arch/amd64/include: types.h

Log Message:
we have cpu_bootconf()


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/amd64/include/types.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/amd64/include/types.h
diff -u src/sys/arch/amd64/include/types.h:1.44 src/sys/arch/amd64/include/types.h:1.45
--- src/sys/arch/amd64/include/types.h:1.44	Thu Mar 20 16:45:32 2014
+++ src/sys/arch/amd64/include/types.h	Thu Apr  3 11:22:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.44 2014/03/20 20:45:32 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.45 2014/04/03 15:22:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -81,6 +81,7 @@ typedef	volatile unsigned char		__cpu_si
 #define	__HAVE_NEW_STYLE_BUS_H
 #define	__HAVE_CPU_COUNTER
 #define	__HAVE_CPU_DATA_FIRST
+#define __HAVE_CPU_BOOTCONF
 #define	__HAVE_MD_CPU_OFFLINE
 #define	__HAVE_SYSCALL_INTERN
 #define	__HAVE_MINIMAL_EMUL



CVS commit: src/sys/arch/amd64/include

2014-03-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 20 20:45:32 UTC 2014

Modified Files:
src/sys/arch/amd64/include: pmc.h types.h

Log Message:
make pmc compile with amd64


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/include/pmc.h
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/amd64/include/types.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/amd64/include/pmc.h
diff -u src/sys/arch/amd64/include/pmc.h:1.1 src/sys/arch/amd64/include/pmc.h:1.2
--- src/sys/arch/amd64/include/pmc.h:1.1	Sat Apr 26 14:39:46 2003
+++ src/sys/arch/amd64/include/pmc.h	Thu Mar 20 16:45:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmc.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $	*/
+/*	$NetBSD: pmc.h,v 1.2 2014/03/20 20:45:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -34,10 +34,38 @@
  */
 
 #ifdef _KERNEL
+/*
+ * LEGACY PMC support
+ */
+struct x86_64_pmc_info_args;
 int	pmc_info(struct proc *, struct x86_64_pmc_info_args *,
 	register_t *);
+struct x86_64_pmc_startstop_args;
 int	pmc_startstop(struct proc *, struct x86_64_pmc_startstop_args *,
 	register_t *);
+struct x86_64_pmc_read_args;
 int	pmc_read(struct proc *, struct x86_64_pmc_read_args *,
 	register_t *);
+/* END LEGACY PMC SUPPORT */
+
+#define pmc_md_fork(p1,p2)
+#define pmc_get_num_counters()			(0)
+#define pmc_get_counter_type(c)			(0)
+#define pmc_save_context(p)
+#define pmc_restore_context(p)
+#define pmc_enable_counter(p,c)
+#define pmc_disable_counter(p,c)
+#define pmc_accumulate(p1,p2)
+#define pmc_process_exit(p1)
+#define pmc_counter_isconfigured(p,c)		(0)
+#define pmc_counter_isrunning(p,c)		(0)
+#define pmc_start_profiling(c,f)		(0)
+#define pmc_stop_profiling(c)			(0)
+#define pmc_alloc_kernel_counter(c,f)		(0)
+#define pmc_free_kernel_counter(c)		(0)
+#define pmc_configure_counter(p,c,f)		(0)
+#define pmc_get_counter_value(p,c,f,pv)		(0)
+
+#define PMC_ENABLED(p)		(0)
+
 #endif

Index: src/sys/arch/amd64/include/types.h
diff -u src/sys/arch/amd64/include/types.h:1.43 src/sys/arch/amd64/include/types.h:1.44
--- src/sys/arch/amd64/include/types.h:1.43	Sat Nov 30 20:05:16 2013
+++ src/sys/arch/amd64/include/types.h	Thu Mar 20 16:45:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.43 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.44 2014/03/20 20:45:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -60,6 +60,8 @@ typedef unsigned long	vsize_t;
 #define	PRIuVSIZE	lu
 #endif
 
+typedef int pmc_evid_t; 
+typedef __uint64_t  pmc_ctr_t;
 typedef long int	register_t;
 typedef int		register32_t;
 #define	PRIxREGISTER	lx



CVS commit: src/sys/arch/amd64/include

2014-02-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Thu Feb 20 18:20:39 UTC 2014

Modified Files:
src/sys/arch/amd64/include: frame.h

Log Message:
This doesn't need fpu.h, but should include ucontext.h


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/frame.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/amd64/include/frame.h
diff -u src/sys/arch/amd64/include/frame.h:1.16 src/sys/arch/amd64/include/frame.h:1.17
--- src/sys/arch/amd64/include/frame.h:1.16	Tue Feb 11 20:17:16 2014
+++ src/sys/arch/amd64/include/frame.h	Thu Feb 20 18:20:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.16 2014/02/11 20:17:16 dsl Exp $	*/
+/*	$NetBSD: frame.h,v 1.17 2014/02/20 18:20:39 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 #ifdef __x86_64__
 
 #include sys/signal.h
-#include x86/fpu.h
+#include sys/ucontext.h
 #include machine/frame_regs.h
 
 /*
@@ -119,6 +119,7 @@ struct sigframe_siginfo {
 };
 
 #ifdef _KERNEL
+struct lwp;
 void buildcontext(struct lwp *, void *, void *);
 #endif
 



CVS commit: src/sys/arch/amd64/include

2014-02-18 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Tue Feb 18 22:05:56 UTC 2014

Modified Files:
src/sys/arch/amd64/include: Makefile

Log Message:
Copy fpu.h to release


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/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/amd64/include/Makefile
diff -u src/sys/arch/amd64/include/Makefile:1.16 src/sys/arch/amd64/include/Makefile:1.17
--- src/sys/arch/amd64/include/Makefile:1.16	Tue Feb 11 20:17:16 2014
+++ src/sys/arch/amd64/include/Makefile	Tue Feb 18 22:05:56 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2014/02/11 20:17:16 dsl Exp $
+#	$NetBSD: Makefile,v 1.17 2014/02/18 22:05:56 dsl Exp $
 
 INCSDIR= /usr/include/amd64
 
@@ -7,7 +7,7 @@ INCS=	ansi.h aout_machdep.h asm.h \
 	cdefs.h cpu.h \
 	disklabel.h \
 	elf_machdep.h endian.h endian_machdep.h \
-	float.h frame.h frame_regs.h \
+	float.h fpu.h frame.h frame_regs.h \
 	gdt.h \
 	ieee.h ieeefp.h fenv.h \
 	int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \



CVS commit: src/sys/arch/amd64/include

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 21:11:15 UTC 2013

Modified Files:
src/sys/arch/amd64/include: db_machdep.h

Log Message:
use the parameter for instruction macros


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/amd64/include/db_machdep.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/amd64/include/db_machdep.h
diff -u src/sys/arch/amd64/include/db_machdep.h:1.11 src/sys/arch/amd64/include/db_machdep.h:1.12
--- src/sys/arch/amd64/include/db_machdep.h:1.11	Thu May 26 11:34:12 2011
+++ src/sys/arch/amd64/include/db_machdep.h	Thu Oct 17 17:11:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.11 2011/05/26 15:34:12 joerg Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.12 2013/10/17 21:11:15 christos Exp $	*/
 
 /* 
  * Mach Operating System
@@ -87,8 +87,8 @@ extern db_regs_t *ddb_regp;
 #define	inst_call(ins)		(((ins)0xff) == I_CALL || \
  (((ins)0xff) == I_CALLI  \
   ((ins)0x3800) == 0x1000))
-#define inst_load(ins)		0
-#define inst_store(ins)		0
+#define inst_load(ins)		__USE(ins)
+#define inst_store(ins)		__USE(ins)
 
 /* access capability and access macros */
 



CVS commit: src/sys/arch/amd64/include

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 23:04:20 UTC 2013

Modified Files:
src/sys/arch/amd64/include: db_machdep.h

Log Message:
we need to return something here.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/include/db_machdep.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/amd64/include/db_machdep.h
diff -u src/sys/arch/amd64/include/db_machdep.h:1.12 src/sys/arch/amd64/include/db_machdep.h:1.13
--- src/sys/arch/amd64/include/db_machdep.h:1.12	Thu Oct 17 17:11:15 2013
+++ src/sys/arch/amd64/include/db_machdep.h	Thu Oct 17 19:04:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.12 2013/10/17 21:11:15 christos Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.13 2013/10/17 23:04:20 christos Exp $	*/
 
 /* 
  * Mach Operating System
@@ -87,8 +87,8 @@ extern db_regs_t *ddb_regp;
 #define	inst_call(ins)		(((ins)0xff) == I_CALL || \
  (((ins)0xff) == I_CALLI  \
   ((ins)0x3800) == 0x1000))
-#define inst_load(ins)		__USE(ins)
-#define inst_store(ins)		__USE(ins)
+#define inst_load(ins)		(__USE(ins), 0)
+#define inst_store(ins)		(_USE(ins), 0)
 
 /* access capability and access macros */
 



CVS commit: src/sys/arch/amd64/include

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 23:05:08 UTC 2013

Modified Files:
src/sys/arch/amd64/include: db_machdep.h

Log Message:
add missing _


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amd64/include/db_machdep.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/amd64/include/db_machdep.h
diff -u src/sys/arch/amd64/include/db_machdep.h:1.13 src/sys/arch/amd64/include/db_machdep.h:1.14
--- src/sys/arch/amd64/include/db_machdep.h:1.13	Thu Oct 17 19:04:20 2013
+++ src/sys/arch/amd64/include/db_machdep.h	Thu Oct 17 19:05:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.13 2013/10/17 23:04:20 christos Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.14 2013/10/17 23:05:08 christos Exp $	*/
 
 /* 
  * Mach Operating System
@@ -88,7 +88,7 @@ extern db_regs_t *ddb_regp;
  (((ins)0xff) == I_CALLI  \
   ((ins)0x3800) == 0x1000))
 #define inst_load(ins)		(__USE(ins), 0)
-#define inst_store(ins)		(_USE(ins), 0)
+#define inst_store(ins)		(__USE(ins), 0)
 
 /* access capability and access macros */
 



CVS commit: src/sys/arch/amd64/include

2013-06-22 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sat Jun 22 07:31:36 UTC 2013

Modified Files:
src/sys/arch/amd64/include: asm.h

Log Message:
Define IDTVEC_END(), from i386/asm.h.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/asm.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/amd64/include/asm.h
diff -u src/sys/arch/amd64/include/asm.h:1.16 src/sys/arch/amd64/include/asm.h:1.17
--- src/sys/arch/amd64/include/asm.h:1.16	Fri Jun 21 02:47:06 2013
+++ src/sys/arch/amd64/include/asm.h	Sat Jun 22 07:31:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.16 2013/06/21 02:47:06 uebayasi Exp $	*/
+/*	$NetBSD: asm.h,v 1.17 2013/06/22 07:31:36 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -79,9 +79,13 @@
 #ifdef __STDC__
 #define	IDTVEC(name) \
 	ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name:
+#define	IDTVEC_END(name) \
+	.size X ## name, . - X ## name
 #else 
 #define	IDTVEC(name) \
 	ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name:
+#define	IDTVEC_END(name) \
+	.size X/**/name, . - X/**/name
 #endif /* __STDC__ */ 
 #endif /* _KERNEL */
 



CVS commit: src/sys/arch/amd64/include

2013-06-20 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Jun 21 02:47:06 UTC 2013

Modified Files:
src/sys/arch/amd64/include: asm.h

Log Message:
Add END(y) as i386/asm.h does.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amd64/include/asm.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/amd64/include/asm.h
diff -u src/sys/arch/amd64/include/asm.h:1.15 src/sys/arch/amd64/include/asm.h:1.16
--- src/sys/arch/amd64/include/asm.h:1.15	Mon Jun 11 15:18:05 2012
+++ src/sys/arch/amd64/include/asm.h	Fri Jun 21 02:47:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.15 2012/06/11 15:18:05 chs Exp $	*/
+/*	$NetBSD: asm.h,v 1.16 2013/06/21 02:47:06 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -104,6 +104,7 @@
 #define	ALTENTRY(x)	NENTRY(x)
 #define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 #define	LABEL(y)	_LABEL(_C_LABEL(y))
+#define	END(y)		.size y, . - y
 
 #define	ASMSTR		.asciz
 



CVS commit: src/sys/arch/amd64/include

2013-01-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  7 17:03:06 UTC 2013

Modified Files:
src/sys/arch/amd64/include: segments.h

Log Message:
rearrange the LDT entries so that (32-bit) COMPAT_10 binaries work again.
in long mode, call gates use two slots, so the first entry (a call gate)
would overlap the second one (the 32-bit user code descriptor).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amd64/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/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.23 src/sys/arch/amd64/include/segments.h:1.24
--- src/sys/arch/amd64/include/segments.h:1.23	Sat Jun 16 20:47:04 2012
+++ src/sys/arch/amd64/include/segments.h	Mon Jan  7 17:03:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.23 2012/06/16 20:47:04 dsl Exp $	*/
+/*	$NetBSD: segments.h,v 1.24 2013/01/07 17:03:06 chs Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -374,12 +374,15 @@ void cpu_fsgs_reload(struct lwp *, int, 
  * Strange order because of syscall/sysret insns
  */
 #define	LSYS5CALLS_SEL	0	/* iBCS system call gate */
-#define LUCODE32_SEL	8	/* 32 bit user code descriptor */
-#define	LUDATA_SEL	16	/* User data descriptor */
-#define	LUCODE_SEL	24	/* User code descriptor */
+/*			8	   second half */
 #define	LSOL26CALLS_SEL	32	/* Solaris 2.6 system call gate */
-#define LUDATA32_SEL	56	/* 32 bit user data descriptor (needed?)*/
+/*			40	   second half */
+#define LUCODE32_SEL	48	/* 32 bit user code descriptor */
+#define	LUDATA_SEL	56	/* User data descriptor */
+#define	LUCODE_SEL	64	/* User code descriptor */
+#define LUDATA32_SEL	72	/* 32 bit user data descriptor (needed?)*/
 #define	LBSDICALLS_SEL	128	/* BSDI system call gate */
+/*			136	   second half */
 
 #define LDT_SIZE	144
 



CVS commit: src/sys/arch/amd64/include

2013-01-02 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Wed Jan  2 19:40:23 UTC 2013

Modified Files:
src/sys/arch/amd64/include: signal.h

Log Message:
This is included into user-programs by signal.h, it shouldn't be
pulling in machine/fpu.h - which doesn't describe anything userspace
(directly) needs.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/amd64/include/signal.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/amd64/include/signal.h
diff -u src/sys/arch/amd64/include/signal.h:1.11 src/sys/arch/amd64/include/signal.h:1.12
--- src/sys/arch/amd64/include/signal.h:1.11	Wed Nov 19 18:35:58 2008
+++ src/sys/arch/amd64/include/signal.h	Wed Jan  2 19:40:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: signal.h,v 1.11 2008/11/19 18:35:58 ad Exp $	*/
+/*	$NetBSD: signal.h,v 1.12 2013/01/02 19:40:23 dsl Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
@@ -45,7 +45,6 @@ typedef int sig_atomic_t;
  * Get the code values
  */
 #include machine/trap.h
-#include machine/fpu.h
 #include machine/mcontext.h
 
 #ifdef _KERNEL_OPT



CVS commit: src/sys/arch/amd64/include

2012-12-15 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sat Dec 15 21:50:43 UTC 2012

Modified Files:
src/sys/arch/amd64/include: fpu.h

Log Message:
Add the offsets and comments for the members of 'struct fxsave64.
Spilt the 'fx_unused2' field into its reserved and available halves.
The latter could be used by the kernel software (cpu won't read/write it).
Remove the __padded from 'struct fxsave64', everything is aligned.
Add a CTASSERT that the size is correct (512).
Remove the unused 'struct oldfsave'.
Everything still builds.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/include/fpu.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/amd64/include/fpu.h
diff -u src/sys/arch/amd64/include/fpu.h:1.5 src/sys/arch/amd64/include/fpu.h:1.6
--- src/sys/arch/amd64/include/fpu.h:1.5	Wed Apr 16 21:51:03 2008
+++ src/sys/arch/amd64/include/fpu.h	Sat Dec 15 21:50:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.h,v 1.5 2008/04/16 21:51:03 cegger Exp $	*/
+/*	$NetBSD: fpu.h,v 1.6 2012/12/15 21:50:43 dsl Exp $	*/
 
 #ifndef	_AMD64_FPU_H_
 #define	_AMD64_FPU_H_
@@ -11,19 +11,22 @@
  */
 
 struct fxsave64 {
-	uint16_t  fx_fcw;
-	uint16_t  fx_fsw;
-	uint8_t   fx_ftw;
-	uint8_t   fx_unused1;
-	uint16_t  fx_fop;
-	uint64_t  fx_rip;
-	uint64_t  fx_rdp;
-	uint32_t  fx_mxcsr;
-	uint32_t  fx_mxcsr_mask;
-	uint64_t  fx_st[8][2];   /* 8 normal FP regs */
-	uint64_t  fx_xmm[16][2]; /* 16 SSE2 registers */
-	uint8_t   fx_unused3[96];
-} __packed;
+	uint16_t  fx_fcw;   /* 0: FPU control word */
+	uint16_t  fx_fsw;   /* 2: FPU status word */
+	uint8_t   fx_ftw;   /* 4: Abridged FPU tag word */
+	uint8_t   fx_reserved1; /* 5: */
+	uint16_t  fx_fop;   /* 6: Low 11 bits are FPU opcode */
+	uint64_t  fx_rip;   /* 8: Address of faulting instruction */
+	uint64_t  fx_rdp;   /* 16: Data address associated with fault */
+	uint32_t  fx_mxcsr; /* 24: SIMD control  status */
+	uint32_t  fx_mxcsr_mask;/* 28: */
+	uint64_t  fx_st[8][2];  /* 32: 8 normal FP regs (80 bit) */
+	uint64_t  fx_xmm[16][2];/* 160: 16 SSE2 registers */
+	uint8_t   fx_reserved2[48]; /* 416: */
+	uint8_t   fx_available[48]; /* 464: could be used by kernel */
+};
+
+__CTASSERT(sizeof (struct fxsave64) == 512);
 
 struct savefpu {
 	struct fxsave64 fp_fxsave;	/* see above */
@@ -31,27 +34,6 @@ struct savefpu {
 	uint16_t fp_ex_tw;		/* saved tag from last exception */
 } __aligned(16);
 
-#ifdef _KERNEL
-
-/*
- * This one only used for backward compat coredumping.
- */
-struct oldfsave {
-	uint16_t	fs_control;
-	uint16_t	fs_unused0;
-	uint16_t	fs_status;
-	uint16_t	fs_unused1;
-	uint16_t	fs_tag;
-	uint16_t	fs_unused2;
-	uint32_t	fs_ipoff;
-	uint16_t	fs_ipsel;
-	uint16_t	fs_op;
-	uint32_t	fs_opoff;
-	uint16_t	fs_opsel;
-} __attribute__ ((packed));
-
-#endif
-
 
 /*
  * The i387 defaults to Intel extended precision mode and round to nearest,



CVS commit: src/sys/arch/amd64/include

2012-12-15 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sat Dec 15 22:39:04 UTC 2012

Modified Files:
src/sys/arch/amd64/include: mcontext.h

Log Message:
Remove the incorrect comment about a (now deleted) pad field added
to make __fpregs be 16-byte aligned within ucontext_t.
I doubt that has been true for years!
Since the __fpregs field isn't accessed by fxsave it doesn't matter.
There is a lot of type fubar here, at leat mark the char[] __aligned(8).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amd64/include/mcontext.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/amd64/include/mcontext.h
diff -u src/sys/arch/amd64/include/mcontext.h:1.15 src/sys/arch/amd64/include/mcontext.h:1.16
--- src/sys/arch/amd64/include/mcontext.h:1.15	Mon May 21 14:15:17 2012
+++ src/sys/arch/amd64/include/mcontext.h	Sat Dec 15 22:39:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.15 2012/05/21 14:15:17 martin Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.16 2012/12/15 22:39:04 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -52,13 +52,11 @@ typedef	__greg_t	__gregset_t[_NGREG];
 
 /*
  * Floating point register state
+ * The format of __fpregset_t is that of the fxsave instruction
+ * which requires 16 byte alignment. However the mcontext version
+ * is never directly accessed.
  */
-typedef char __fpregset_t[512];
-
-/*
- * The padding below is to make __fpregs have a 16-byte aligned offset
- * within ucontext_t.
- */
+typedef char __fpregset_t[512] __aligned(8);
 
 typedef struct {
 	__gregset_t	__gregs;



CVS commit: src/sys/arch/amd64/include

2012-08-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Aug 15 08:09:57 UTC 2012

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Bump VM_PHYSSEG_MAX to 16 from 10. Modern IBM hardware requires
VM_PHYSSEG_MAX to be turned up to 11 to avoid an early panic.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.30 src/sys/arch/amd64/include/vmparam.h:1.31
--- src/sys/arch/amd64/include/vmparam.h:1.30	Mon May  7 16:16:44 2012
+++ src/sys/arch/amd64/include/vmparam.h	Wed Aug 15 08:09:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.30 2012/05/07 16:16:44 joerg Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.31 2012/08/15 08:09:57 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -148,7 +148,7 @@
 /* virtual sizes (bytes) for various kernel submaps */
 #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
 
-#define VM_PHYSSEG_MAX		10	/* 1 hole + 9 free lists */
+#define VM_PHYSSEG_MAX		16	/* 1 hole + 15 free lists */
 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
 
 #define	VM_NFREELIST		3



CVS commit: src/sys/arch/amd64/include

2012-06-11 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jun 11 15:18:26 UTC 2012

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
allow more space for modules.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.32 src/sys/arch/amd64/include/pmap.h:1.33
--- src/sys/arch/amd64/include/pmap.h:1.32	Sun Feb 19 10:39:06 2012
+++ src/sys/arch/amd64/include/pmap.h	Mon Jun 11 15:18:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.32 2012/02/19 10:39:06 cherry Exp $	*/
+/*	$NetBSD: pmap.h,v 1.33 2012/06/11 15:18:26 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -188,7 +188,7 @@
 
 #define NKL4_KIMG_ENTRIES	1
 #define NKL3_KIMG_ENTRIES	1
-#define NKL2_KIMG_ENTRIES	10
+#define NKL2_KIMG_ENTRIES	16
 
 /*
  * Since kva space is below the kernel in its entirety, we start off



CVS commit: src/sys/arch/amd64/include

2012-05-17 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Thu May 17 19:38:54 UTC 2012

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Let the user of INTRENTRY_L() place a label on the 'swapgs' used
  when faulting from user space.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.18 src/sys/arch/amd64/include/frameasm.h:1.19
--- src/sys/arch/amd64/include/frameasm.h:1.18	Mon May  7 21:04:09 2012
+++ src/sys/arch/amd64/include/frameasm.h	Thu May 17 19:38:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.18 2012/05/07 21:04:09 dsl Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.19 2012/05/17 19:38:53 dsl Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -73,11 +73,12 @@
 	movq	TF_RBX(%rsp),%rbx	; \
 	movq	TF_RAX(%rsp),%rax
 
-#define	INTRENTRY_L(kernel_trap) \
+#define	INTRENTRY_L(kernel_trap, usertrap) \
 	subq	$TF_REGSIZE,%rsp	; \
 	INTR_SAVE_GPRS			; \
 	testb	$SEL_UPL,TF_CS(%rsp)	; \
 	je	kernel_trap		; \
+usertrap; \
 	swapgs; \
 	movw	%gs,TF_GS(%rsp)		; \
 	movw	%fs,TF_FS(%rsp)		; \
@@ -85,7 +86,7 @@
 	movw	%ds,TF_DS(%rsp)	
 
 #define	INTRENTRY \
-	INTRENTRY_L(98f)		; \
+	INTRENTRY_L(98f,)		; \
 98:
 
 #define INTRFASTEXIT \



CVS commit: src/sys/arch/amd64/include

2012-05-07 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Mon May  7 20:51:20 UTC 2012

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Move all the XEN differences to a single conditional.
Merge the XEN/non-XEN versions of INTRFASTEXIT and
  INTR_RECURSE_HWFRAME by using extra defines.
Split INTRENTRY so that code can insert extra instructions
  inside user/kernel conditional.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.16 src/sys/arch/amd64/include/frameasm.h:1.17
--- src/sys/arch/amd64/include/frameasm.h:1.16	Wed Aug 10 06:33:13 2011
+++ src/sys/arch/amd64/include/frameasm.h	Mon May  7 20:51:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.16 2011/08/10 06:33:13 cherry Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.17 2012/05/07 20:51:20 dsl Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -17,7 +17,23 @@
 /* Xen do not need swapgs, done by hypervisor */
 #define swapgs
 #define iretq	pushq $0 ; jmp HYPERVISOR_iret
-#endif
+#define	XEN_ONLY2(x,y)	x,y
+#define	NOT_XEN(x)
+
+#define CLI(temp_reg) \
+ 	movq CPUVAR(VCPU),%r ## temp_reg ;			\
+	movb $1,EVTCHN_UPCALL_MASK(%r ## temp_reg);
+
+#define STI(temp_reg) \
+ 	movq CPUVAR(VCPU),%r ## temp_reg ;			\
+	movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg);
+
+#else /* XEN */
+#define	XEN_ONLY2(x,y)
+#define	NOT_XEN(x)	x
+#define CLI(temp_reg) cli
+#define STI(temp_reg) sti
+#endif	/* XEN */
 
 /*
  * These are used on interrupt or trap entry or exit.
@@ -57,23 +73,27 @@
 	movq	TF_RBX(%rsp),%rbx	; \
 	movq	TF_RAX(%rsp),%rax
 
-#define	INTRENTRY \
+#define	INTRENTRY_L(kernel_trap) \
 	subq	$TF_REGSIZE,%rsp	; \
-	testq	$SEL_UPL,TF_CS(%rsp)	; \
-	je	98f			; \
+	INTR_SAVE_GPRS			; \
+	testb	$SEL_UPL,TF_CS(%rsp)	; \
+	je	kernel_trap		; \
 	swapgs; \
 	movw	%gs,TF_GS(%rsp)		; \
 	movw	%fs,TF_FS(%rsp)		; \
 	movw	%es,TF_ES(%rsp)		; \
-	movw	%ds,TF_DS(%rsp)		; \
-98:	INTR_SAVE_GPRS
+	movw	%ds,TF_DS(%rsp)	
+
+#define	INTRENTRY \
+	INTRENTRY_L(98f)		; \
+98:
 
-#ifndef XEN
 #define INTRFASTEXIT \
 	INTR_RESTORE_GPRS 		; \
 	testq	$SEL_UPL,TF_CS(%rsp)	/* Interrupted %cs */ ; \
 	je	99f			; \
-	cli; \
+/* XEN: Disabling events before going to user mode sounds like a BAD idea */ \
+	NOT_XEN(cli;)			  \
 	movw	TF_ES(%rsp),%es		; \
 	movw	TF_DS(%rsp),%ds		; \
 	swapgs; \
@@ -88,41 +108,15 @@
 	pushfq; \
 	movl	%cs,%r11d		; \
 	pushq	%r11			; \
+/* XEN: We must fixup CS, as even kernel mode runs at CPL 3 */ \
+ 	XEN_ONLY2(andb	$0xfc,(%rsp))	  \
 	pushq	%r13			;
 
-#else	/* !XEN */
-/*
- * Disabling events before going to user mode sounds like a BAD idea
- * do no restore gs either, HYPERVISOR_iret will do a swapgs
- */
-#define INTRFASTEXIT \
- 	INTR_RESTORE_GPRS 		; \
- 	testq	$SEL_UPL,TF_CS(%rsp)	; \
- 	je	99f			; \
- 	movw	TF_ES(%rsp),%es		; \
- 	movw	TF_DS(%rsp),%ds		; \
-99:	addq	$TF_REGSIZE+16,%rsp	/* + T_xxx and error code */ ; \
- 	iretq
-  
-/* We must fixup CS, as even kernel mode runs at CPL 3 */
-#define INTR_RECURSE_HWFRAME \
- 	movq	%rsp,%r10		; \
- 	movl	%ss,%r11d		; \
- 	pushq	%r11			; \
- 	pushq	%r10			; \
- 	pushfq; \
- 	movl	%cs,%r11d		; \
- 	pushq	%r11			; \
- 	andb	$0xfc,(%rsp)		; \
- 	pushq	%r13			;
- 
-#endif	/* !XEN */
- 
 #define	DO_DEFERRED_SWITCH \
 	cmpl	$0, CPUVAR(WANT_PMAPLOAD)		; \
 	jz	1f	; \
 	call	_C_LABEL(do_pmap_load)			; \
-	1:
+1:
 
 #define	CHECK_DEFERRED_SWITCH \
 	cmpl	$0, CPUVAR(WANT_PMAPLOAD)
@@ -130,18 +124,4 @@
 #define CHECK_ASTPENDING(reg)	cmpl	$0, L_MD_ASTPENDING(reg)
 #define CLEAR_ASTPENDING(reg)	movl	$0, L_MD_ASTPENDING(reg)
 
-#ifdef XEN
-#define CLI(temp_reg) \
- 	movq CPUVAR(VCPU),%r ## temp_reg ;			\
-	movb $1,EVTCHN_UPCALL_MASK(%r ## temp_reg);
-
-#define STI(temp_reg) \
- 	movq CPUVAR(VCPU),%r ## temp_reg ;			\
-	movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg);
-
-#else /* XEN */
-#define CLI(temp_reg) cli
-#define STI(temp_reg) sti
-#endif	/* XEN */
-
 #endif /* _AMD64_MACHINE_FRAMEASM_H */



CVS commit: src/sys/arch/amd64/include

2012-05-07 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Mon May  7 21:04:10 UTC 2012

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Add a ';' that got deleted in a slight tidyup.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.17 src/sys/arch/amd64/include/frameasm.h:1.18
--- src/sys/arch/amd64/include/frameasm.h:1.17	Mon May  7 20:51:20 2012
+++ src/sys/arch/amd64/include/frameasm.h	Mon May  7 21:04:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.17 2012/05/07 20:51:20 dsl Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.18 2012/05/07 21:04:09 dsl Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -109,7 +109,7 @@
 	movl	%cs,%r11d		; \
 	pushq	%r11			; \
 /* XEN: We must fixup CS, as even kernel mode runs at CPL 3 */ \
- 	XEN_ONLY2(andb	$0xfc,(%rsp))	  \
+ 	XEN_ONLY2(andb	$0xfc,(%rsp);)	  \
 	pushq	%r13			;
 
 #define	DO_DEFERRED_SWITCH \



CVS commit: src/sys/arch/amd64/include

2012-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 27 15:41:02 UTC 2012

Modified Files:
src/sys/arch/amd64/include: int_limits.h

Log Message:
PR/45878: Nick Hudson: SIG_ATOMIC_{MAX,MIN} wrong for sig_atomic_t on amd64
sig_atomic_t is an int on amd64, put the proper limits there


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/include/int_limits.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/amd64/include/int_limits.h
diff -u src/sys/arch/amd64/include/int_limits.h:1.7 src/sys/arch/amd64/include/int_limits.h:1.8
--- src/sys/arch/amd64/include/int_limits.h:1.7	Sat Oct 25 20:08:15 2008
+++ src/sys/arch/amd64/include/int_limits.h	Fri Jan 27 10:41:02 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: int_limits.h,v 1.7 2008/10/26 00:08:15 mrg Exp $	*/
+/*	$NetBSD: int_limits.h,v 1.8 2012/01/27 15:41:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -120,8 +120,8 @@
 #define	PTRDIFF_MAX	0x7fffL		/* ptrdiff_t	  */
 
 /* limits of sig_atomic_t */
-#define	SIG_ATOMIC_MIN	(-0x7fffL-1)	/* sig_atomic_t	  */
-#define	SIG_ATOMIC_MAX	0x7fffL		/* sig_atomic_t	  */
+#define	SIG_ATOMIC_MIN	(-0x7fff-1)			/* sig_atomic_t	  */
+#define	SIG_ATOMIC_MAX	0x7fff			/* sig_atomic_t	  */
 
 /* limit of size_t */
 #define	SIZE_MAX	0xUL		/* size_t	  */



CVS commit: src/sys/arch/amd64/include

2012-01-15 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Jan 15 16:48:31 UTC 2012

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
for xen on amd64 PDP_BASE points to the per-cpu ci-ci_kpm_pdir copy of 
*pmap_kernel()*'s L4 pdir, which is an alias for ci-ci_kpm_pdir. This is 
unlike PAE, where PDP_BASE points to the per-pmap pm_pdir consisting of 4 
pages, the last of which is the shadow. This shadow is not used directly in 
an active pmap, since it duplicates the kernel space and, for PAE, xen 
dissallows multiple cpus pointing to the same L3[3] page. Therefore, we use a 
per-cpu copy of the pmap_kernel() pdir's L3[3] page, ci-ci_pae_l3_pdir[3], 
while L3[0-2] point to the original pmap's pm_pdir[0 - 2]. Thus the shadow 
pdir only exists on i386 PAE. Note that on PAE, the recursive PDIR_SLOT_PTE is 
not per-cpu, and therefore cannot be made to point to per-cpu pdirs via 
(L4_BASE + PDIR_SLOT_PTE), unlike xen x86_64 where this is exactly the case.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.29 src/sys/arch/amd64/include/pmap.h:1.30
--- src/sys/arch/amd64/include/pmap.h:1.29	Mon Jan  9 13:04:13 2012
+++ src/sys/arch/amd64/include/pmap.h	Sun Jan 15 16:48:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.29 2012/01/09 13:04:13 cherry Exp $	*/
+/*	$NetBSD: pmap.h,v 1.30 2012/01/15 16:48:31 cherry Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -193,7 +193,6 @@
 
 #define PDP_PDE		(L4_BASE + PDIR_SLOT_PTE)
 #define APDP_PDE	(curcpu()-ci_kpm_pdir[PDIR_SLOT_APTE])
-#define APDP_PDE_SHADOW	(L4_BASE + PDIR_SLOT_APTE)
 
 #define PDP_BASE	L4_BASE
 #define APDP_BASE	AL4_BASE



CVS commit: src/sys/arch/amd64/include

2012-01-10 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Jan 10 16:03:17 UTC 2012

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
reduce VM_MAX_KERNEL_ADDRESS so that it does not include
the direct-map or APTE regions.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.28 src/sys/arch/amd64/include/vmparam.h:1.29
--- src/sys/arch/amd64/include/vmparam.h:1.28	Thu Nov 24 17:08:07 2011
+++ src/sys/arch/amd64/include/vmparam.h	Tue Jan 10 16:03:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.28 2011/11/24 17:08:07 christos Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.29 2012/01/10 16:03:17 chs Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -122,7 +122,7 @@
 #else /* XEN */
 #define VM_MIN_KERNEL_ADDRESS	0xa000
 #endif
-#define VM_MAX_KERNEL_ADDRESS	0xff80
+#define VM_MAX_KERNEL_ADDRESS	0xfe80
 
 #define VM_MAXUSER_ADDRESS32	0xf000
 



CVS commit: src/sys/arch/amd64/include

2011-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 24 17:08:07 UTC 2011

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Bump text size to 128MB to make sure that gcc46 fits. It exceeded 64MB by
a tiny bit.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.27 src/sys/arch/amd64/include/vmparam.h:1.28
--- src/sys/arch/amd64/include/vmparam.h:1.27	Fri Mar  4 08:24:19 2011
+++ src/sys/arch/amd64/include/vmparam.h	Thu Nov 24 12:08:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.27 2011/03/04 13:24:19 christos Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.28 2011/11/24 17:08:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -72,7 +72,7 @@
 /*
  * Virtual memory related constants, all in bytes
  */
-#define	MAXTSIZ		(64*1024*1024)		/* max text size */
+#define	MAXTSIZ		(128*1024*1024)		/* max text size */
 #ifndef DFLDSIZ
 #define	DFLDSIZ		(256*1024*1024)		/* initial data size limit */
 #endif
@@ -90,7 +90,7 @@
  * 32bit memory related constants.
  */
 
-#define MAXTSIZ32	(64*1024*1024)
+#define MAXTSIZ32	(128*1024*1024)
 #ifndef DFLDSIZ32
 #define	DFLDSIZ32	(256*1024*1024)		/* initial data size limit */
 #endif



CVS commit: src/sys/arch/amd64/include

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 04:09:18 UTC 2011

Modified Files:
src/sys/arch/amd64/include: linux32_machdep.h

Log Message:
include the new siginfo.h file


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/include/linux32_machdep.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/amd64/include/linux32_machdep.h
diff -u src/sys/arch/amd64/include/linux32_machdep.h:1.1 src/sys/arch/amd64/include/linux32_machdep.h:1.2
--- src/sys/arch/amd64/include/linux32_machdep.h:1.1	Thu Feb  9 14:18:56 2006
+++ src/sys/arch/amd64/include/linux32_machdep.h	Thu Nov 17 23:09:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_machdep.h,v 1.1 2006/02/09 19:18:56 manu Exp $ */
+/*	$NetBSD: linux32_machdep.h,v 1.2 2011/11/18 04:09:17 christos Exp $ */
 
 #ifndef _MACHINE_LINUX32_H_
 #define _MACHINE_LINUX32_H_
@@ -7,6 +7,7 @@
 
 #include compat/linux32/common/linux32_types.h
 
+#include compat/linux32/arch/amd64/linux32_siginfo.h
 #include compat/linux32/arch/amd64/linux32_signal.h
 #include compat/linux32/arch/amd64/linux32_syscallargs.h
 #include compat/linux32/arch/amd64/linux32_syscall.h



CVS commit: src/sys/arch/amd64/include

2011-08-10 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Aug 10 06:33:13 UTC 2011

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Correct offset calculation for ci


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amd64/include/frameasm.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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.15 src/sys/arch/amd64/include/frameasm.h:1.16
--- src/sys/arch/amd64/include/frameasm.h:1.15	Wed Jan 12 23:12:11 2011
+++ src/sys/arch/amd64/include/frameasm.h	Wed Aug 10 06:33:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.15 2011/01/12 23:12:11 joerg Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.16 2011/08/10 06:33:13 cherry Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -132,15 +132,13 @@
 
 #ifdef XEN
 #define CLI(temp_reg) \
- 	movl CPUVAR(CPUID),%e ## temp_reg ;			\
- 	shlq $6,%r ## temp_reg ;\
- 	addq CPUVAR(VCPU),%r ## temp_reg ;			\
- 	movb $1,EVTCHN_UPCALL_MASK(%r ## temp_reg)
+ 	movq CPUVAR(VCPU),%r ## temp_reg ;			\
+	movb $1,EVTCHN_UPCALL_MASK(%r ## temp_reg);
+
 #define STI(temp_reg) \
- 	movl CPUVAR(CPUID),%e ## temp_reg ;			\
- 	shlq $6,%r ## temp_reg ;\
- 	addq CPUVAR(VCPU),%r ## temp_reg ;			\
- 	movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg)
+ 	movq CPUVAR(VCPU),%r ## temp_reg ;			\
+	movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg);
+
 #else /* XEN */
 #define CLI(temp_reg) cli
 #define STI(temp_reg) sti



CVS commit: src/sys/arch/amd64/include

2011-07-26 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Tue Jul 26 12:55:35 UTC 2011

Modified Files:
src/sys/arch/amd64/include: param.h

Log Message:
g/c round_pdr


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amd64/include/param.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/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.13 src/sys/arch/amd64/include/param.h:1.14
--- src/sys/arch/amd64/include/param.h:1.13	Mon Feb  8 19:02:26 2010
+++ src/sys/arch/amd64/include/param.h	Tue Jul 26 12:55:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.13 2010/02/08 19:02:26 joerg Exp $	*/
+/*	$NetBSD: param.h,v 1.14 2011/07/26 12:55:35 yamt Exp $	*/
 
 #ifdef __x86_64__
 
@@ -118,7 +118,6 @@
 
 #define btop(x)x86_btop(x)
 #define ptob(x)x86_ptob(x)
-#define round_pdr(x)			x86_round_pdr(x)
 
 #define mstohz(ms) ((ms + 0UL) * hz / 1000)
 



CVS commit: src/sys/arch/amd64/include

2011-07-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Jul 17 01:17:27 UTC 2011

Modified Files:
src/sys/arch/amd64/include: Makefile
Removed Files:
src/sys/arch/amd64/include: bus.h

Log Message:
On amd64, good-bye machine/bus.h.

Up next: update set lists.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/amd64/include/Makefile
cvs rdiff -u -r1.1 -r0 src/sys/arch/amd64/include/bus.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/amd64/include/Makefile
diff -u src/sys/arch/amd64/include/Makefile:1.11 src/sys/arch/amd64/include/Makefile:1.12
--- src/sys/arch/amd64/include/Makefile:1.11	Sat Jul 31 21:47:53 2010
+++ src/sys/arch/amd64/include/Makefile	Sun Jul 17 01:17:27 2011
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.11 2010/07/31 21:47:53 joerg Exp $
+#	$NetBSD: Makefile,v 1.12 2011/07/17 01:17:27 dyoung Exp $
 
 INCSDIR= /usr/include/amd64
 
 INCS=	ansi.h aout_machdep.h asm.h \
-	bootinfo.h bswap.h bus.h byte_swap.h \
+	bootinfo.h bswap.h byte_swap.h \
 	cdefs.h cpu.h cpufunc.h \
 	disklabel.h \
 	elf_machdep.h endian.h endian_machdep.h \



CVS commit: src/sys/arch/amd64/include

2011-03-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Mar  4 03:34:24 UTC 2011

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Reduce MAXSSIZ to 64MB, otherwise netbsd32 binaries crash in ld.elf_so,
including the trivial main(){}. Add a warning to not modify this without
testing compatibility mode.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.25 src/sys/arch/amd64/include/vmparam.h:1.26
--- src/sys/arch/amd64/include/vmparam.h:1.25	Thu Feb 17 18:07:50 2011
+++ src/sys/arch/amd64/include/vmparam.h	Fri Mar  4 03:34:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.25 2011/02/17 18:07:50 drochner Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.26 2011/03/04 03:34:24 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -82,8 +82,9 @@
 #ifndef	DFLSSIZ
 #define	DFLSSIZ		(4*1024*1024)		/* initial stack size limit */
 #endif
+/* Warning: Do not change this constant without testing netbsd32! */
 #ifndef	MAXSSIZ
-#define	MAXSSIZ		(128*1024*1024)		/* max stack size */
+#define	MAXSSIZ		(64*1024*1024)		/* max stack size */
 #endif
 
 /*



CVS commit: src/sys/arch/amd64/include

2011-02-17 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Thu Feb 17 18:07:51 UTC 2011

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
make stack size limit (both initial and maximum) for native code
the double of that in 32-but emul mode, so that code which works
in emulation (or on the i386 port) will likely not overflow the
stack if built as native 64-bit program
This is still very conservative.
(before, the max stack size was natively even less than for 32bit emul)


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/include/vmparam.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/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.24 src/sys/arch/amd64/include/vmparam.h:1.25
--- src/sys/arch/amd64/include/vmparam.h:1.24	Sun Nov 14 13:33:21 2010
+++ src/sys/arch/amd64/include/vmparam.h	Thu Feb 17 18:07:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.24 2010/11/14 13:33:21 uebayasi Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.25 2011/02/17 18:07:50 drochner Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -80,10 +80,10 @@
 #define	MAXDSIZ		(8L*1024*1024*1024)	/* max data size */
 #endif
 #ifndef	DFLSSIZ
-#define	DFLSSIZ		(2*1024*1024)		/* initial stack size limit */
+#define	DFLSSIZ		(4*1024*1024)		/* initial stack size limit */
 #endif
 #ifndef	MAXSSIZ
-#define	MAXSSIZ		(32*1024*1024)		/* max stack size */
+#define	MAXSSIZ		(128*1024*1024)		/* max stack size */
 #endif
 
 /*



CVS commit: src/sys/arch/amd64/include

2010-12-22 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Dec 22 22:08:47 UTC 2010

Modified Files:
src/sys/arch/amd64/include: types.h

Log Message:
__HAVE_CPU_INFO_FIRST - __HAVE_CPU_DATA_FIRST.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/include/types.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/amd64/include/types.h
diff -u src/sys/arch/amd64/include/types.h:1.34 src/sys/arch/amd64/include/types.h:1.35
--- src/sys/arch/amd64/include/types.h:1.34	Wed Dec 22 04:15:02 2010
+++ src/sys/arch/amd64/include/types.h	Wed Dec 22 22:08:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.34 2010/12/22 04:15:02 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.35 2010/12/22 22:08:47 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -78,7 +78,7 @@
 
 #define	__HAVE_DEVICE_REGISTER
 #define	__HAVE_CPU_COUNTER
-#define	__HAVE_CPU_INFO_FIRST
+#define	__HAVE_CPU_DATA_FIRST
 #define	__HAVE_MD_CPU_OFFLINE
 #define	__HAVE_SYSCALL_INTERN
 #define	__HAVE_MINIMAL_EMUL



CVS commit: src/sys/arch/amd64/include

2010-07-24 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sat Jul 24 17:43:47 UTC 2010

Modified Files:
src/sys/arch/amd64/include: pte.h

Log Message:
Pull i386 pte.h on amd64 for 32bit compat.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/include/pte.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/amd64/include/pte.h
diff -u src/sys/arch/amd64/include/pte.h:1.7 src/sys/arch/amd64/include/pte.h:1.8
--- src/sys/arch/amd64/include/pte.h:1.7	Tue Jul  6 20:50:34 2010
+++ src/sys/arch/amd64/include/pte.h	Sat Jul 24 17:43:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pte.h,v 1.7 2010/07/06 20:50:34 cegger Exp $	*/
+/*	$NetBSD: pte.h,v 1.8 2010/07/24 17:43:47 njoly Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -38,6 +38,8 @@
 #ifndef _AMD64_PTE_H_
 #define _AMD64_PTE_H_
 
+#ifdef __x86_64__
+
 /*
  * amd64 MMU hardware structure:
  *
@@ -132,4 +134,10 @@
 
 #include x86/pte.h
 
+#else   /*  !__x86_64__  */
+
+#include i386/pte.h
+
+#endif  /*  !__x86_64__  */
+
 #endif /* _AMD64_PTE_H_ */



CVS commit: src/sys/arch/amd64/include

2010-03-18 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Thu Mar 18 08:28:33 UTC 2010

Modified Files:
src/sys/arch/amd64/include: elf_machdep.h

Log Message:
buildfix: invert comparison to get the 64bit defines by default.
Fixes 'i386/elf_machdep.h: No such file or directory error' when compiling
amd64 toolchain on OSX.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/include/elf_machdep.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/amd64/include/elf_machdep.h
diff -u src/sys/arch/amd64/include/elf_machdep.h:1.3 src/sys/arch/amd64/include/elf_machdep.h:1.4
--- src/sys/arch/amd64/include/elf_machdep.h:1.3	Sat May 30 05:56:52 2009
+++ src/sys/arch/amd64/include/elf_machdep.h	Thu Mar 18 08:28:33 2010
@@ -1,6 +1,6 @@
-/*	$NetBSD: elf_machdep.h,v 1.3 2009/05/30 05:56:52 skrll Exp $	*/
+/*	$NetBSD: elf_machdep.h,v 1.4 2010/03/18 08:28:33 cegger Exp $	*/
 
-#ifdef __x86_64__
+#if !defined __i386__
 
 #define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2LSB
 #define	ELF32_MACHDEP_ID_CASES		\
@@ -48,8 +48,8 @@
 
 #define	R_TYPE(name)	__CONCAT(R_X86_64_,name)
 
-#else	/*	__x86_64__	*/
+#else	/*	!__i386__	*/
 
 #include i386/elf_machdep.h
 
-#endif	/*	__x86_64__	*/
+#endif	/*	!__i386__	*/



CVS commit: src/sys/arch/amd64/include

2009-11-11 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Wed Nov 11 23:53:39 UTC 2009

Modified Files:
src/sys/arch/amd64/include: param.h
Added Files:
src/sys/arch/amd64/include: Makefile.inc

Log Message:
Build kernel modules with -mno-red-zone like kernel is build. This fixes
frequent panics in amd64 zfs module. This should also fix problem reported
by Nicolas Joly in:

http://mail-index.netbsd.org/port-amd64/2008/12/09/msg000646.html

Thanks to cube@ for his help with this.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/include/Makefile.inc
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amd64/include/param.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/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.10 src/sys/arch/amd64/include/param.h:1.11
--- src/sys/arch/amd64/include/param.h:1.10	Sat Dec 20 12:42:36 2008
+++ src/sys/arch/amd64/include/param.h	Wed Nov 11 23:53:39 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.10 2008/12/20 12:42:36 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.11 2009/11/11 23:53:39 haad Exp $	*/
 
 #ifdef __x86_64__
 
@@ -56,12 +56,12 @@
 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
 #endif
 
-#define	SSIZE		1		/* initial stack size/NBPG */
-#define	SINCR		1		/* increment of stack/NBPG */
+#define	SSIZE		8		/* initial stack size/NBPG */
+#define	SINCR		2		/* increment of stack/NBPG */
 #ifdef DIAGNOSTIC
-#define	UPAGES		4		/* pages of u-area (1 for redzone) */
+#define	UPAGES		16		/* pages of u-area (1 for redzone) */
 #else
-#define	UPAGES		3		/* pages of u-area */
+#define	UPAGES		12		/* pages of u-area */
 #endif
 #define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
 #define	INTRSTACKSIZE	4096

Added files:

Index: src/sys/arch/amd64/include/Makefile.inc
diff -u /dev/null src/sys/arch/amd64/include/Makefile.inc:1.1
--- /dev/null	Wed Nov 11 23:53:39 2009
+++ src/sys/arch/amd64/include/Makefile.inc	Wed Nov 11 23:53:38 2009
@@ -0,0 +1,3 @@
+# $NetBSD: Makefile.inc,v 1.1 2009/11/11 23:53:38 haad Exp $
+
+CFLAGS+=-mno-red-zone