187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao/*
287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * linux/arch/unicore32/kernel/asm-offsets.c
387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao *
487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * Code specific to PKUnity SoC and UniCore ISA
587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao *
687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * Copyright (C) 2001-2010 GUAN Xue-tao
787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao *
887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * Generate definitions needed by assembly language modules.
987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * This code generates raw asm output which is post-processed to extract
1087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * and format the required data.
1187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao *
1287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * This program is free software; you can redistribute it and/or modify
1387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * it under the terms of the GNU General Public License version 2 as
1487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * published by the Free Software Foundation.
1587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao */
1687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#include <linux/sched.h>
1787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#include <linux/mm.h>
1887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#include <linux/dma-mapping.h>
1987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#include <linux/kbuild.h>
2087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#include <linux/suspend.h>
2187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#include <linux/thread_info.h>
2287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#include <asm/memory.h>
2387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#include <asm/suspend.h>
2487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao
2587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao/*
2687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * GCC 3.0, 3.1: general bad code generation.
2787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * GCC 3.2.0: incorrect function argument offset calculation.
2887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c
2987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao *	(http://gcc.gnu.org/PR8896) and incorrect structure
3087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao *		initialisation in fs/jffs2/erase.c
3187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao */
3287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#if (__GNUC__ < 4)
3387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#error Your compiler should upgrade to uc4
3487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#error	Known good compilers: 4.2.2
3587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#endif
3687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao
3787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetaoint main(void)
3887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao{
3987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TSK_ACTIVE_MM,	offsetof(struct task_struct, active_mm));
4087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	BLANK();
4187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_FLAGS,	offsetof(struct thread_info, flags));
4287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_PREEMPT,	offsetof(struct thread_info, preempt_count));
4387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_ADDR_LIMIT,	offsetof(struct thread_info, addr_limit));
4487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_TASK,		offsetof(struct thread_info, task));
4587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_EXEC_DOMAIN,	offsetof(struct thread_info, exec_domain));
4687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_CPU,		offsetof(struct thread_info, cpu));
4787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_CPU_SAVE,	offsetof(struct thread_info, cpu_context));
4887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_USED_CP,	offsetof(struct thread_info, used_cp));
4987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#ifdef CONFIG_UNICORE_FPU_F64
5087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(TI_FPSTATE,	offsetof(struct thread_info, fpstate));
5187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#endif
5287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	BLANK();
5387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R0,		offsetof(struct pt_regs, UCreg_00));
5487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R1,		offsetof(struct pt_regs, UCreg_01));
5587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R2,		offsetof(struct pt_regs, UCreg_02));
5687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R3,		offsetof(struct pt_regs, UCreg_03));
5787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R4,		offsetof(struct pt_regs, UCreg_04));
5887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R5,		offsetof(struct pt_regs, UCreg_05));
5987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R6,		offsetof(struct pt_regs, UCreg_06));
6087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R7,		offsetof(struct pt_regs, UCreg_07));
6187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R8,		offsetof(struct pt_regs, UCreg_08));
6287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R9,		offsetof(struct pt_regs, UCreg_09));
6387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R10,		offsetof(struct pt_regs, UCreg_10));
6487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R11,		offsetof(struct pt_regs, UCreg_11));
6587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R12,		offsetof(struct pt_regs, UCreg_12));
6687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R13,		offsetof(struct pt_regs, UCreg_13));
6787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R14,		offsetof(struct pt_regs, UCreg_14));
6887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R15,		offsetof(struct pt_regs, UCreg_15));
6987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R16,		offsetof(struct pt_regs, UCreg_16));
7087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R17,		offsetof(struct pt_regs, UCreg_17));
7187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R18,		offsetof(struct pt_regs, UCreg_18));
7287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R19,		offsetof(struct pt_regs, UCreg_19));
7387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R20,		offsetof(struct pt_regs, UCreg_20));
7487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R21,		offsetof(struct pt_regs, UCreg_21));
7587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R22,		offsetof(struct pt_regs, UCreg_22));
7687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R23,		offsetof(struct pt_regs, UCreg_23));
7787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R24,		offsetof(struct pt_regs, UCreg_24));
7887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R25,		offsetof(struct pt_regs, UCreg_25));
7987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_R26,		offsetof(struct pt_regs, UCreg_26));
8087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_FP,		offsetof(struct pt_regs, UCreg_fp));
8187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_IP,		offsetof(struct pt_regs, UCreg_ip));
8287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_SP,		offsetof(struct pt_regs, UCreg_sp));
8387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_LR,		offsetof(struct pt_regs, UCreg_lr));
8487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_PC,		offsetof(struct pt_regs, UCreg_pc));
8587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_PSR,		offsetof(struct pt_regs, UCreg_asr));
8687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_OLD_R0,	offsetof(struct pt_regs, UCreg_ORIG_00));
8787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(S_FRAME_SIZE,	sizeof(struct pt_regs));
8887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	BLANK();
8987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(VMA_VM_MM,	offsetof(struct vm_area_struct, vm_mm));
9087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(VMA_VM_FLAGS,	offsetof(struct vm_area_struct, vm_flags));
9187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	BLANK();
9287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(VM_EXEC,		VM_EXEC);
9387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	BLANK();
9487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(PAGE_SZ,		PAGE_SIZE);
9587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	BLANK();
9687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(SYS_ERROR0,	0x9f0000);
9787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	BLANK();
9887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(PBE_ADDRESS,		offsetof(struct pbe, address));
9987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(PBE_ORIN_ADDRESS,	offsetof(struct pbe, orig_address));
10087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(PBE_NEXT,		offsetof(struct pbe, next));
10187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(SWSUSP_CPU,		offsetof(struct swsusp_arch_regs, \
10287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao							cpu_context));
10387c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#ifdef	CONFIG_UNICORE_FPU_F64
10487c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(SWSUSP_FPSTATE,		offsetof(struct swsusp_arch_regs, \
10587c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao							fpstate));
10687c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao#endif
10787c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	BLANK();
10887c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(DMA_BIDIRECTIONAL,	DMA_BIDIRECTIONAL);
10987c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(DMA_TO_DEVICE,		DMA_TO_DEVICE);
11087c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	DEFINE(DMA_FROM_DEVICE,		DMA_FROM_DEVICE);
11187c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao	return 0;
11287c1a3fb7c07322dfd63a63dd6d42339ad52ddeeGuanXuetao}
113