Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266160

[PATCH 13/14] Hide CONFIG_PHY_RAM_BASE_ADDRESS from userspace

From Palmer Dabbelt <palmer@dabbelt.com>
Newsgroups linux.kernel
Subject [PATCH 13/14] Hide CONFIG_PHY_RAM_BASE_ADDRESS from userspace
Date 2015-11-10 02:40 +0100
Message-ID <qt64H-6NO-45@gated-at.bofh.it> (permalink)
References <qqPKG-76u-7@gated-at.bofh.it> <qt64G-6NO-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This feels a bit odd, but I couldn't really come up with a better way to
do it.  There already appears to be a workaround for this macro not
being defined in userspace, so I figured I'd better leave that in place,
since someone is probably using it.

The result is that unless you include <asm/fixed_code.h> before
<uapi/asm/fixed_code.h> then you'll get the wrong offsets.  The only
user of <uapi/asm/fixed_code.h> is currently <asm/fixed_code.h>, so it's
at least safe for now.  There's a CPP error in there to check for this.
---
 arch/blackfin/include/asm/fixed_code.h      |  6 +++++
 arch/blackfin/include/uapi/asm/fixed_code.h | 35 ++++++++++++++++-------------
 2 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/arch/blackfin/include/asm/fixed_code.h b/arch/blackfin/include/asm/fixed_code.h
index bc330f0..7e03b9b 100644
--- a/arch/blackfin/include/asm/fixed_code.h
+++ b/arch/blackfin/include/asm/fixed_code.h
@@ -9,6 +9,12 @@
 #ifndef __BFIN_ASM_FIXED_CODE_H__
 #define __BFIN_ASM_FIXED_CODE_H__
 
+#ifdef CONFIG_PHY_RAM_BASE_ADDRESS
+#define CONFIG_PHY_RAM_BASE_ADDRESS 0x0
+#endif
+
+#define PHY_RAM_BASE_ADDRESS CONFIG_PHY_RAM_BASE_ADDRESS
+
 #include <uapi/asm/fixed_code.h>
 
 #ifndef __ASSEMBLY__
diff --git a/arch/blackfin/include/uapi/asm/fixed_code.h b/arch/blackfin/include/uapi/asm/fixed_code.h
index 3bef1dc..50b70a0 100644
--- a/arch/blackfin/include/uapi/asm/fixed_code.h
+++ b/arch/blackfin/include/uapi/asm/fixed_code.h
@@ -10,29 +10,32 @@
 #ifndef _UAPI__BFIN_ASM_FIXED_CODE_H__
 #define _UAPI__BFIN_ASM_FIXED_CODE_H__
 
-
-#ifndef CONFIG_PHY_RAM_BASE_ADDRESS
-#define CONFIG_PHY_RAM_BASE_ADDRESS	0x0
+#ifndef PHY_RAM_BASE_ADDRESS
+#ifdef __KERNEL__
+#error "Don't include <uapi/asm/fixed_code.h>, include <asm/fixed_code.h>"
+#else
+#define PHY_RAM_BASE_ADDRESS	0x0
+#endif
 #endif
 
-#define FIXED_CODE_START	(CONFIG_PHY_RAM_BASE_ADDRESS + 0x400)
+#define FIXED_CODE_START	(PHY_RAM_BASE_ADDRESS + 0x400)
 
-#define SIGRETURN_STUB		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x400)
+#define SIGRETURN_STUB		(PHY_RAM_BASE_ADDRESS + 0x400)
 
-#define ATOMIC_SEQS_START	(CONFIG_PHY_RAM_BASE_ADDRESS + 0x410)
+#define ATOMIC_SEQS_START	(PHY_RAM_BASE_ADDRESS + 0x410)
 
