aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2013-01-18 04:42:17 -0500
committerVineet Gupta <vgupta@synopsys.com>2013-02-11 09:30:34 -0500
commit3be80aaef861a60b85a9323462ebb5f623774f7a (patch)
treeb5224ff6c43f4a5787b72a18b83b6d4de7dbddf7
parentca15c8ecd588dda4377d18d6d27bc1e87b4177cb (diff)
ARC: Fundamental ARCH data-types/defines
* L1_CACHE_SHIFT * PAGE_SIZE, PAGE_OFFSET * struct pt_regs, struct user_regs_struct * struct thread_struct, cpu_relax(), task_pt_regs(), start_thread(), ... * struct thread_info, THREAD_SIZE, INIT_THREAD_INFO(), TIF_*, ... * BUG() * ELF_* * Elf_* To disallow user-space visibility into some of the core kernel data-types such as struct pt_regs, #ifdef __KERNEL__ which also makes the UAPI header spit (further patch in the series) to NOT export it to asm/uapi/ptrace.h Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Jonas Bonn <jonas.bonn@gmail.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Acked-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--arch/arc/include/asm/bug.h37
-rw-r--r--arch/arc/include/asm/cache.h21
-rw-r--r--arch/arc/include/asm/elf.h97
-rw-r--r--arch/arc/include/asm/exec.h15
-rw-r--r--arch/arc/include/asm/kdebug.h19
-rw-r--r--arch/arc/include/asm/linkage.h30
-rw-r--r--arch/arc/include/asm/module.h17
-rw-r--r--arch/arc/include/asm/page.h42
-rw-r--r--arch/arc/include/asm/processor.h143
-rw-r--r--arch/arc/include/asm/ptrace.h126
-rw-r--r--arch/arc/include/asm/sections.h17
-rw-r--r--arch/arc/include/asm/thread_info.h121
12 files changed, 685 insertions, 0 deletions
diff --git a/arch/arc/include/asm/bug.h b/arch/arc/include/asm/bug.h
new file mode 100644
index 000000000000..2ad8f9b1c54b
--- /dev/null
+++ b/arch/arc/include/asm/bug.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_ARC_BUG_H
10#define _ASM_ARC_BUG_H
11
12#ifndef __ASSEMBLY__
13
14#include <asm/ptrace.h>
15
16struct task_struct;
17
18void show_regs(struct pt_regs *regs);
19void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs);
20void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
21 unsigned long address, unsigned long cause_reg);
22void die(const char *str, struct pt_regs *regs, unsigned long address,
23 unsigned long cause_reg);
24
25#define BUG() do { \
26 dump_stack(); \
27 pr_warn("Kernel BUG in %s: %s: %d!\n", \
28 __FILE__, __func__, __LINE__); \
29} while (0)
30
31#define HAVE_ARCH_BUG
32
33#include <asm-generic/bug.h>
34
35#endif /* !__ASSEMBLY__ */
36
37#endif
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
new file mode 100644
index 000000000000..30c72a4d2d9f
--- /dev/null
+++ b/arch/arc/include/asm/cache.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ARC_ASM_CACHE_H
10#define __ARC_ASM_CACHE_H
11
12/* In case $$ not config, setup a dummy number for rest of kernel */
13#ifndef CONFIG_ARC_CACHE_LINE_SHIFT
14#define L1_CACHE_SHIFT 6
15#else
16#define L1_CACHE_SHIFT CONFIG_ARC_CACHE_LINE_SHIFT
17#endif
18
19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
20
21#endif /* _ASM_CACHE_H */
diff --git a/arch/arc/include/asm/elf.h b/arch/arc/include/asm/elf.h
new file mode 100644
index 000000000000..147284ff1f96
--- /dev/null
+++ b/arch/arc/include/asm/elf.h
@@ -0,0 +1,97 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARC_ELF_H
10#define __ASM_ARC_ELF_H
11
12#include <asm/ptrace.h>
13
14#define EM_ARCOMPACT 93
15
16/* Machine specific ELF Hdr flags */
17#define EF_ARC_OSABI_MSK 0x00000f00
18#define EF_ARC_OSABI_ORIG 0x00000000 /* MUST be zero for back-compat */
19#define EF_ARC_OSABI_V2 0x00000200
20
21/* ARC Relocations (kernel Modules only) */
22#define R_ARC_32 0x4
23#define R_ARC_32_ME 0x1B
24#define R_ARC_S25H_PCREL 0x10
25#define R_ARC_S25W_PCREL 0x11
26
27typedef unsigned long elf_greg_t;
28typedef unsigned long elf_fpregset_t;
29
30
31/* core dump regs is in the order pt_regs, callee_regs, stop_pc (for gdb) */
32#define ELF_NGREG ((sizeof(struct pt_regs) + sizeof(struct callee_regs) \
33 + sizeof(unsigned long)) / sizeof(elf_greg_t))
34
35typedef elf_greg_t elf_gregset_t[ELF_NGREG];
36
37/*
38 * To ensure that
39 * -we don't load something for the wrong architecture.
40 * -The userspace is using the correct syscall ABI
41 */
42struct elf32_hdr;
43extern int elf_check_arch(const struct elf32_hdr *);
44#define elf_check_arch elf_check_arch
45
46/*
47 * These are used to set parameters in the core dumps.
48 */
49#define ELF_ARCH EM_ARCOMPACT
50#define ELF_CLASS ELFCLASS32
51
52#ifdef CONFIG_CPU_BIG_ENDIAN
53#define ELF_DATA ELFDATA2MSB
54#else
55#define ELF_DATA ELFDATA2LSB
56#endif
57
58#ifdef __KERNEL__
59
60#define CORE_DUMP_USE_REGSET
61
62#define ELF_EXEC_PAGESIZE PAGE_SIZE
63
64/*
65 * This is the location that an ET_DYN program is loaded if exec'ed. Typical
66 * use of this is to invoke "./ld.so someprog" to test out a new version of
67 * the loader. We need to make sure that it is out of the way of the program
68 * that it will "exec", and that there is sufficient room for the brk.
69 */
70#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
71
72/*
73 * When the program starts, a1 contains a pointer to a function to be
74 * registered with atexit, as per the SVR4 ABI. A value of 0 means we
75 * have no such handler.
76 */
77#define ELF_PLAT_INIT(_r, load_addr) ((_r)->r0 = 0)
78
79/*
80 * This yields a mask that user programs can use to figure out what
81 * instruction set this cpu supports.
82 */
83#define ELF_HWCAP (0)
84
85/*
86 * This yields a string that ld.so will use to load implementation
87 * specific libraries for optimization. This is more specific in
88 * intent than poking at uname or /proc/cpuinfo.
89 */
90#define ELF_PLATFORM (NULL)
91
92#define SET_PERSONALITY(ex) \
93 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
94
95#endif /* __KERNEL__ */
96
97#endif
diff --git a/arch/arc/include/asm/exec.h b/arch/arc/include/asm/exec.h
new file mode 100644
index 000000000000..28abc6905e07
--- /dev/null
+++ b/arch/arc/include/asm/exec.h
@@ -0,0 +1,15 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARC_EXEC_H
10#define __ASM_ARC_EXEC_H
11
12/* Align to 16b */
13#define arch_align_stack(p) ((unsigned long)(p) & ~0xf)
14
15#endif
diff --git a/arch/arc/include/asm/kdebug.h b/arch/arc/include/asm/kdebug.h
new file mode 100644
index 000000000000..3fbe6c472c0a
--- /dev/null
+++ b/arch/arc/include/asm/kdebug.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_ARC_KDEBUG_H
10#define _ASM_ARC_KDEBUG_H
11
12enum die_val {
13 DIE_UNUSED,
14 DIE_TRAP,
15 DIE_IERR,
16 DIE_OOPS
17};
18
19#endif
diff --git a/arch/arc/include/asm/linkage.h b/arch/arc/include/asm/linkage.h
new file mode 100644
index 000000000000..a45d1bb50e41
--- /dev/null
+++ b/arch/arc/include/asm/linkage.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_LINKAGE_H
10#define __ASM_LINKAGE_H
11
12#ifdef __ASSEMBLY__
13
14/* Can't use the ENTRY macro in linux/linkage.h
15 * gas considers ';' as comment vs. newline
16 */
17.macro ARC_ENTRY name
18 .global \name
19 .align 4
20 \name:
21.endm
22
23.macro ARC_EXIT name
24#define ASM_PREV_SYM_ADDR(name) .-##name
25 .size \ name, ASM_PREV_SYM_ADDR(\name)
26.endm
27
28#endif /* __ASSEMBLY__ */
29
30#endif
diff --git a/arch/arc/include/asm/module.h b/arch/arc/include/asm/module.h
new file mode 100644
index 000000000000..165d768d00cf
--- /dev/null
+++ b/arch/arc/include/asm/module.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
9
10 */
11
12#ifndef _ASM_ARC_MODULE_H
13#define _ASM_ARC_MODULE_H
14
15#include <asm-generic/module.h>
16
17#endif /* _ASM_ARC_MODULE_H */
diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h
new file mode 100644
index 000000000000..7cd1224d8e7d
--- /dev/null
+++ b/arch/arc/include/asm/page.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARC_PAGE_H
10#define __ASM_ARC_PAGE_H
11
12/* PAGE_SHIFT determines the page size */
13#if defined(CONFIG_ARC_PAGE_SIZE_16K)
14#define PAGE_SHIFT 14
15#elif defined(CONFIG_ARC_PAGE_SIZE_4K)
16#define PAGE_SHIFT 12
17#else
18/*
19 * Default 8k
20 * done this way (instead of under CONFIG_ARC_PAGE_SIZE_8K) because adhoc
21 * user code (busybox appletlib.h) expects PAGE_SHIFT to be defined w/o
22 * using the correct uClibc header and in their build our autoconf.h is
23 * not available
24 */
25#define PAGE_SHIFT 13
26#endif
27
28#ifdef __ASSEMBLY__
29#define PAGE_SIZE (1 << PAGE_SHIFT)
30#define PAGE_OFFSET (0x80000000)
31#else
32#define PAGE_SIZE (1UL << PAGE_SHIFT) /* Default 8K */
33#define PAGE_OFFSET (0x80000000UL) /* Kernel starts at 2G onwards */
34#endif
35
36#define PAGE_MASK (~(PAGE_SIZE-1))
37
38#endif /* !__ASSEMBLY__ */
39
40#endif /* __KERNEL__ */
41
42#endif
diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h
new file mode 100644
index 000000000000..bf88cfbc9128
--- /dev/null
+++ b/arch/arc/include/asm/processor.h
@@ -0,0 +1,143 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * vineetg: March 2009
9 * -Implemented task_pt_regs( )
10 *
11 * Amit Bhor, Sameer Dhavale, Ashwin Chaugule: Codito Technologies 2004
12 */
13
14#ifndef __ASM_ARC_PROCESSOR_H
15#define __ASM_ARC_PROCESSOR_H
16
17#ifdef __KERNEL__
18
19#ifndef __ASSEMBLY__
20
21#include <asm/arcregs.h> /* for STATUS_E1_MASK et all */
22
23/* Arch specific stuff which needs to be saved per task.
24 * However these items are not so important so as to earn a place in
25 * struct thread_info
26 */
27struct thread_struct {
28 unsigned long ksp; /* kernel mode stack pointer */
29 unsigned long callee_reg; /* pointer to callee regs */
30 unsigned long fault_address; /* dbls as brkpt holder as well */
31 unsigned long cause_code; /* Exception Cause Code (ECR) */
32};
33
34#define INIT_THREAD { \
35 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
36}
37
38/* Forward declaration, a strange C thing */
39struct task_struct;
40
41/*
42 * Return saved PC of a blocked thread.
43 */
44unsigned long thread_saved_pc(struct task_struct *t);
45
46#define task_pt_regs(p) \
47 ((struct pt_regs *)(THREAD_SIZE - 4 + (void *)task_stack_page(p)) - 1)
48
49/* Free all resources held by a thread. */
50#define release_thread(thread) do { } while (0)
51
52/* Prepare to copy thread state - unlazy all lazy status */
53#define prepare_to_copy(tsk) do { } while (0)
54
55#define cpu_relax() do { } while (0)
56
57/*
58 * Create a new kernel thread
59 */
60
61extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags);
62
63#define copy_segments(tsk, mm) do { } while (0)
64#define release_segments(mm) do { } while (0)
65
66#define KSTK_EIP(tsk) (task_pt_regs(tsk)->ret)
67
68/*
69 * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode.
70 * These can't be derived from pt_regs as that would give correp user-mode val
71 */
72#define KSTK_ESP(tsk) (tsk->thread.ksp)
73#define KSTK_BLINK(tsk) (*((unsigned int *)((KSTK_ESP(tsk)) + (13+1+1)*4)))
74#define KSTK_FP(tsk) (*((unsigned int *)((KSTK_ESP(tsk)) + (13+1)*4)))
75
76/*
77 * Do necessary setup to start up a newly executed thread.
78 *
79 * E1,E2 so that Interrupts are enabled in user mode
80 * L set, so Loop inhibited to begin with
81 * lp_start and lp_end seeded with bogus non-zero values so to easily catch
82 * the ARC700 sr to lp_start hardware bug
83 */
84#define start_thread(_regs, _pc, _usp) \
85do { \
86 set_fs(USER_DS); /* reads from user space */ \
87 (_regs)->ret = (_pc); \
88 /* Interrupts enabled in User Mode */ \
89 (_regs)->status32 = STATUS_U_MASK | STATUS_L_MASK \
90 | STATUS_E1_MASK | STATUS_E2_MASK; \
91 (_regs)->sp = (_usp); \
92 /* bogus seed values for debugging */ \
93 (_regs)->lp_start = 0x10; \
94 (_regs)->lp_end = 0x80; \
95} while (0)
96
97extern unsigned int get_wchan(struct task_struct *p);
98
99/*
100 * Default implementation of macro that returns current
101 * instruction pointer ("program counter").
102 * Should the PC register be read instead ? This macro does not seem to
103 * be used in many places so this wont be all that bad.
104 */
105#define current_text_addr() ({ __label__ _l; _l: &&_l; })
106
107#endif /* !__ASSEMBLY__ */
108
109/* Kernels Virtual memory area.
110 * Unlike other architectures(MIPS, sh, cris ) ARC 700 does not have a
111 * "kernel translated" region (like KSEG2 in MIPS). So we use a upper part
112 * of the translated bottom 2GB for kernel virtual memory and protect
113 * these pages from user accesses by disabling Ru, Eu and Wu.
114 */
115#define VMALLOC_SIZE (0x10000000) /* 256M */
116#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
117#define VMALLOC_END (PAGE_OFFSET)
118
119/* Most of the architectures seem to be keeping some kind of padding between
120 * userspace TASK_SIZE and PAGE_OFFSET. i.e TASK_SIZE != PAGE_OFFSET.
121 */
122#define USER_KERNEL_GUTTER 0x10000000
123
124/* User address space:
125 * On ARC700, CPU allows the entire lower half of 32 bit address space to be
126 * translated. Thus potentially 2G (0:0x7FFF_FFFF) could be User vaddr space.
127 * However we steal 256M for kernel addr (0x7000_0000:0x7FFF_FFFF) and another
128 * 256M (0x6000_0000:0x6FFF_FFFF) is gutter between user/kernel spaces
129 * Thus total User vaddr space is (0:0x5FFF_FFFF)
130 */
131#define TASK_SIZE (PAGE_OFFSET - VMALLOC_SIZE - USER_KERNEL_GUTTER)
132
133#define STACK_TOP TASK_SIZE
134#define STACK_TOP_MAX STACK_TOP
135
136/* This decides where the kernel will search for a free chunk of vm
137 * space during mmap's.
138 */
139#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
140
141#endif /* __KERNEL__ */
142
143#endif /* __ASM_ARC_PROCESSOR_H */
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h
new file mode 100644
index 000000000000..446e55eee7be
--- /dev/null
+++ b/arch/arc/include/asm/ptrace.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
9 */
10
11#ifndef __ASM_ARC_PTRACE_H
12#define __ASM_ARC_PTRACE_H
13
14#ifdef __KERNEL__
15
16#ifndef __ASSEMBLY__
17
18/* THE pt_regs: Defines how regs are saved during entry into kernel */
19
20struct pt_regs {
21 /*
22 * 1 word gutter after reg-file has been saved
23 * Technically not needed, Since SP always points to a "full" location
24 * (vs. "empty"). But pt_regs is shared with tools....
25 */
26 long res;
27
28 /* Real registers */
29 long bta; /* bta_l1, bta_l2, erbta */
30 long lp_start;
31 long lp_end;
32 long lp_count;
33 long status32; /* status32_l1, status32_l2, erstatus */
34 long ret; /* ilink1, ilink2 or eret */
35 long blink;
36 long fp;
37 long r26; /* gp */
38 long r12;
39 long r11;
40 long r10;
41 long r9;
42 long r8;
43 long r7;
44 long r6;
45 long r5;
46 long r4;
47 long r3;
48 long r2;
49 long r1;
50 long r0;
51 long sp; /* user/kernel sp depending on where we came from */
52 long orig_r0;
53 long orig_r8; /*to distinguish bet excp, sys call, int1 or int2 */
54};
55
56/* Callee saved registers - need to be saved only when you are scheduled out */
57
58struct callee_regs {
59 long res; /* Again this is not needed */
60 long r25;
61 long r24;
62 long r23;
63 long r22;
64 long r21;
65 long r20;
66 long r19;
67 long r18;
68 long r17;
69 long r16;
70 long r15;
71 long r14;
72 long r13;
73};
74
75#define instruction_pointer(regs) ((regs)->ret)
76#define profile_pc(regs) instruction_pointer(regs)
77
78/* return 1 if user mode or 0 if kernel mode */
79#define user_mode(regs) (regs->status32 & STATUS_U_MASK)
80
81#define user_stack_pointer(regs)\
82({ unsigned int sp; \
83 if (user_mode(regs)) \
84 sp = (regs)->sp;\
85 else \
86 sp = -1; \
87 sp; \
88})
89#endif /* !__ASSEMBLY__ */
90
91#endif /* __KERNEL__ */
92
93#ifndef __ASSEMBLY__
94/*
95 * Userspace ABI: Register state needed by
96 * -ptrace (gdbserver)
97 * -sigcontext (SA_SIGNINFO signal frame)
98 *
99 * This is to decouple pt_regs from user-space ABI, to be able to change it
100 * w/o affecting the ABI.
101 * Although the layout (initial padding) is similar to pt_regs to have some
102 * optimizations when copying pt_regs to/from user_regs_struct.
103 *
104 * Also, sigcontext only care about the scratch regs as that is what we really
105 * save/restore for signal handling.
106*/
107struct user_regs_struct {
108
109 struct scratch {
110 long pad;
111 long bta, lp_start, lp_end, lp_count;
112 long status32, ret, blink, fp, gp;
113 long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
114 long sp;
115 } scratch;
116 struct callee {
117 long pad;
118 long r25, r24, r23, r22, r21, r20;
119 long r19, r18, r17, r16, r15, r14, r13;
120 } callee;
121 long efa; /* break pt addr, for break points in delay slots */
122 long stop_pc; /* give dbg stop_pc directly after checking orig_r8 */
123};
124#endif /* !__ASSEMBLY__ */
125
126#endif /* __ASM_PTRACE_H */
diff --git a/arch/arc/include/asm/sections.h b/arch/arc/include/asm/sections.h
new file mode 100644
index 000000000000..fc15f2e1a12e
--- /dev/null
+++ b/arch/arc/include/asm/sections.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_ARC_SECTIONS_H
10#define _ASM_ARC_SECTIONS_H
11
12#include <asm-generic/sections.h>
13
14extern char _int_vec_base_lds[];
15extern char __arc_dccm_base[];
16
17#endif
diff --git a/arch/arc/include/asm/thread_info.h b/arch/arc/include/asm/thread_info.h
new file mode 100644
index 000000000000..2d50a4cdd7f3
--- /dev/null
+++ b/arch/arc/include/asm/thread_info.h
@@ -0,0 +1,121 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Vineetg: Oct 2009
9 * No need for ARC specific thread_info allocator (kmalloc/free). This is
10 * anyways one page allocation, thus slab alloc can be short-circuited and
11 * the generic version (get_free_page) would be loads better.
12 *
13 * Sameer Dhavale: Codito Technologies 2004
14 */
15
16#ifndef _ASM_THREAD_INFO_H
17#define _ASM_THREAD_INFO_H
18
19#ifdef __KERNEL__
20
21#include <asm/page.h>
22
23#ifdef CONFIG_16KSTACKS
24#define THREAD_SIZE_ORDER 1
25#else
26#define THREAD_SIZE_ORDER 0
27#endif
28
29#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
30
31#ifndef __ASSEMBLY__
32
33#include <linux/thread_info.h>
34#include <asm/segment.h>
35
36/*
37 * low level task data that entry.S needs immediate access to
38 * - this struct should fit entirely inside of one cache line
39 * - this struct shares the supervisor stack pages
40 * - if the contents of this structure are changed, the assembly constants
41 * must also be changed
42 */
43struct thread_info {
44 unsigned long flags; /* low level flags */
45 int preempt_count; /* 0 => preemptable, <0 => BUG */
46 struct task_struct *task; /* main task structure */
47 mm_segment_t addr_limit; /* thread address space */
48 struct exec_domain *exec_domain;/* execution domain */
49 __u32 cpu; /* current CPU */
50 unsigned long thr_ptr; /* TLS ptr */
51 struct restart_block restart_block;
52};
53
54/*
55 * macros/functions for gaining access to the thread information structure
56 *
57 * preempt_count needs to be 1 initially, until the scheduler is functional.
58 */
59#define INIT_THREAD_INFO(tsk) \
60{ \
61 .task = &tsk, \
62 .exec_domain = &default_exec_domain, \
63 .flags = 0, \
64 .cpu = 0, \
65 .preempt_count = INIT_PREEMPT_COUNT, \
66 .addr_limit = KERNEL_DS, \
67 .restart_block = { \
68 .fn = do_no_restart_syscall, \
69 }, \
70}
71
72#define init_thread_info (init_thread_union.thread_info)
73#define init_stack (init_thread_union.stack)
74
75static inline __attribute_const__ struct thread_info *current_thread_info(void)
76{
77 register unsigned long sp asm("sp");
78 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
79}
80
81#endif /* !__ASSEMBLY__ */
82
83#define PREEMPT_ACTIVE 0x10000000
84
85/*
86 * thread information flags
87 * - these are process state flags that various assembly files may need to
88 * access
89 * - pending work-to-be-done flags are in LSW
90 * - other flags in MSW
91 */
92#define TIF_RESTORE_SIGMASK 0 /* restore sig mask in do_signal() */
93#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
94#define TIF_SIGPENDING 2 /* signal pending */
95#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
96#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
97#define TIF_SYSCALL_TRACE 15 /* syscall trace active */
98
99/* true if poll_idle() is polling TIF_NEED_RESCHED */
100#define TIF_MEMDIE 16
101
102#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
103#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
104#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
105#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
106#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
107#define _TIF_MEMDIE (1<<TIF_MEMDIE)
108
109/* work to do on interrupt/exception return */
110#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
111 _TIF_NOTIFY_RESUME)
112
113/*
114 * _TIF_ALLWORK_MASK includes SYSCALL_TRACE, but we don't need it.
115 * SYSCALL_TRACE is anways seperately/unconditionally tested right after a
116 * syscall, so all that reamins to be tested is _TIF_WORK_MASK
117 */
118
119#endif /* __KERNEL__ */
120
121#endif /* _ASM_THREAD_INFO_H */