blob: a105f289e58b9c6172ca3872f4bdba74d764b83c [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
Ben Cheng654325d2012-03-07 21:13:49 -080010 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080017 ****************************************************************************
18 ****************************************************************************/
19#ifndef X86_64_PDA_H
20#define X86_64_PDA_H
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080021#ifndef __ASSEMBLY__
22#include <linux/stddef.h>
Ben Cheng654325d2012-03-07 21:13:49 -080023/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080024#include <linux/types.h>
25#include <linux/cache.h>
26#include <asm/page.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080027struct x8664_pda {
Ben Cheng654325d2012-03-07 21:13:49 -080028/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029 struct task_struct *pcurrent;
30 unsigned long data_offset;
31 unsigned long kernelstack;
32 unsigned long oldrsp;
Ben Cheng654325d2012-03-07 21:13:49 -080033/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034 int irqcount;
35 int cpunumber;
36 char *irqstackptr;
37 int nodenumber;
Ben Cheng654325d2012-03-07 21:13:49 -080038/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080039 unsigned int __softirq_pending;
40 unsigned int __nmi_count;
41 short mmu_state;
42 short isidle;
Ben Cheng654325d2012-03-07 21:13:49 -080043/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080044 struct mm_struct *active_mm;
45 unsigned apic_timer_irqs;
46 unsigned irq0_irqs;
47 unsigned irq_resched_count;
Ben Cheng654325d2012-03-07 21:13:49 -080048/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080049 unsigned irq_call_count;
50 unsigned irq_tlb_count;
51 unsigned irq_thermal_count;
52 unsigned irq_threshold_count;
Ben Cheng654325d2012-03-07 21:13:49 -080053/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080054 unsigned irq_spurious_count;
55} ____cacheline_aligned_in_smp;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080056#define cpu_pda(i) (_cpu_pda[i])
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080057#define pda_offset(field) offsetof(struct x8664_pda, field)
Ben Cheng654325d2012-03-07 21:13:49 -080058/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080059#define pda_to_op(op,field,val) do { typedef typeof(_proxy_pda.field) T__; if (0) { T__ tmp__; tmp__ = (val); } switch (sizeof(_proxy_pda.field)) { case 2: asm(op "w %1,%%gs:%c2" : "+m" (_proxy_pda.field) : "ri" ((T__)val), "i"(pda_offset(field))); break; case 4: asm(op "l %1,%%gs:%c2" : "+m" (_proxy_pda.field) : "ri" ((T__)val), "i" (pda_offset(field))); break; case 8: asm(op "q %1,%%gs:%c2": "+m" (_proxy_pda.field) : "ri" ((T__)val), "i"(pda_offset(field))); break; default: __bad_pda_field(); } } while (0)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080060#define pda_from_op(op,field) ({ typeof(_proxy_pda.field) ret__; switch (sizeof(_proxy_pda.field)) { case 2: asm(op "w %%gs:%c1,%0" : "=r" (ret__) : "i" (pda_offset(field)), "m" (_proxy_pda.field)); break; case 4: asm(op "l %%gs:%c1,%0": "=r" (ret__): "i" (pda_offset(field)), "m" (_proxy_pda.field)); break; case 8: asm(op "q %%gs:%c1,%0": "=r" (ret__) : "i" (pda_offset(field)), "m" (_proxy_pda.field)); break; default: __bad_pda_field(); } ret__; })
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080061#define read_pda(field) pda_from_op("mov",field)
62#define write_pda(field,val) pda_to_op("mov",field,val)
Ben Cheng654325d2012-03-07 21:13:49 -080063/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080064#define add_pda(field,val) pda_to_op("add",field,val)
65#define sub_pda(field,val) pda_to_op("sub",field,val)
66#define or_pda(field,val) pda_to_op("or",field,val)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080067#define test_and_clear_bit_pda(bit,field) ({ int old__; asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" : "=r" (old__), "+m" (_proxy_pda.field) : "dIr" (bit), "i" (pda_offset(field)) : "memory"); old__; })
Ben Cheng654325d2012-03-07 21:13:49 -080068/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080069#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080070#define PDA_STACKOFFSET (5*8)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080071#endif