-#define ATOMIC_XCHG32		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x410)
-#define ATOMIC_CAS32		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x420)
-#define ATOMIC_ADD32		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x430)
-#define ATOMIC_SUB32		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x440)
-#define ATOMIC_IOR32		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x450)
-#define ATOMIC_AND32		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x460)
-#define ATOMIC_XOR32		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x470)
+#define ATOMIC_XCHG32		(PHY_RAM_BASE_ADDRESS + 0x410)
+#define ATOMIC_CAS32		(PHY_RAM_BASE_ADDRESS + 0x420)
+#define ATOMIC_ADD32		(PHY_RAM_BASE_ADDRESS + 0x430)
+#define ATOMIC_SUB32		(PHY_RAM_BASE_ADDRESS + 0x440)
+#define ATOMIC_IOR32		(PHY_RAM_BASE_ADDRESS + 0x450)
+#define ATOMIC_AND32		(PHY_RAM_BASE_ADDRESS + 0x460)
+#define ATOMIC_XOR32		(PHY_RAM_BASE_ADDRESS + 0x470)
 
-#define ATOMIC_SEQS_END		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x480)
+#define ATOMIC_SEQS_END		(PHY_RAM_BASE_ADDRESS + 0x480)
 
-#define SAFE_USER_INSTRUCTION   (CONFIG_PHY_RAM_BASE_ADDRESS + 0x480)
+#define SAFE_USER_INSTRUCTION   (PHY_RAM_BASE_ADDRESS + 0x480)
 
-#define FIXED_CODE_END		(CONFIG_PHY_RAM_BASE_ADDRESS + 0x490)
+#define FIXED_CODE_END		(PHY_RAM_BASE_ADDRESS + 0x490)
 
 #endif /* _UAPI__BFIN_ASM_FIXED_CODE_H__ */
-- 
2.4.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4] Remove #ifdef CONFIG_* from all userspace headers Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
  [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
    Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c kbuild test robot <lkp@intel.com> - 2015-11-03 22:30 +0100
    Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c kbuild test robot <lkp@intel.com> - 2015-11-03 22:40 +0100
    Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Peter Zijlstra <peterz@infradead.org> - 2015-11-04 12:50 +0100
      Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Peter Zijlstra <peterz@infradead.org> - 2015-11-04 13:30 +0100
        Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-07 07:50 +0100
  [PATCH 03/13] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
  [PATCH 11/13] Always define MAX_RAW_MINORS as 2**20 in userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
    Re: [PATCH 11/13] Always define MAX_RAW_MINORS as 2**20 in userspace kbuild test robot <lkp@intel.com> - 2015-11-03 21:20 +0100
  [PATCH 13/13] Re-enable and clean up "check_config()" in headers_check.pl Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
    Re: [PATCH 13/13] Re-enable and clean up "check_config()" in  headers_check.pl kbuild test robot <lkp@intel.com> - 2015-11-03 21:30 +0100
    Re: [PATCH 13/13] Re-enable and clean up "check_config()" in  headers_check.pl kbuild test robot <lkp@intel.com> - 2015-11-03 21:30 +0100
  [PATCH 07/13] Make FB_BACKLIGHT_{LEVELS,MAX} always visible Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
  [PATCH 02/13] Use sys_ni.c instead of #ifdef to disable fork on CONFIG_NOMMU Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
  [PATCH 01/13] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
  [PATCH 12/13] Remove AT_VECTOR_SIZE_ARCH on x86 Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
  [PATCH 08/13] Move MAX_SHARED_LIBS to fs/binfmt_flat.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
  [PATCH 06/13] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 21:00 +0100
  [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 21:00 +0100
  [PATCH 05/13] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 21:00 +0100
  [PATCH 10/14] Move USE_WCACHING to drivers/block/pktcdvd.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 07/14] Make FB_BACKLIGHT_{LEVELS,MAX} always visible Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 08/14] Move MAX_SHARED_LIBS to fs/binfmt_flat.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 05/14] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 02/14] Use sys_ni.c instead of #ifdef to disable fork on CONFIG_NOMMU Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 11/14] Always define MAX_RAW_MINORS as 2**20 in userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 09/14] Move bp_type_idx to include/linux/hw_breakpoint.h Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 04/14] Always expose MAP_UNINITIALIZED to userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 14/14] Re-enable and clean up "check_config()" in headers_check.pl Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 01/14] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 13/14] Hide CONFIG_PHY_RAM_BASE_ADDRESS from userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 12/14] Remove AT_VECTOR_SIZE_ARCH on x86 Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 03/14] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH 06/14] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
  [PATCH v5] Remove #ifdef CONFIG_* from all userspace headers Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100

csiph-web