Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 2015 14:37:21 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285041 - in head: gnu/usr.bin/gdb/kgdb sys/amd64/include sys/cddl/dev/dtrace/i386 sys/i386/include
Message-ID:  <201507021437.t62EbL35082279@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Jul  2 14:37:21 2015
New Revision: 285041
URL: https://svnweb.freebsd.org/changeset/base/285041

Log:
  Use single instance of the identical INKERNEL() and PMC_IN_KERNEL()
  macros on amd64 and i386.  Move the definition to machine/param.h.
  kgdb defines INKERNEL() too, the conflict is resolved by renaming kgdb
  version to PINKERNEL().
  
  On i386, correct the lowest kernel address.  After the shared page was
  introduced, USRSTACK no longer points to the last user address + 1 [*]
  
  Submitted by:	Oliver Pinter [*]
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/gnu/usr.bin/gdb/kgdb/trgt.c
  head/sys/amd64/include/param.h
  head/sys/amd64/include/pmc_mdep.h
  head/sys/amd64/include/stack.h
  head/sys/cddl/dev/dtrace/i386/dtrace_isa.c
  head/sys/i386/include/param.h
  head/sys/i386/include/pmc_mdep.h
  head/sys/i386/include/stack.h

Modified: head/gnu/usr.bin/gdb/kgdb/trgt.c
==============================================================================
--- head/gnu/usr.bin/gdb/kgdb/trgt.c	Thu Jul  2 14:35:30 2015	(r285040)
+++ head/gnu/usr.bin/gdb/kgdb/trgt.c	Thu Jul  2 14:37:21 2015	(r285041)
@@ -76,7 +76,7 @@ kvm_t *kvm;
 static char kvm_err[_POSIX2_LINE_MAX];
 
 #define	KERNOFF		(kgdb_kernbase ())
-#define	INKERNEL(x)	((x) >= KERNOFF)
+#define	PINKERNEL(x)	((x) >= KERNOFF)
 
 static CORE_ADDR
 kgdb_kernbase (void)
