linux/arch/h8300/kernel/asm-offsets.c
<<
>>
Prefs
   1/*
   2 * This program is used to generate definitions needed by
   3 * assembly language modules.
   4 *
   5 * We use the technique used in the OSF Mach kernel code:
   6 * generate asm statements containing #defines,
   7 * compile this file to assembler, and then extract the
   8 * #defines from the assembly-language output.
   9 */
  10
  11#include <linux/stddef.h>
  12#include <linux/sched.h>
  13#include <linux/kernel_stat.h>
  14#include <linux/ptrace.h>
  15#include <linux/hardirq.h>
  16#include <asm/bootinfo.h>
  17#include <asm/irq.h>
  18#include <asm/ptrace.h>
  19
  20#define DEFINE(sym, val) \
  21        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
  22
  23#define BLANK() asm volatile("\n->" : : )
  24
  25int main(void)
  26{
  27        /* offsets into the task struct */
  28        DEFINE(TASK_STATE, offsetof(struct task_struct, state));
  29        DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
  30        DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
  31        DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
  32        DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
  33        DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, thread_info));
  34        DEFINE(TASK_MM, offsetof(struct task_struct, mm));
  35        DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
  36
  37        /* offsets into the irq_cpustat_t struct */
  38        DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
  39
  40        /* offsets into the thread struct */
  41        DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
  42        DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
  43        DEFINE(THREAD_CCR, offsetof(struct thread_struct, ccr));
  44
  45        /* offsets into the pt_regs struct */
  46        DEFINE(LER0,  offsetof(struct pt_regs, er0)      - sizeof(long));
  47        DEFINE(LER1,  offsetof(struct pt_regs, er1)      - sizeof(long));
  48        DEFINE(LER2,  offsetof(struct pt_regs, er2)      - sizeof(long));
  49        DEFINE(LER3,  offsetof(struct pt_regs, er3)      - sizeof(long));
  50        DEFINE(LER4,  offsetof(struct pt_regs, er4)      - sizeof(long));
  51        DEFINE(LER5,  offsetof(struct pt_regs, er5)      - sizeof(long));
  52        DEFINE(LER6,  offsetof(struct pt_regs, er6)      - sizeof(long));
  53        DEFINE(LORIG, offsetof(struct pt_regs, orig_er0) - sizeof(long));
  54        DEFINE(LCCR,  offsetof(struct pt_regs, ccr)      - sizeof(long));
  55        DEFINE(LVEC,  offsetof(struct pt_regs, vector)   - sizeof(long));
  56#if defined(__H8300S__)
  57        DEFINE(LEXR,  offsetof(struct pt_regs, exr)      - sizeof(long));
  58#endif
  59        DEFINE(LRET,  offsetof(struct pt_regs, pc)       - sizeof(long));
  60
  61        DEFINE(PT_PTRACED, PT_PTRACED);
  62        DEFINE(PT_DTRACE, PT_DTRACE);
  63
  64        return 0;
  65}
  66
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.