aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/Kbuild.asm4
-rw-r--r--include/asm-generic/atomic.h2
-rw-r--r--include/asm-generic/bug.h25
-rw-r--r--include/asm-generic/dma-coherent.h32
-rw-r--r--include/asm-generic/dma-mapping-broken.h2
-rw-r--r--include/asm-generic/dma-mapping.h4
-rw-r--r--include/asm-generic/gpio.h44
-rw-r--r--include/asm-generic/int-ll64.h2
-rw-r--r--include/asm-generic/ioctl.h4
-rw-r--r--include/asm-generic/pci-dma-compat.h4
-rw-r--r--include/asm-generic/pgtable-nopmd.h6
-rw-r--r--include/asm-generic/pgtable.h57
-rw-r--r--include/asm-generic/rtc.h12
-rw-r--r--include/asm-generic/syscall.h141
-rw-r--r--include/asm-generic/topology.h3
-rw-r--r--include/asm-generic/vmlinux.lds.h47
16 files changed, 361 insertions, 28 deletions
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 92a6d91d0c1a..1170dc60e638 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -1,6 +1,8 @@
1ifneq ($(wildcard $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
1header-y += kvm.h 2header-y += kvm.h
3endif
2 4
3ifeq ($(wildcard include/asm-$(SRCARCH)/a.out.h),include/asm-$(SRCARCH)/a.out.h) 5ifneq ($(wildcard $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
4unifdef-y += a.out.h 6unifdef-y += a.out.h
5endif 7endif
6unifdef-y += auxvec.h 8unifdef-y += auxvec.h
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 85fd0aa27a8c..4ec0a296bdec 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -2,7 +2,7 @@
2#define _ASM_GENERIC_ATOMIC_H 2#define _ASM_GENERIC_ATOMIC_H
3/* 3/*
4 * Copyright (C) 2005 Silicon Graphics, Inc. 4 * Copyright (C) 2005 Silicon Graphics, Inc.
5 * Christoph Lameter <clameter@sgi.com> 5 * Christoph Lameter
6 * 6 *
7 * Allows to provide arch independent atomic definitions without the need to 7 * Allows to provide arch independent atomic definitions without the need to
8 * edit all arch specific atomic.h files. 8 * edit all arch specific atomic.h files.
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 2632328d8646..a3f738cffdb6 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -34,9 +34,14 @@ struct bug_entry {
34#ifndef __WARN 34#ifndef __WARN
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36extern void warn_on_slowpath(const char *file, const int line); 36extern void warn_on_slowpath(const char *file, const int line);
37extern void warn_slowpath(const char *file, const int line,
38 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
37#define WANT_WARN_ON_SLOWPATH 39#define WANT_WARN_ON_SLOWPATH
38#endif 40#endif
39#define __WARN() warn_on_slowpath(__FILE__, __LINE__) 41#define __WARN() warn_on_slowpath(__FILE__, __LINE__)
42#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg)
43#else
44#define __WARN_printf(arg...) __WARN()
40#endif 45#endif
41 46
42#ifndef WARN_ON 47#ifndef WARN_ON
@@ -48,6 +53,15 @@ extern void warn_on_slowpath(const char *file, const int line);
48}) 53})
49#endif 54#endif
50 55
56#ifndef WARN
57#define WARN(condition, format...) ({ \
58 int __ret_warn_on = !!(condition); \
59 if (unlikely(__ret_warn_on)) \
60 __WARN_printf(format); \
61 unlikely(__ret_warn_on); \
62})
63#endif
64
51#else /* !CONFIG_BUG */ 65#else /* !CONFIG_BUG */
52#ifndef HAVE_ARCH_BUG 66#ifndef HAVE_ARCH_BUG
53#define BUG() 67#define BUG()
@@ -63,6 +77,14 @@ extern void warn_on_slowpath(const char *file, const int line);
63 unlikely(__ret_warn_on); \ 77 unlikely(__ret_warn_on); \
64}) 78})
65#endif 79#endif
80
81#ifndef WARN
82#define WARN(condition, format...) ({ \
83 int __ret_warn_on = !!(condition); \
84 unlikely(__ret_warn_on); \
85})
86#endif
87
66#endif 88#endif
67 89
68#define WARN_ON_ONCE(condition) ({ \ 90#define WARN_ON_ONCE(condition) ({ \
@@ -75,6 +97,9 @@ extern void warn_on_slowpath(const char *file, const int line);
75 unlikely(__ret_warn_once); \ 97 unlikely(__ret_warn_once); \
76}) 98})
77 99
100#define WARN_ON_RATELIMIT(condition, state) \
101 WARN_ON((condition) && __ratelimit(state))
102
78#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
79# define WARN_ON_SMP(x) WARN_ON(x) 104# define WARN_ON_SMP(x) WARN_ON(x)
80#else 105#else
diff --git a/include/asm-generic/dma-coherent.h b/include/asm-generic/dma-coherent.h
new file mode 100644
index 000000000000..85a3ffaa0242
--- /dev/null
+++ b/include/asm-generic/dma-coherent.h
@@ -0,0 +1,32 @@
1#ifndef DMA_COHERENT_H
2#define DMA_COHERENT_H
3
4#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
5/*
6 * These two functions are only for dma allocator.
7 * Don't use them in device drivers.
8 */
9int dma_alloc_from_coherent(struct device *dev, ssize_t size,
10 dma_addr_t *dma_handle, void **ret);
11int dma_release_from_coherent(struct device *dev, int order, void *vaddr);
12
13/*
14 * Standard interface
15 */
16#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
17extern int
18dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
19 dma_addr_t device_addr, size_t size, int flags);
20
21extern void
22dma_release_declared_memory(struct device *dev);
23
24extern void *
25dma_mark_declared_memory_occupied(struct device *dev,
26 dma_addr_t device_addr, size_t size);
27#else
28#define dma_alloc_from_coherent(dev, size, handle, ret) (0)
29#define dma_release_from_coherent(dev, order, vaddr) (0)
30#endif
31
32#endif
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h
index e2468f894d2a..82cd0cb1c3fe 100644
--- a/include/asm-generic/dma-mapping-broken.h
+++ b/include/asm-generic/dma-mapping-broken.h
@@ -61,7 +61,7 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
61#define dma_sync_sg_for_device dma_sync_sg_for_cpu 61#define dma_sync_sg_for_device dma_sync_sg_for_cpu
62 62
63extern int 63extern int
64dma_mapping_error(dma_addr_t dma_addr); 64dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
65 65
66extern int 66extern int
67dma_supported(struct device *dev, u64 mask); 67dma_supported(struct device *dev, u64 mask);
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 783ab9944d70..189486c3f92e 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -144,9 +144,9 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
144} 144}
145 145
146static inline int 146static inline int
147dma_mapping_error(dma_addr_t dma_addr) 147dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
148{ 148{
149 return pci_dma_mapping_error(dma_addr); 149 return pci_dma_mapping_error(to_pci_dev(dev), dma_addr);
150} 150}
151 151
152 152
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index ecf675a59d21..0f99ad38b012 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -1,7 +1,12 @@
1#ifndef _ASM_GENERIC_GPIO_H 1#ifndef _ASM_GENERIC_GPIO_H
2#define _ASM_GENERIC_GPIO_H 2#define _ASM_GENERIC_GPIO_H
3 3
4#ifdef CONFIG_HAVE_GPIO_LIB 4#include <linux/types.h>
5#include <linux/errno.h>
6
7#ifdef CONFIG_GPIOLIB
8
9#include <linux/compiler.h>
5 10
6/* Platforms may implement their GPIO interface with library code, 11/* Platforms may implement their GPIO interface with library code,
7 * at a small performance cost for non-inlined operations and some 12 * at a small performance cost for non-inlined operations and some
@@ -9,7 +14,7 @@
9 * 14 *
10 * While the GPIO programming interface defines valid GPIO numbers 15 * While the GPIO programming interface defines valid GPIO numbers
11 * to be in the range 0..MAX_INT, this library restricts them to the 16 * to be in the range 0..MAX_INT, this library restricts them to the
12 * smaller range 0..ARCH_NR_GPIOS. 17 * smaller range 0..ARCH_NR_GPIOS-1.
13 */ 18 */
14 19
15#ifndef ARCH_NR_GPIOS 20#ifndef ARCH_NR_GPIOS
@@ -28,6 +33,8 @@ struct module;
28/** 33/**
29 * struct gpio_chip - abstract a GPIO controller 34 * struct gpio_chip - abstract a GPIO controller
30 * @label: for diagnostics 35 * @label: for diagnostics
36 * @dev: optional device providing the GPIOs
37 * @owner: helps prevent removal of modules exporting active GPIOs
31 * @direction_input: configures signal "offset" as input, or returns error 38 * @direction_input: configures signal "offset" as input, or returns error
32 * @get: returns value for signal "offset"; for output signals this 39 * @get: returns value for signal "offset"; for output signals this
33 * returns either the value actually sensed, or zero 40 * returns either the value actually sensed, or zero
@@ -55,6 +62,7 @@ struct module;
55 */ 62 */
56struct gpio_chip { 63struct gpio_chip {
57 char *label; 64 char *label;
65 struct device *dev;
58 struct module *owner; 66 struct module *owner;
59 67
60 int (*direction_input)(struct gpio_chip *chip, 68 int (*direction_input)(struct gpio_chip *chip,
@@ -70,11 +78,12 @@ struct gpio_chip {
70 int base; 78 int base;
71 u16 ngpio; 79 u16 ngpio;
72 unsigned can_sleep:1; 80 unsigned can_sleep:1;
81 unsigned exported:1;
73}; 82};
74 83
75extern const char *gpiochip_is_requested(struct gpio_chip *chip, 84extern const char *gpiochip_is_requested(struct gpio_chip *chip,
76 unsigned offset); 85 unsigned offset);
77extern int __init __must_check gpiochip_reserve(int start, int ngpio); 86extern int __must_check gpiochip_reserve(int start, int ngpio);
78 87
79/* add/remove chips */ 88/* add/remove chips */
80extern int gpiochip_add(struct gpio_chip *chip); 89extern int gpiochip_add(struct gpio_chip *chip);
@@ -104,7 +113,18 @@ extern void __gpio_set_value(unsigned gpio, int value);
104extern int __gpio_cansleep(unsigned gpio); 113extern int __gpio_cansleep(unsigned gpio);
105 114
106 115
107#else 116#ifdef CONFIG_GPIO_SYSFS
117
118/*
119 * A sysfs interface can be exported by individual drivers if they want,
120 * but more typically is configured entirely from userspace.
121 */
122extern int gpio_export(unsigned gpio, bool direction_may_change);
123extern void gpio_unexport(unsigned gpio);
124
125#endif /* CONFIG_GPIO_SYSFS */
126
127#else /* !CONFIG_HAVE_GPIO_LIB */
108 128
109static inline int gpio_is_valid(int number) 129static inline int gpio_is_valid(int number)
110{ 130{
@@ -133,6 +153,20 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
133 gpio_set_value(gpio, value); 153 gpio_set_value(gpio, value);
134} 154}
135 155
136#endif 156#endif /* !CONFIG_HAVE_GPIO_LIB */
157
158#ifndef CONFIG_GPIO_SYSFS
159
160/* sysfs support is only available with gpiolib, where it's optional */
161
162static inline int gpio_export(unsigned gpio, bool direction_may_change)
163{
164 return -ENOSYS;
165}
166
167static inline void gpio_unexport(unsigned gpio)
168{
169}
170#endif /* CONFIG_GPIO_SYSFS */
137 171
138#endif /* _ASM_GENERIC_GPIO_H */ 172#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h
index 260948905e4e..f9bc9ac29b36 100644
--- a/include/asm-generic/int-ll64.h
+++ b/include/asm-generic/int-ll64.h
@@ -26,7 +26,7 @@ typedef unsigned int __u32;
26#ifdef __GNUC__ 26#ifdef __GNUC__
27__extension__ typedef __signed__ long long __s64; 27__extension__ typedef __signed__ long long __s64;
28__extension__ typedef unsigned long long __u64; 28__extension__ typedef unsigned long long __u64;
29#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 29#else
30typedef __signed__ long long __s64; 30typedef __signed__ long long __s64;
31typedef unsigned long long __u64; 31typedef unsigned long long __u64;
32#endif 32#endif
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
index 864181385579..15828b2d663c 100644
--- a/include/asm-generic/ioctl.h
+++ b/include/asm-generic/ioctl.h
@@ -68,12 +68,16 @@
68 ((nr) << _IOC_NRSHIFT) | \ 68 ((nr) << _IOC_NRSHIFT) | \
69 ((size) << _IOC_SIZESHIFT)) 69 ((size) << _IOC_SIZESHIFT))
70 70
71#ifdef __KERNEL__
71/* provoke compile error for invalid uses of size argument */ 72/* provoke compile error for invalid uses of size argument */
72extern unsigned int __invalid_size_argument_for_IOC; 73extern unsigned int __invalid_size_argument_for_IOC;
73#define _IOC_TYPECHECK(t) \ 74#define _IOC_TYPECHECK(t) \
74 ((sizeof(t) == sizeof(t[1]) && \ 75 ((sizeof(t) == sizeof(t[1]) && \
75 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ 76 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
76 sizeof(t) : __invalid_size_argument_for_IOC) 77 sizeof(t) : __invalid_size_argument_for_IOC)
78#else
79#define _IOC_TYPECHECK(t) (sizeof(t))
80#endif
77 81
78/* used to create numbers */ 82/* used to create numbers */
79#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) 83#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h
index 25c10e96b2b7..37b3706226e7 100644
--- a/include/asm-generic/pci-dma-compat.h
+++ b/include/asm-generic/pci-dma-compat.h
@@ -99,9 +99,9 @@ pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
99} 99}
100 100
101static inline int 101static inline int
102pci_dma_mapping_error(dma_addr_t dma_addr) 102pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
103{ 103{
104 return dma_mapping_error(dma_addr); 104 return dma_mapping_error(&pdev->dev, dma_addr);
105} 105}
106 106
107#endif 107#endif
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index 087325ede76c..a7cdc48e8b78 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -5,6 +5,8 @@
5 5
6#include <asm-generic/pgtable-nopud.h> 6#include <asm-generic/pgtable-nopud.h>
7 7
8struct mm_struct;
9
8#define __PAGETABLE_PMD_FOLDED 10#define __PAGETABLE_PMD_FOLDED
9 11
10/* 12/*
@@ -54,7 +56,9 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
54 * inside the pud, so has no extra memory associated with it. 56 * inside the pud, so has no extra memory associated with it.
55 */ 57 */
56#define pmd_alloc_one(mm, address) NULL 58#define pmd_alloc_one(mm, address) NULL
57#define pmd_free(mm, x) do { } while (0) 59static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
60{
61}
58#define __pmd_free_tlb(tlb, x) do { } while (0) 62#define __pmd_free_tlb(tlb, x) do { } while (0)
59 63
60#undef pmd_addr_end 64#undef pmd_addr_end
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 44ef329531c3..ef87f889ef62 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -195,6 +195,63 @@ static inline int pmd_none_or_clear_bad(pmd_t *pmd)
195 } 195 }
196 return 0; 196 return 0;
197} 197}
198
199static inline pte_t __ptep_modify_prot_start(struct mm_struct *mm,
200 unsigned long addr,
201 pte_t *ptep)
202{
203 /*
204 * Get the current pte state, but zero it out to make it
205 * non-present, preventing the hardware from asynchronously
206 * updating it.
207 */
208 return ptep_get_and_clear(mm, addr, ptep);
209}
210
211static inline void __ptep_modify_prot_commit(struct mm_struct *mm,
212 unsigned long addr,
213 pte_t *ptep, pte_t pte)
214{
215 /*
216 * The pte is non-present, so there's no hardware state to
217 * preserve.
218 */
219 set_pte_at(mm, addr, ptep, pte);
220}
221
222#ifndef __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION
223/*
224 * Start a pte protection read-modify-write transaction, which
225 * protects against asynchronous hardware modifications to the pte.
226 * The intention is not to prevent the hardware from making pte
227 * updates, but to prevent any updates it may make from being lost.
228 *
229 * This does not protect against other software modifications of the
230 * pte; the appropriate pte lock must be held over the transation.
231 *
232 * Note that this interface is intended to be batchable, meaning that
233 * ptep_modify_prot_commit may not actually update the pte, but merely
234 * queue the update to be done at some later time. The update must be
235 * actually committed before the pte lock is released, however.
236 */
237static inline pte_t ptep_modify_prot_start(struct mm_struct *mm,
238 unsigned long addr,
239 pte_t *ptep)
240{
241 return __ptep_modify_prot_start(mm, addr, ptep);
242}
243
244/*
245 * Commit an update to a pte, leaving any hardware-controlled bits in
246 * the PTE unmodified.
247 */
248static inline void ptep_modify_prot_commit(struct mm_struct *mm,
249 unsigned long addr,
250 pte_t *ptep, pte_t pte)
251{
252 __ptep_modify_prot_commit(mm, addr, ptep, pte);
253}
254#endif /* __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION */
198#endif /* CONFIG_MMU */ 255#endif /* CONFIG_MMU */
199 256
200/* 257/*
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index be4af0029ac0..71ef3f0b9685 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -15,6 +15,7 @@
15#include <linux/mc146818rtc.h> 15#include <linux/mc146818rtc.h>
16#include <linux/rtc.h> 16#include <linux/rtc.h>
17#include <linux/bcd.h> 17#include <linux/bcd.h>
18#include <linux/delay.h>
18 19
19#define RTC_PIE 0x40 /* periodic interrupt enable */ 20#define RTC_PIE 0x40 /* periodic interrupt enable */
20#define RTC_AIE 0x20 /* alarm interrupt enable */ 21#define RTC_AIE 0x20 /* alarm interrupt enable */
@@ -43,7 +44,6 @@ static inline unsigned char rtc_is_updating(void)
43 44
44static inline unsigned int get_rtc_time(struct rtc_time *time) 45static inline unsigned int get_rtc_time(struct rtc_time *time)
45{ 46{
46 unsigned long uip_watchdog = jiffies;
47 unsigned char ctrl; 47 unsigned char ctrl;
48 unsigned long flags; 48 unsigned long flags;
49 49
@@ -53,19 +53,15 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
53 53
54 /* 54 /*
55 * read RTC once any update in progress is done. The update 55 * read RTC once any update in progress is done. The update
56 * can take just over 2ms. We wait 10 to 20ms. There is no need to 56 * can take just over 2ms. We wait 20ms. There is no need to
57 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. 57 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
58 * If you need to know *exactly* when a second has started, enable 58 * If you need to know *exactly* when a second has started, enable
59 * periodic update complete interrupts, (via ioctl) and then 59 * periodic update complete interrupts, (via ioctl) and then
60 * immediately read /dev/rtc which will block until you get the IRQ. 60 * immediately read /dev/rtc which will block until you get the IRQ.
61 * Once the read clears, read the RTC time (again via ioctl). Easy. 61 * Once the read clears, read the RTC time (again via ioctl). Easy.
62 */ 62 */
63 63 if (rtc_is_updating())
64 if (rtc_is_updating() != 0) 64 mdelay(20);
65 while (jiffies - uip_watchdog < 2*HZ/100) {
66 barrier();
67 cpu_relax();
68 }
69 65
70 /* 66 /*
71 * Only the values that we read from the RTC are set. We leave 67 * Only the values that we read from the RTC are set. We leave
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
new file mode 100644
index 000000000000..abcf34c2fdc7
--- /dev/null
+++ b/include/asm-generic/syscall.h
@@ -0,0 +1,141 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * This file is a stub providing documentation for what functions
11 * asm-ARCH/syscall.h files need to define. Most arch definitions
12 * will be simple inlines.
13 *
14 * All of these functions expect to be called with no locks,
15 * and only when the caller is sure that the task of interest
16 * cannot return to user mode while we are looking at it.
17 */
18
19#ifndef _ASM_SYSCALL_H
20#define _ASM_SYSCALL_H 1
21
22struct task_struct;
23struct pt_regs;
24
25/**
26 * syscall_get_nr - find what system call a task is executing
27 * @task: task of interest, must be blocked
28 * @regs: task_pt_regs() of @task
29 *
30 * If @task is executing a system call or is at system call
31 * tracing about to attempt one, returns the system call number.
32 * If @task is not executing a system call, i.e. it's blocked
33 * inside the kernel for a fault or signal, returns -1.
34 *
35 * It's only valid to call this when @task is known to be blocked.
36 */
37long syscall_get_nr(struct task_struct *task, struct pt_regs *regs);
38
39/**
40 * syscall_rollback - roll back registers after an aborted system call
41 * @task: task of interest, must be in system call exit tracing
42 * @regs: task_pt_regs() of @task
43 *
44 * It's only valid to call this when @task is stopped for system
45 * call exit tracing (due to TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT),
46 * after tracehook_report_syscall_entry() returned nonzero to prevent
47 * the system call from taking place.
48 *
49 * This rolls back the register state in @regs so it's as if the
50 * system call instruction was a no-op. The registers containing
51 * the system call number and arguments are as they were before the
52 * system call instruction. This may not be the same as what the
53 * register state looked like at system call entry tracing.
54 */
55void syscall_rollback(struct task_struct *task, struct pt_regs *regs);
56
57/**
58 * syscall_get_error - check result of traced system call
59 * @task: task of interest, must be blocked
60 * @regs: task_pt_regs() of @task
61 *
62 * Returns 0 if the system call succeeded, or -ERRORCODE if it failed.
63 *
64 * It's only valid to call this when @task is stopped for tracing on exit
65 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
66 */
67long syscall_get_error(struct task_struct *task, struct pt_regs *regs);
68
69/**
70 * syscall_get_return_value - get the return value of a traced system call
71 * @task: task of interest, must be blocked
72 * @regs: task_pt_regs() of @task
73 *
74 * Returns the return value of the successful system call.
75 * This value is meaningless if syscall_get_error() returned nonzero.
76 *
77 * It's only valid to call this when @task is stopped for tracing on exit
78 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
79 */
80long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs);
81
82/**
83 * syscall_set_return_value - change the return value of a traced system call
84 * @task: task of interest, must be blocked
85 * @regs: task_pt_regs() of @task
86 * @error: negative error code, or zero to indicate success
87 * @val: user return value if @error is zero
88 *
89 * This changes the results of the system call that user mode will see.
90 * If @error is zero, the user sees a successful system call with a
91 * return value of @val. If @error is nonzero, it's a negated errno
92 * code; the user sees a failed system call with this errno code.
93 *
94 * It's only valid to call this when @task is stopped for tracing on exit
95 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
96 */
97void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
98 int error, long val);
99
100/**
101 * syscall_get_arguments - extract system call parameter values
102 * @task: task of interest, must be blocked
103 * @regs: task_pt_regs() of @task
104 * @i: argument index [0,5]
105 * @n: number of arguments; n+i must be [1,6].
106 * @args: array filled with argument values
107 *
108 * Fetches @n arguments to the system call starting with the @i'th argument
109 * (from 0 through 5). Argument @i is stored in @args[0], and so on.
110 * An arch inline version is probably optimal when @i and @n are constants.
111 *
112 * It's only valid to call this when @task is stopped for tracing on
113 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
114 * It's invalid to call this with @i + @n > 6; we only support system calls
115 * taking up to 6 arguments.
116 */
117void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
118 unsigned int i, unsigned int n, unsigned long *args);
119
120/**
121 * syscall_set_arguments - change system call parameter value
122 * @task: task of interest, must be in system call entry tracing
123 * @regs: task_pt_regs() of @task
124 * @i: argument index [0,5]
125 * @n: number of arguments; n+i must be [1,6].
126 * @args: array of argument values to store
127 *
128 * Changes @n arguments to the system call starting with the @i'th argument.
129 * @n'th argument to @val. Argument @i gets value @args[0], and so on.
130 * An arch inline version is probably optimal when @i and @n are constants.
131 *
132 * It's only valid to call this when @task is stopped for tracing on
133 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
134 * It's invalid to call this with @i + @n > 6; we only support system calls
135 * taking up to 6 arguments.
136 */
137void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
138 unsigned int i, unsigned int n,
139 const unsigned long *args);
140
141#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index a6aea79bca4f..54bbf6e04ee8 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -60,7 +60,8 @@
60#ifndef node_to_cpumask_ptr 60#ifndef node_to_cpumask_ptr
61 61
62#define node_to_cpumask_ptr(v, node) \ 62#define node_to_cpumask_ptr(v, node) \
63 cpumask_t _##v = node_to_cpumask(node), *v = &_##v 63 cpumask_t _##v = node_to_cpumask(node); \
64 const cpumask_t *v = &_##v
64 65
65#define node_to_cpumask_ptr_next(v, node) \ 66#define node_to_cpumask_ptr_next(v, node) \
66 _##v = node_to_cpumask(node) 67 _##v = node_to_cpumask(node)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 69e5c1182fde..7440a0dceddb 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -67,6 +67,8 @@
67 *(.rodata1) \ 67 *(.rodata1) \
68 } \ 68 } \
69 \ 69 \
70 BUG_TABLE \
71 \
70 /* PCI quirks */ \ 72 /* PCI quirks */ \
71 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ 73 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
72 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \ 74 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
@@ -84,6 +86,19 @@
84 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \ 86 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
85 *(.pci_fixup_resume) \ 87 *(.pci_fixup_resume) \
86 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ 88 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
89 VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
90 *(.pci_fixup_resume_early) \
91 VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
92 VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
93 *(.pci_fixup_suspend) \
94 VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
95 } \
96 \
97 /* Built-in firmware blobs */ \
98 .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
99 VMLINUX_SYMBOL(__start_builtin_fw) = .; \
100 *(.builtin_fw) \
101 VMLINUX_SYMBOL(__end_builtin_fw) = .; \
87 } \ 102 } \
88 \ 103 \
89 /* RapidIO route ops */ \ 104 /* RapidIO route ops */ \
@@ -93,6 +108,8 @@
93 VMLINUX_SYMBOL(__end_rio_route_ops) = .; \ 108 VMLINUX_SYMBOL(__end_rio_route_ops) = .; \
94 } \ 109 } \
95 \ 110 \
111 TRACEDATA \
112 \
96 /* Kernel symbol table: Normal symbols */ \ 113 /* Kernel symbol table: Normal symbols */ \
97 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ 114 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
98 VMLINUX_SYMBOL(__start___ksymtab) = .; \ 115 VMLINUX_SYMBOL(__start___ksymtab) = .; \
@@ -204,6 +221,7 @@
204 * during second ld run in second ld pass when generating System.map */ 221 * during second ld run in second ld pass when generating System.map */
205#define TEXT_TEXT \ 222#define TEXT_TEXT \
206 ALIGN_FUNCTION(); \ 223 ALIGN_FUNCTION(); \
224 *(.text.hot) \
207 *(.text) \ 225 *(.text) \
208 *(.ref.text) \ 226 *(.ref.text) \
209 *(.text.init.refok) \ 227 *(.text.init.refok) \
@@ -213,7 +231,8 @@
213 CPU_KEEP(init.text) \ 231 CPU_KEEP(init.text) \
214 CPU_KEEP(exit.text) \ 232 CPU_KEEP(exit.text) \
215 MEM_KEEP(init.text) \ 233 MEM_KEEP(init.text) \
216 MEM_KEEP(exit.text) 234 MEM_KEEP(exit.text) \
235 *(.text.unlikely)
217 236
218 237
219/* sched.text is aling to function alignment to secure we have same 238/* sched.text is aling to function alignment to secure we have same
@@ -310,13 +329,29 @@
310 .stab.indexstr 0 : { *(.stab.indexstr) } \ 329 .stab.indexstr 0 : { *(.stab.indexstr) } \
311 .comment 0 : { *(.comment) } 330 .comment 0 : { *(.comment) }
312 331
332#ifdef CONFIG_GENERIC_BUG
313#define BUG_TABLE \ 333#define BUG_TABLE \
314 . = ALIGN(8); \ 334 . = ALIGN(8); \
315 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ 335 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
316 __start___bug_table = .; \ 336 VMLINUX_SYMBOL(__start___bug_table) = .; \
317 *(__bug_table) \ 337 *(__bug_table) \
318 __stop___bug_table = .; \ 338 VMLINUX_SYMBOL(__stop___bug_table) = .; \
339 }
340#else
341#define BUG_TABLE
342#endif
343
344#ifdef CONFIG_PM_TRACE
345#define TRACEDATA \
346 . = ALIGN(4); \
347 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
348 VMLINUX_SYMBOL(__tracedata_start) = .; \
349 *(.tracedata) \
350 VMLINUX_SYMBOL(__tracedata_end) = .; \
319 } 351 }
352#else
353#define TRACEDATA
354#endif
320 355
321#define NOTES \ 356#define NOTES \
322 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ 357 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
@@ -326,6 +361,8 @@
326 } 361 }
327 362
328#define INITCALLS \ 363#define INITCALLS \
364 *(.initcallearly.init) \
365 VMLINUX_SYMBOL(__early_initcall_end) = .; \
329 *(.initcall0.init) \ 366 *(.initcall0.init) \
330 *(.initcall0s.init) \ 367 *(.initcall0s.init) \
331 *(.initcall1.init) \ 368 *(.initcall1.init) \
@@ -346,10 +383,10 @@
346 383
347#define PERCPU(align) \ 384#define PERCPU(align) \
348 . = ALIGN(align); \ 385 . = ALIGN(align); \
349 __per_cpu_start = .; \ 386 VMLINUX_SYMBOL(__per_cpu_start) = .; \
350 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ 387 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
351 *(.data.percpu.page_aligned) \ 388 *(.data.percpu.page_aligned) \
352 *(.data.percpu) \ 389 *(.data.percpu) \
353 *(.data.percpu.shared_aligned) \ 390 *(.data.percpu.shared_aligned) \
354 } \ 391 } \
355 __per_cpu_end = .; 392 VMLINUX_SYMBOL(__per_cpu_end) = .;