@@ -296,7 +296,7 @@ kgdb_set_proc_cmd (char *arg, int from_t
 
 	addr = (CORE_ADDR) parse_and_eval_address (arg);
 
-	if (!INKERNEL (addr)) {
+	if (!PINKERNEL (addr)) {
 		thr = kgdb_thr_lookup_pid((int)addr);
 		if (thr == NULL)
 			error ("invalid pid");
@@ -319,7 +319,7 @@ kgdb_set_tid_cmd (char *arg, int from_tt
 
 	addr = (CORE_ADDR) parse_and_eval_address (arg);
 
-	if (kvm != NULL && INKERNEL (addr)) {
+	if (kvm != NULL && PINKERNEL (addr)) {
 		thr = kgdb_thr_lookup_taddr(addr);
 		if (thr == NULL)
 			error("invalid thread address");

Modified: head/sys/amd64/include/param.h
==============================================================================
--- head/sys/amd64/include/param.h	Thu Jul  2 14:35:30 2015	(r285040)
+++ head/sys/amd64/include/param.h	Thu Jul  2 14:37:21 2015	(r285041)
@@ -149,4 +149,7 @@
 
 #define	pgtok(x)	((unsigned long)(x) * (PAGE_SIZE / 1024)) 
 
+#define	INKERNEL(va) (((va) >= DMAP_MIN_ADDRESS && (va) < DMAP_MAX_ADDRESS) \
+    || ((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS))
+
 #endif /* !_AMD64_INCLUDE_PARAM_H_ */

Modified: head/sys/amd64/include/pmc_mdep.h
==============================================================================
--- head/sys/amd64/include/pmc_mdep.h	Thu Jul  2 14:35:30 2015	(r285040)
+++ head/sys/amd64/include/pmc_mdep.h	Thu Jul  2 14:37:21 2015	(r285041)
@@ -113,9 +113,7 @@ union pmc_md_pmc {
 
 #define	PMC_IN_KERNEL_STACK(S,START,END)		\
 	((S) >= (START) && (S) < (END))
-#define	PMC_IN_KERNEL(va) (((va) >= DMAP_MIN_ADDRESS &&			\
-	(va) < DMAP_MAX_ADDRESS) || ((va) >= VM_MIN_KERNEL_ADDRESS &&	\
-	(va) < VM_MAX_KERNEL_ADDRESS))
+#define	PMC_IN_KERNEL(va) INKERNEL(va)
 
 #define	PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)
 

Modified: head/sys/amd64/include/stack.h
==============================================================================
--- head/sys/amd64/include/stack.h	Thu Jul  2 14:35:30 2015	(r285040)
+++ head/sys/amd64/include/stack.h	Thu Jul  2 14:37:21 2015	(r285041)
@@ -32,8 +32,6 @@
 /*
  * Stack trace.
  */
-#define	INKERNEL(va) (((va) >= DMAP_MIN_ADDRESS && (va) < DMAP_MAX_ADDRESS) \
-	    || ((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS))
 
 struct amd64_frame {
 	struct amd64_frame	*f_frame;

Modified: head/sys/cddl/dev/dtrace/i386/dtrace_isa.c
==============================================================================
--- head/sys/cddl/dev/dtrace/i386/dtrace_isa.c	Thu Jul  2 14:35:30 2015	(r285040)
+++ head/sys/cddl/dev/dtrace/i386/dtrace_isa.c	Thu Jul  2 14:37:21 2015	(r285041)
@@ -47,9 +47,6 @@
 extern uintptr_t kernbase;
 uintptr_t kernelbase = (uintptr_t) &kernbase;
 
-#define INKERNEL(va) (((vm_offset_t)(va)) >= USRSTACK && \
-	 ((vm_offset_t)(va)) < VM_MAX_KERNEL_ADDRESS)
-
 uint8_t dtrace_fuword8_nocheck(void *);
 uint16_t dtrace_fuword16_nocheck(void *);
 uint32_t dtrace_fuword32_nocheck(void *);

Modified: head/sys/i386/include/param.h
==============================================================================
--- head/sys/i386/include/param.h	Thu Jul  2 14:35:30 2015	(r285040)
+++ head/sys/i386/include/param.h	Thu Jul  2 14:37:21 2015	(r285041)
@@ -157,4 +157,7 @@
 
 #define	pgtok(x)		((x) * (PAGE_SIZE / 1024))
 
+#define INKERNEL(va)	(((vm_offset_t)(va)) >= VM_MAXUSER_ADDRESS && \
+    ((vm_offset_t)(va)) < VM_MAX_KERNEL_ADDRESS)
+
 #endif /* !_I386_INCLUDE_PARAM_H_ */

Modified: head/sys/i386/include/pmc_mdep.h
==============================================================================
--- head/sys/i386/include/pmc_mdep.h	Thu Jul  2 14:35:30 2015	(r285040)
+++ head/sys/i386/include/pmc_mdep.h	Thu Jul  2 14:37:21 2015	(r285041)
@@ -138,8 +138,7 @@ struct pmc_mdep;
 
 #define	PMC_IN_KERNEL_STACK(S,START,END)		\
 	((S) >= (START) && (S) < (END))
-#define	PMC_IN_KERNEL(va) (((va) >= USRSTACK) &&	\
-	((va) < VM_MAX_KERNEL_ADDRESS))
+#define	PMC_IN_KERNEL(va)	INKERNEL(va)
 
 #define	PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)
 

Modified: head/sys/i386/include/stack.h
==============================================================================
--- head/sys/i386/include/stack.h	Thu Jul  2 14:35:30 2015	(r285040)
+++ head/sys/i386/include/stack.h	Thu Jul  2 14:37:21 2015	(r285041)
@@ -32,8 +32,6 @@
 /*
  * Stack trace.
  */
-#define INKERNEL(va)	(((vm_offset_t)(va)) >= USRSTACK && \
-	    ((vm_offset_t)(va)) < VM_MAX_KERNEL_ADDRESS)
 
 struct i386_frame {
 	struct i386_frame	*f_frame;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507021437.t62EbL35082279>