EXLMOTODEV

Xen-Arm_0001_Add_neccesary_linux_kernel-headers.patch

Mar 14th, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 20.32 KB | None | 0 0
  1. diff --git a/tools/minios/include/asm-arm/assembler.h b/tools/minios/include/asm-arm/assembler.h
  2. new file mode 100644
  3. index 0000000..15f8a09
  4. --- /dev/null
  5. +++ b/tools/minios/include/asm-arm/assembler.h
  6. @@ -0,0 +1,129 @@
  7. +/*
  8. + *  arch/arm/include/asm/assembler.h
  9. + *
  10. + *  Copyright (C) 1996-2000 Russell King
  11. + *
  12. + * This program is free software; you can redistribute it and/or modify
  13. + * it under the terms of the GNU General Public License version 2 as
  14. + * published by the Free Software Foundation.
  15. + *
  16. + *  This file contains arm architecture specific defines
  17. + *  for the different processors.
  18. + *
  19. + *  Do not include any C declarations in this file - it is included by
  20. + *  assembler source.
  21. + */
  22. +#ifndef __ASSEMBLY__
  23. +#error "Only include this from assembly code"
  24. +#endif
  25. +
  26. +#include <asm/ptrace.h>
  27. +
  28. +/*
  29. + * Endian independent macros for shifting bytes within registers.
  30. + */
  31. +#ifndef __ARMEB__
  32. +#define pull            lsr
  33. +#define push            lsl
  34. +#define get_byte_0      lsl #0
  35. +#define get_byte_1 lsr #8
  36. +#define get_byte_2 lsr #16
  37. +#define get_byte_3 lsr #24
  38. +#define put_byte_0      lsl #0
  39. +#define put_byte_1 lsl #8
  40. +#define put_byte_2 lsl #16
  41. +#define put_byte_3 lsl #24
  42. +#else
  43. +#define pull            lsl
  44. +#define push            lsr
  45. +#define get_byte_0 lsr #24
  46. +#define get_byte_1 lsr #16
  47. +#define get_byte_2 lsr #8
  48. +#define get_byte_3      lsl #0
  49. +#define put_byte_0 lsl #24
  50. +#define put_byte_1 lsl #16
  51. +#define put_byte_2 lsl #8
  52. +#define put_byte_3      lsl #0
  53. +#endif
  54. +
  55. +/*
  56. + * Data preload for architectures that support it
  57. + */
  58. +#if __LINUX_ARM_ARCH__ >= 5
  59. +#define PLD(code...)   code
  60. +#else
  61. +#define PLD(code...)
  62. +#endif
  63. +
  64. +/*
  65. + * This can be used to enable code to cacheline align the destination
  66. + * pointer when bulk writing to memory.  Experiments on StrongARM and
  67. + * XScale didn't show this a worthwhile thing to do when the cache is not
  68. + * set to write-allocate (this would need further testing on XScale when WA
  69. + * is used).
  70. + *
  71. + * On Feroceon there is much to gain however, regardless of cache mode.
  72. + */
  73. +#ifdef CONFIG_CPU_FEROCEON
  74. +#define CALGN(code...) code
  75. +#else
  76. +#define CALGN(code...)
  77. +#endif
  78. +
  79. +/*
  80. + * Enable and disable interrupts
  81. + */
  82. +#if __LINUX_ARM_ARCH__ >= 6
  83. +   .macro  disable_irq
  84. +   cpsid   i
  85. +   .endm
  86. +
  87. +   .macro  enable_irq
  88. +   cpsie   i
  89. +   .endm
  90. +#else
  91. +   .macro  disable_irq
  92. +   msr cpsr_c, #PSR_I_BIT | SVC_MODE
  93. +   .endm
  94. +
  95. +   .macro  enable_irq
  96. +   msr cpsr_c, #SVC_MODE
  97. +   .endm
  98. +#endif
  99. +
  100. +/*
  101. + * Save the current IRQ state and disable IRQs.  Note that this macro
  102. + * assumes FIQs are enabled, and that the processor is in SVC mode.
  103. + */
  104. +   .macro  save_and_disable_irqs, oldcpsr
  105. +   mrs \oldcpsr, cpsr
  106. +   disable_irq
  107. +   .endm
  108. +
  109. +/*
  110. + * Restore interrupt state previously stored in a register.  We don't
  111. + * guarantee that this will preserve the flags.
  112. + */
  113. +   .macro  restore_irqs, oldcpsr
  114. +   msr cpsr_c, \oldcpsr
  115. +   .endm
  116. +
  117. +#define USER(x...)             \
  118. +9999:  x;                  \
  119. +   .section __ex_table,"a";        \
  120. +   .align  3;              \
  121. +   .long   9999b,9001f;            \
  122. +   .previous
  123. +
  124. +/*
  125. + * SMP data memory barrier
  126. + */
  127. +   .macro  smp_dmb
  128. +#ifdef CONFIG_SMP
  129. +#if __LINUX_ARM_ARCH__ >= 7
  130. +   dmb
  131. +#elif __LINUX_ARM_ARCH__ == 6
  132. +   mcr p15, 0, r0, c7, c10, 5  @ dmb
  133. +#endif
  134. +#endif
  135. +   .endm
  136. diff --git a/tools/minios/include/asm-arm/hwcap.h b/tools/minios/include/asm-arm/hwcap.h
  137. new file mode 100644
  138. index 0000000..f7bd52b
  139. --- /dev/null
  140. +++ b/tools/minios/include/asm-arm/hwcap.h
  141. @@ -0,0 +1,32 @@
  142. +#ifndef __ASMARM_HWCAP_H
  143. +#define __ASMARM_HWCAP_H
  144. +
  145. +/*
  146. + * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP
  147. + */
  148. +#define HWCAP_SWP  1
  149. +#define HWCAP_HALF 2
  150. +#define HWCAP_THUMB    4
  151. +#define HWCAP_26BIT    8   /* Play it safe */
  152. +#define HWCAP_FAST_MULT    16
  153. +#define HWCAP_FPA  32
  154. +#define HWCAP_VFP  64
  155. +#define HWCAP_EDSP 128
  156. +#define HWCAP_JAVA 256
  157. +#define HWCAP_IWMMXT   512
  158. +#define HWCAP_CRUNCH   1024
  159. +#define HWCAP_THUMBEE  2048
  160. +#define HWCAP_NEON 4096
  161. +#define HWCAP_VFPv3    8192
  162. +#define HWCAP_VFPv3D16 16384
  163. +
  164. +#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
  165. +/*
  166. + * This yields a mask that user programs can use to figure out what
  167. + * instruction set this cpu supports.
  168. + */
  169. +#define ELF_HWCAP  (elf_hwcap)
  170. +extern unsigned int elf_hwcap;
  171. +#endif
  172. +
  173. +#endif
  174. diff --git a/tools/minios/include/asm-arm/linkage.h b/tools/minios/include/asm-arm/linkage.h
  175. new file mode 100644
  176. index 0000000..5a25632
  177. --- /dev/null
  178. +++ b/tools/minios/include/asm-arm/linkage.h
  179. @@ -0,0 +1,11 @@
  180. +#ifndef __ASM_LINKAGE_H
  181. +#define __ASM_LINKAGE_H
  182. +
  183. +#define __ALIGN .align 0
  184. +#define __ALIGN_STR ".align 0"
  185. +
  186. +#define ENDPROC(name) \
  187. +  .type name, %function; \
  188. +  END(name)
  189. +
  190. +#endif
  191. diff --git a/tools/minios/include/asm-arm/ptrace.h b/tools/minios/include/asm-arm/ptrace.h
  192. new file mode 100644
  193. index 0000000..67b833c
  194. --- /dev/null
  195. +++ b/tools/minios/include/asm-arm/ptrace.h
  196. @@ -0,0 +1,176 @@
  197. +/*
  198. + *  arch/arm/include/asm/ptrace.h
  199. + *
  200. + *  Copyright (C) 1996-2003 Russell King
  201. + *
  202. + * This program is free software; you can redistribute it and/or modify
  203. + * it under the terms of the GNU General Public License version 2 as
  204. + * published by the Free Software Foundation.
  205. + */
  206. +#ifndef __ASM_ARM_PTRACE_H
  207. +#define __ASM_ARM_PTRACE_H
  208. +
  209. +#include <asm/hwcap.h>
  210. +
  211. +#define PTRACE_GETREGS     12
  212. +#define PTRACE_SETREGS     13
  213. +#define PTRACE_GETFPREGS   14
  214. +#define PTRACE_SETFPREGS   15
  215. +/* PTRACE_ATTACH is 16 */
  216. +/* PTRACE_DETACH is 17 */
  217. +#define PTRACE_GETWMMXREGS 18
  218. +#define PTRACE_SETWMMXREGS 19
  219. +/* 20 is unused */
  220. +#define PTRACE_OLDSETOPTIONS   21
  221. +#define PTRACE_GET_THREAD_AREA 22
  222. +#define PTRACE_SET_SYSCALL 23
  223. +/* PTRACE_SYSCALL is 24 */
  224. +#define PTRACE_GETCRUNCHREGS   25
  225. +#define PTRACE_SETCRUNCHREGS   26
  226. +#define PTRACE_GETVFPREGS  27
  227. +#define PTRACE_SETVFPREGS  28
  228. +
  229. +/*
  230. + * PSR bits
  231. + */
  232. +#define USR26_MODE 0x00000000
  233. +#define FIQ26_MODE 0x00000001
  234. +#define IRQ26_MODE 0x00000002
  235. +#define SVC26_MODE 0x00000003
  236. +#define USR_MODE   0x00000010
  237. +#define FIQ_MODE   0x00000011
  238. +#define IRQ_MODE   0x00000012
  239. +#define SVC_MODE   0x00000013
  240. +#define ABT_MODE   0x00000017
  241. +#define UND_MODE   0x0000001b
  242. +#define SYSTEM_MODE    0x0000001f
  243. +#define MODE32_BIT 0x00000010
  244. +#define MODE_MASK  0x0000001f
  245. +#define PSR_T_BIT  0x00000020
  246. +#define PSR_F_BIT  0x00000040
  247. +#define PSR_I_BIT  0x00000080
  248. +#define PSR_A_BIT  0x00000100
  249. +#define PSR_E_BIT  0x00000200
  250. +#define PSR_J_BIT  0x01000000
  251. +#define PSR_Q_BIT  0x08000000
  252. +#define PSR_V_BIT  0x10000000
  253. +#define PSR_C_BIT  0x20000000
  254. +#define PSR_Z_BIT  0x40000000
  255. +#define PSR_N_BIT  0x80000000
  256. +
  257. +/*
  258. + * Groups of PSR bits
  259. + */
  260. +#define PSR_f      0xff000000  /* Flags        */
  261. +#define PSR_s      0x00ff0000  /* Status       */
  262. +#define PSR_x      0x0000ff00  /* Extension        */
  263. +#define PSR_c      0x000000ff  /* Control      */
  264. +
  265. +/*
  266. + * ARMv7 groups of APSR bits
  267. + */
  268. +#define PSR_ISET_MASK  0x01000010  /* ISA state (J, T) mask */
  269. +#define PSR_IT_MASK    0x0600fc00  /* If-Then execution state mask */
  270. +#define PSR_ENDIAN_MASK    0x00000200  /* Endianness state mask */
  271. +
  272. +/*
  273. + * Default endianness state
  274. + */
  275. +#ifdef CONFIG_CPU_ENDIAN_BE8
  276. +#define PSR_ENDSTATE   PSR_E_BIT
  277. +#else
  278. +#define PSR_ENDSTATE   0
  279. +#endif
  280. +
  281. +#ifndef __ASSEMBLY__
  282. +
  283. +/*
  284. + * This struct defines the way the registers are stored on the
  285. + * stack during a system call.  Note that sizeof(struct pt_regs)
  286. + * has to be a multiple of 8.
  287. + */
  288. +struct pt_regs {
  289. +   long uregs[18];
  290. +};
  291. +
  292. +#define ARM_cpsr   uregs[16]
  293. +#define ARM_pc     uregs[15]
  294. +#define ARM_lr     uregs[14]
  295. +#define ARM_sp     uregs[13]
  296. +#define ARM_ip     uregs[12]
  297. +#define ARM_fp     uregs[11]
  298. +#define ARM_r10        uregs[10]
  299. +#define ARM_r9     uregs[9]
  300. +#define ARM_r8     uregs[8]
  301. +#define ARM_r7     uregs[7]
  302. +#define ARM_r6     uregs[6]
  303. +#define ARM_r5     uregs[5]
  304. +#define ARM_r4     uregs[4]
  305. +#define ARM_r3     uregs[3]
  306. +#define ARM_r2     uregs[2]
  307. +#define ARM_r1     uregs[1]
  308. +#define ARM_r0     uregs[0]
  309. +#define ARM_ORIG_r0    uregs[17]
  310. +
  311. +#ifdef __KERNEL__
  312. +
  313. +#define user_mode(regs)    \
  314. +   (((regs)->ARM_cpsr & 0xf) == 0)
  315. +
  316. +#ifdef CONFIG_ARM_THUMB
  317. +#define thumb_mode(regs) \
  318. +   (((regs)->ARM_cpsr & PSR_T_BIT))
  319. +#else
  320. +#define thumb_mode(regs) (0)
  321. +#endif
  322. +
  323. +#define isa_mode(regs) \
  324. +   ((((regs)->ARM_cpsr & PSR_J_BIT) >> 23) | \
  325. +    (((regs)->ARM_cpsr & PSR_T_BIT) >> 5))
  326. +
  327. +#define processor_mode(regs) \
  328. +   ((regs)->ARM_cpsr & MODE_MASK)
  329. +
  330. +#define interrupts_enabled(regs) \
  331. +   (!((regs)->ARM_cpsr & PSR_I_BIT))
  332. +
  333. +#define fast_interrupts_enabled(regs) \
  334. +   (!((regs)->ARM_cpsr & PSR_F_BIT))
  335. +
  336. +/* Are the current registers suitable for user mode?
  337. + * (used to maintain security in signal handlers)
  338. + */
  339. +static inline int valid_user_regs(struct pt_regs *regs)
  340. +{
  341. +   if (user_mode(regs) && (regs->ARM_cpsr & PSR_I_BIT) == 0) {
  342. +       regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);
  343. +       return 1;
  344. +   }
  345. +
  346. +   /*
  347. +    * Force CPSR to something logical...
  348. +    */
  349. +   regs->ARM_cpsr &= PSR_f | PSR_s | (PSR_x & ~PSR_A_BIT) | PSR_T_BIT | MODE32_BIT;
  350. +   if (!(elf_hwcap & HWCAP_26BIT))
  351. +       regs->ARM_cpsr |= USR_MODE;
  352. +
  353. +   return 0;
  354. +}
  355. +
  356. +#define instruction_pointer(regs)  (regs)->ARM_pc
  357. +
  358. +#ifdef CONFIG_SMP
  359. +extern unsigned long profile_pc(struct pt_regs *regs);
  360. +#else
  361. +#define profile_pc(regs) instruction_pointer(regs)
  362. +#endif
  363. +
  364. +#define predicate(x)       ((x) & 0xf0000000)
  365. +#define PREDICATE_ALWAYS   0xe0000000
  366. +
  367. +#endif /* __KERNEL__ */
  368. +
  369. +#endif /* __ASSEMBLY__ */
  370. +
  371. +#endif
  372. +
  373. diff --git a/tools/minios/include/linux/compiler.h b/tools/minios/include/linux/compiler.h
  374. new file mode 100644
  375. index 0000000..04fb513
  376. --- /dev/null
  377. +++ b/tools/minios/include/linux/compiler.h
  378. @@ -0,0 +1,283 @@
  379. +#ifndef __LINUX_COMPILER_H
  380. +#define __LINUX_COMPILER_H
  381. +
  382. +#ifndef __ASSEMBLY__
  383. +
  384. +#ifdef __CHECKER__
  385. +# define __user        __attribute__((noderef, address_space(1)))
  386. +# define __kernel  /* default address space */
  387. +# define __safe        __attribute__((safe))
  388. +# define __force   __attribute__((force))
  389. +# define __nocast  __attribute__((nocast))
  390. +# define __iomem   __attribute__((noderef, address_space(2)))
  391. +# define __acquires(x) __attribute__((context(x,0,1)))
  392. +# define __releases(x) __attribute__((context(x,1,0)))
  393. +# define __acquire(x)  __context__(x,1)
  394. +# define __release(x)  __context__(x,-1)
  395. +# define __cond_lock(x,c)  ((c) ? ({ __acquire(x); 1; }) : 0)
  396. +extern void __chk_user_ptr(const volatile void __user *);
  397. +extern void __chk_io_ptr(const volatile void __iomem *);
  398. +#else
  399. +# define __user
  400. +# define __kernel
  401. +# define __safe
  402. +# define __force
  403. +# define __nocast
  404. +# define __iomem
  405. +# define __chk_user_ptr(x) (void)0
  406. +# define __chk_io_ptr(x) (void)0
  407. +# define __builtin_warning(x, y...) (1)
  408. +# define __acquires(x)
  409. +# define __releases(x)
  410. +# define __acquire(x) (void)0
  411. +# define __release(x) (void)0
  412. +# define __cond_lock(x,c) (c)
  413. +#endif
  414. +
  415. +#ifdef __KERNEL__
  416. +
  417. +#ifdef __GNUC__
  418. +#include <linux/compiler-gcc.h>
  419. +#endif
  420. +
  421. +#define notrace __attribute__((no_instrument_function))
  422. +
  423. +/* Intel compiler defines __GNUC__. So we will overwrite implementations
  424. + * coming from above header files here
  425. + */
  426. +#ifdef __INTEL_COMPILER
  427. +# include <linux/compiler-intel.h>
  428. +#endif
  429. +
  430. +/*
  431. + * Generic compiler-dependent macros required for kernel
  432. + * build go below this comment. Actual compiler/compiler version
  433. + * specific implementations come from the above header files
  434. + */
  435. +
  436. +struct ftrace_branch_data {
  437. +   const char *func;
  438. +   const char *file;
  439. +   unsigned line;
  440. +   union {
  441. +       struct {
  442. +           unsigned long correct;
  443. +           unsigned long incorrect;
  444. +       };
  445. +       struct {
  446. +           unsigned long miss;
  447. +           unsigned long hit;
  448. +       };
  449. +       unsigned long miss_hit[2];
  450. +   };
  451. +};
  452. +
  453. +/*
  454. + * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
  455. + * to disable branch tracing on a per file basis.
  456. + */
  457. +#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
  458. +    && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
  459. +void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
  460. +
  461. +#define likely_notrace(x)  __builtin_expect(!!(x), 1)
  462. +#define unlikely_notrace(x)    __builtin_expect(!!(x), 0)
  463. +
  464. +#define __branch_check__(x, expect) ({                 \
  465. +           int ______r;                    \
  466. +           static struct ftrace_branch_data        \
  467. +               __attribute__((__aligned__(4)))     \
  468. +               __attribute__((section("_ftrace_annotated_branch"))) \
  469. +               ______f = {             \
  470. +               .func = __func__,           \
  471. +               .file = __FILE__,           \
  472. +               .line = __LINE__,           \
  473. +           };                      \
  474. +           ______r = likely_notrace(x);            \
  475. +           ftrace_likely_update(&______f, ______r, expect); \
  476. +           ______r;                    \
  477. +       })
  478. +
  479. +/*
  480. + * Using __builtin_constant_p(x) to ignore cases where the return
  481. + * value is always the same.  This idea is taken from a similar patch
  482. + * written by Daniel Walker.
  483. + */
  484. +# ifndef likely
  485. +#  define likely(x)    (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
  486. +# endif
  487. +# ifndef unlikely
  488. +#  define unlikely(x)  (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
  489. +# endif
  490. +
  491. +#ifdef CONFIG_PROFILE_ALL_BRANCHES
  492. +/*
  493. + * "Define 'is'", Bill Clinton
  494. + * "Define 'if'", Steven Rostedt
  495. + */
  496. +#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
  497. +#define __trace_if(cond) \
  498. +   if (__builtin_constant_p((cond)) ? !!(cond) :           \
  499. +   ({                              \
  500. +       int ______r;                        \
  501. +       static struct ftrace_branch_data            \
  502. +           __attribute__((__aligned__(4)))         \
  503. +           __attribute__((section("_ftrace_branch")))  \
  504. +           ______f = {                 \
  505. +               .func = __func__,           \
  506. +               .file = __FILE__,           \
  507. +               .line = __LINE__,           \
  508. +           };                      \
  509. +       ______r = !!(cond);                 \
  510. +       ______f.miss_hit[______r]++;                    \
  511. +       ______r;                        \
  512. +   }))
  513. +#endif /* CONFIG_PROFILE_ALL_BRANCHES */
  514. +
  515. +#else
  516. +# define likely(x) __builtin_expect(!!(x), 1)
  517. +# define unlikely(x)   __builtin_expect(!!(x), 0)
  518. +#endif
  519. +
  520. +/* Optimization barrier */
  521. +#ifndef barrier
  522. +# define barrier() __memory_barrier()
  523. +#endif
  524. +
  525. +#ifndef RELOC_HIDE
  526. +# define RELOC_HIDE(ptr, off)                  \
  527. +  ({ unsigned long __ptr;                  \
  528. +     __ptr = (unsigned long) (ptr);                \
  529. +    (typeof(ptr)) (__ptr + (off)); })
  530. +#endif
  531. +
  532. +#endif /* __KERNEL__ */
  533. +
  534. +#endif /* __ASSEMBLY__ */
  535. +
  536. +#ifdef __KERNEL__
  537. +/*
  538. + * Allow us to mark functions as 'deprecated' and have gcc emit a nice
  539. + * warning for each use, in hopes of speeding the functions removal.
  540. + * Usage is:
  541. + *         int __deprecated foo(void)
  542. + */
  543. +#ifndef __deprecated
  544. +# define __deprecated      /* unimplemented */
  545. +#endif
  546. +
  547. +#ifdef MODULE
  548. +#define __deprecated_for_modules __deprecated
  549. +#else
  550. +#define __deprecated_for_modules
  551. +#endif
  552. +
  553. +#ifndef __must_check
  554. +#define __must_check
  555. +#endif
  556. +
  557. +#ifndef CONFIG_ENABLE_MUST_CHECK
  558. +#undef __must_check
  559. +#define __must_check
  560. +#endif
  561. +#ifndef CONFIG_ENABLE_WARN_DEPRECATED
  562. +#undef __deprecated
  563. +#undef __deprecated_for_modules
  564. +#define __deprecated
  565. +#define __deprecated_for_modules
  566. +#endif
  567. +
  568. +/*
  569. + * Allow us to avoid 'defined but not used' warnings on functions and data,
  570. + * as well as force them to be emitted to the assembly file.
  571. + *
  572. + * As of gcc 3.4, static functions that are not marked with attribute((used))
  573. + * may be elided from the assembly file.  As of gcc 3.4, static data not so
  574. + * marked will not be elided, but this may change in a future gcc version.
  575. + *
  576. + * NOTE: Because distributions shipped with a backported unit-at-a-time
  577. + * compiler in gcc 3.3, we must define __used to be __attribute__((used))
  578. + * for gcc >=3.3 instead of 3.4.
  579. + *
  580. + * In prior versions of gcc, such functions and data would be emitted, but
  581. + * would be warned about except with attribute((unused)).
  582. + *
  583. + * Mark functions that are referenced only in inline assembly as __used so
  584. + * the code is emitted even though it appears to be unreferenced.
  585. + */
  586. +#ifndef __used
  587. +# define __used            /* unimplemented */
  588. +#endif
  589. +
  590. +#ifndef __maybe_unused
  591. +# define __maybe_unused        /* unimplemented */
  592. +#endif
  593. +
  594. +#ifndef noinline
  595. +#define noinline
  596. +#endif
  597. +
  598. +/*
  599. + * Rather then using noinline to prevent stack consumption, use
  600. + * noinline_for_stack instead.  For documentaiton reasons.
  601. + */
  602. +#define noinline_for_stack noinline
  603. +
  604. +#ifndef __always_inline
  605. +#define __always_inline inline
  606. +#endif
  607. +
  608. +#endif /* __KERNEL__ */
  609. +
  610. +/*
  611. + * From the GCC manual:
  612. + *
  613. + * Many functions do not examine any values except their arguments,
  614. + * and have no effects except the return value.  Basically this is
  615. + * just slightly more strict class than the `pure' attribute above,
  616. + * since function is not allowed to read global memory.
  617. + *
  618. + * Note that a function that has pointer arguments and examines the
  619. + * data pointed to must _not_ be declared `const'.  Likewise, a
  620. + * function that calls a non-`const' function usually must not be
  621. + * `const'.  It does not make sense for a `const' function to return
  622. + * `void'.
  623. + */
  624. +#ifndef __attribute_const__
  625. +# define __attribute_const__   /* unimplemented */
  626. +#endif
  627. +
  628. +/*
  629. + * Tell gcc if a function is cold. The compiler will assume any path
  630. + * directly leading to the call is unlikely.
  631. + */
  632. +
  633. +#ifndef __cold
  634. +#define __cold
  635. +#endif
  636. +
  637. +/* Simple shorthand for a section definition */
  638. +#ifndef __section
  639. +# define __section(S) __attribute__ ((__section__(#S)))
  640. +#endif
  641. +
  642. +/* Are two types/vars the same type (ignoring qualifiers)? */
  643. +#ifndef __same_type
  644. +# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
  645. +#endif
  646. +
  647. +/*
  648. + * Prevent the compiler from merging or refetching accesses.  The compiler
  649. + * is also forbidden from reordering successive instances of ACCESS_ONCE(),
  650. + * but only when the compiler is aware of some particular ordering.  One way
  651. + * to make the compiler aware of ordering is to put the two invocations of
  652. + * ACCESS_ONCE() in different C statements.
  653. + *
  654. + * This macro does absolutely -nothing- to prevent the CPU from reordering,
  655. + * merging, or refetching absolutely anything at any time.  Its main intended
  656. + * use is to mediate communication between process-level code and irq/NMI
  657. + * handlers, all running on the same CPU.
  658. + */
  659. +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
  660. +
  661. +#endif /* __LINUX_COMPILER_H */
  662. diff --git a/tools/minios/include/linux/linkage.h b/tools/minios/include/linux/linkage.h
  663. new file mode 100644
  664. index 0000000..691f591
  665. --- /dev/null
  666. +++ b/tools/minios/include/linux/linkage.h
  667. @@ -0,0 +1,97 @@
  668. +#ifndef _LINUX_LINKAGE_H
  669. +#define _LINUX_LINKAGE_H
  670. +
  671. +#include <linux/compiler.h>
  672. +#include <asm/linkage.h>
  673. +
  674. +#ifdef __cplusplus
  675. +#define CPP_ASMLINKAGE extern "C"
  676. +#else
  677. +#define CPP_ASMLINKAGE
  678. +#endif
  679. +
  680. +#ifndef asmlinkage
  681. +#define asmlinkage CPP_ASMLINKAGE
  682. +#endif
  683. +
  684. +#ifndef asmregparm
  685. +# define asmregparm
  686. +#endif
  687. +
  688. +#define __page_aligned_data    __section(.data.page_aligned) __aligned(PAGE_SIZE)
  689. +#define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE)
  690. +
  691. +/*
  692. + * For assembly routines.
  693. + *
  694. + * Note when using these that you must specify the appropriate
  695. + * alignment directives yourself
  696. + */
  697. +#define __PAGE_ALIGNED_DATA    .section ".data.page_aligned", "aw"
  698. +#define __PAGE_ALIGNED_BSS .section ".bss.page_aligned", "aw"
  699. +
  700. +/*
  701. + * This is used by architectures to keep arguments on the stack
  702. + * untouched by the compiler by keeping them live until the end.
  703. + * The argument stack may be owned by the assembly-language
  704. + * caller, not the callee, and gcc doesn't always understand
  705. + * that.
  706. + *
  707. + * We have the return value, and a maximum of six arguments.
  708. + *
  709. + * This should always be followed by a "return ret" for the
  710. + * protection to work (ie no more work that the compiler might
  711. + * end up needing stack temporaries for).
  712. + */
  713. +/* Assembly files may be compiled with -traditional .. */
  714. +#ifndef __ASSEMBLY__
  715. +#ifndef asmlinkage_protect
  716. +# define asmlinkage_protect(n, ret, args...)   do { } while (0)
  717. +#endif
  718. +#endif
  719. +
  720. +#ifndef __ALIGN
  721. +#define __ALIGN        .align 4,0x90
  722. +#define __ALIGN_STR    ".align 4,0x90"
  723. +#endif
  724. +
  725. +#ifdef __ASSEMBLY__
  726. +
  727. +#define ALIGN __ALIGN
  728. +#define ALIGN_STR __ALIGN_STR
  729. +
  730. +#ifndef ENTRY
  731. +#define ENTRY(name) \
  732. +  .globl name; \
  733. +  ALIGN; \
  734. +  name:
  735. +#endif
  736. +
  737. +#ifndef WEAK
  738. +#define WEAK(name)    \
  739. +   .weak name;    \
  740. +   name:
  741. +#endif
  742. +
  743. +#ifndef END
  744. +#define END(name) \
  745. +  .size name, .-name
  746. +#endif
  747. +
  748. +/* If symbol 'name' is treated as a subroutine (gets called, and returns)
  749. + * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
  750. + * static analysis tools such as stack depth analyzer.
  751. + */
  752. +#ifndef ENDPROC
  753. +#define ENDPROC(name) \
  754. +  .type name, @function; \
  755. +  END(name)
  756. +#endif
  757. +
  758. +#endif
  759. +
  760. +#define NORET_TYPE    /**/
  761. +#define ATTRIB_NORET  __attribute__((noreturn))
  762. +#define NORET_AND     noreturn,
  763. +
  764. +#endif
Advertisement
Add Comment
Please, Sign In to add comment