From owner-svn-src-all@freebsd.org Thu Jul 2 14:37:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15137993EF9; Thu, 2 Jul 2015 14:37:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED5812603; Thu, 2 Jul 2015 14:37:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t62EbNgi082289; Thu, 2 Jul 2015 14:37:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t62EbL35082279; Thu, 2 Jul 2015 14:37:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507021437.t62EbL35082279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 2 Jul 2015 14:37:21 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2015 14:37:24 -0000 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;