Path: blob/master/arch/parisc/kernel/asm-offsets.c
10817 views
/*1* Generate definitions needed by assembly language modules.2* This code generates raw asm output which is post-processed to extract3* and format the required data.4*5* Copyright (C) 2000-2001 John Marvin <jsm at parisc-linux.org>6* Copyright (C) 2000 David Huggins-Daines <dhd with pobox.org>7* Copyright (C) 2000 Sam Creasey <[email protected]>8* Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org>9* Copyright (C) 2001 Paul Bame <bame at parisc-linux.org>10* Copyright (C) 2001 Richard Hirst <rhirst at parisc-linux.org>11* Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>12* Copyright (C) 2003 James Bottomley <jejb at parisc-linux.org>13*14* This program is free software; you can redistribute it and/or modify15* it under the terms of the GNU General Public License as published by16* the Free Software Foundation; either version 2 of the License, or17* (at your option) any later version.18*19* This program is distributed in the hope that it will be useful,20* but WITHOUT ANY WARRANTY; without even the implied warranty of21* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the22* GNU General Public License for more details.23*24* You should have received a copy of the GNU General Public License25* along with this program; if not, write to the Free Software26* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA27*/2829#include <linux/types.h>30#include <linux/sched.h>31#include <linux/thread_info.h>32#include <linux/ptrace.h>33#include <linux/hardirq.h>34#include <linux/kbuild.h>3536#include <asm/pgtable.h>37#include <asm/ptrace.h>38#include <asm/processor.h>39#include <asm/pdc.h>40#include <asm/uaccess.h>4142#ifdef CONFIG_64BIT43#define FRAME_SIZE 12844#else45#define FRAME_SIZE 6446#endif47#define FRAME_ALIGN 644849/* Add FRAME_SIZE to the size x and align it to y. All definitions50* that use align_frame will include space for a frame.51*/52#define align_frame(x,y) (((x)+FRAME_SIZE+(y)-1) - (((x)+(y)-1)%(y)))5354int main(void)55{56DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack));57DEFINE(TASK_STATE, offsetof(struct task_struct, state));58DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));59DEFINE(TASK_SIGPENDING, offsetof(struct task_struct, pending));60DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));61DEFINE(TASK_MM, offsetof(struct task_struct, mm));62DEFINE(TASK_PERSONALITY, offsetof(struct task_struct, personality));63DEFINE(TASK_PID, offsetof(struct task_struct, pid));64BLANK();65DEFINE(TASK_REGS, offsetof(struct task_struct, thread.regs));66DEFINE(TASK_PT_PSW, offsetof(struct task_struct, thread.regs.gr[ 0]));67DEFINE(TASK_PT_GR1, offsetof(struct task_struct, thread.regs.gr[ 1]));68DEFINE(TASK_PT_GR2, offsetof(struct task_struct, thread.regs.gr[ 2]));69DEFINE(TASK_PT_GR3, offsetof(struct task_struct, thread.regs.gr[ 3]));70DEFINE(TASK_PT_GR4, offsetof(struct task_struct, thread.regs.gr[ 4]));71DEFINE(TASK_PT_GR5, offsetof(struct task_struct, thread.regs.gr[ 5]));72DEFINE(TASK_PT_GR6, offsetof(struct task_struct, thread.regs.gr[ 6]));73DEFINE(TASK_PT_GR7, offsetof(struct task_struct, thread.regs.gr[ 7]));74DEFINE(TASK_PT_GR8, offsetof(struct task_struct, thread.regs.gr[ 8]));75DEFINE(TASK_PT_GR9, offsetof(struct task_struct, thread.regs.gr[ 9]));76DEFINE(TASK_PT_GR10, offsetof(struct task_struct, thread.regs.gr[10]));77DEFINE(TASK_PT_GR11, offsetof(struct task_struct, thread.regs.gr[11]));78DEFINE(TASK_PT_GR12, offsetof(struct task_struct, thread.regs.gr[12]));79DEFINE(TASK_PT_GR13, offsetof(struct task_struct, thread.regs.gr[13]));80DEFINE(TASK_PT_GR14, offsetof(struct task_struct, thread.regs.gr[14]));81DEFINE(TASK_PT_GR15, offsetof(struct task_struct, thread.regs.gr[15]));82DEFINE(TASK_PT_GR16, offsetof(struct task_struct, thread.regs.gr[16]));83DEFINE(TASK_PT_GR17, offsetof(struct task_struct, thread.regs.gr[17]));84DEFINE(TASK_PT_GR18, offsetof(struct task_struct, thread.regs.gr[18]));85DEFINE(TASK_PT_GR19, offsetof(struct task_struct, thread.regs.gr[19]));86DEFINE(TASK_PT_GR20, offsetof(struct task_struct, thread.regs.gr[20]));87DEFINE(TASK_PT_GR21, offsetof(struct task_struct, thread.regs.gr[21]));88DEFINE(TASK_PT_GR22, offsetof(struct task_struct, thread.regs.gr[22]));89DEFINE(TASK_PT_GR23, offsetof(struct task_struct, thread.regs.gr[23]));90DEFINE(TASK_PT_GR24, offsetof(struct task_struct, thread.regs.gr[24]));91DEFINE(TASK_PT_GR25, offsetof(struct task_struct, thread.regs.gr[25]));92DEFINE(TASK_PT_GR26, offsetof(struct task_struct, thread.regs.gr[26]));93DEFINE(TASK_PT_GR27, offsetof(struct task_struct, thread.regs.gr[27]));94DEFINE(TASK_PT_GR28, offsetof(struct task_struct, thread.regs.gr[28]));95DEFINE(TASK_PT_GR29, offsetof(struct task_struct, thread.regs.gr[29]));96DEFINE(TASK_PT_GR30, offsetof(struct task_struct, thread.regs.gr[30]));97DEFINE(TASK_PT_GR31, offsetof(struct task_struct, thread.regs.gr[31]));98DEFINE(TASK_PT_FR0, offsetof(struct task_struct, thread.regs.fr[ 0]));99DEFINE(TASK_PT_FR1, offsetof(struct task_struct, thread.regs.fr[ 1]));100DEFINE(TASK_PT_FR2, offsetof(struct task_struct, thread.regs.fr[ 2]));101DEFINE(TASK_PT_FR3, offsetof(struct task_struct, thread.regs.fr[ 3]));102DEFINE(TASK_PT_FR4, offsetof(struct task_struct, thread.regs.fr[ 4]));103DEFINE(TASK_PT_FR5, offsetof(struct task_struct, thread.regs.fr[ 5]));104DEFINE(TASK_PT_FR6, offsetof(struct task_struct, thread.regs.fr[ 6]));105DEFINE(TASK_PT_FR7, offsetof(struct task_struct, thread.regs.fr[ 7]));106DEFINE(TASK_PT_FR8, offsetof(struct task_struct, thread.regs.fr[ 8]));107DEFINE(TASK_PT_FR9, offsetof(struct task_struct, thread.regs.fr[ 9]));108DEFINE(TASK_PT_FR10, offsetof(struct task_struct, thread.regs.fr[10]));109DEFINE(TASK_PT_FR11, offsetof(struct task_struct, thread.regs.fr[11]));110DEFINE(TASK_PT_FR12, offsetof(struct task_struct, thread.regs.fr[12]));111DEFINE(TASK_PT_FR13, offsetof(struct task_struct, thread.regs.fr[13]));112DEFINE(TASK_PT_FR14, offsetof(struct task_struct, thread.regs.fr[14]));113DEFINE(TASK_PT_FR15, offsetof(struct task_struct, thread.regs.fr[15]));114DEFINE(TASK_PT_FR16, offsetof(struct task_struct, thread.regs.fr[16]));115DEFINE(TASK_PT_FR17, offsetof(struct task_struct, thread.regs.fr[17]));116DEFINE(TASK_PT_FR18, offsetof(struct task_struct, thread.regs.fr[18]));117DEFINE(TASK_PT_FR19, offsetof(struct task_struct, thread.regs.fr[19]));118DEFINE(TASK_PT_FR20, offsetof(struct task_struct, thread.regs.fr[20]));119DEFINE(TASK_PT_FR21, offsetof(struct task_struct, thread.regs.fr[21]));120DEFINE(TASK_PT_FR22, offsetof(struct task_struct, thread.regs.fr[22]));121DEFINE(TASK_PT_FR23, offsetof(struct task_struct, thread.regs.fr[23]));122DEFINE(TASK_PT_FR24, offsetof(struct task_struct, thread.regs.fr[24]));123DEFINE(TASK_PT_FR25, offsetof(struct task_struct, thread.regs.fr[25]));124DEFINE(TASK_PT_FR26, offsetof(struct task_struct, thread.regs.fr[26]));125DEFINE(TASK_PT_FR27, offsetof(struct task_struct, thread.regs.fr[27]));126DEFINE(TASK_PT_FR28, offsetof(struct task_struct, thread.regs.fr[28]));127DEFINE(TASK_PT_FR29, offsetof(struct task_struct, thread.regs.fr[29]));128DEFINE(TASK_PT_FR30, offsetof(struct task_struct, thread.regs.fr[30]));129DEFINE(TASK_PT_FR31, offsetof(struct task_struct, thread.regs.fr[31]));130DEFINE(TASK_PT_SR0, offsetof(struct task_struct, thread.regs.sr[ 0]));131DEFINE(TASK_PT_SR1, offsetof(struct task_struct, thread.regs.sr[ 1]));132DEFINE(TASK_PT_SR2, offsetof(struct task_struct, thread.regs.sr[ 2]));133DEFINE(TASK_PT_SR3, offsetof(struct task_struct, thread.regs.sr[ 3]));134DEFINE(TASK_PT_SR4, offsetof(struct task_struct, thread.regs.sr[ 4]));135DEFINE(TASK_PT_SR5, offsetof(struct task_struct, thread.regs.sr[ 5]));136DEFINE(TASK_PT_SR6, offsetof(struct task_struct, thread.regs.sr[ 6]));137DEFINE(TASK_PT_SR7, offsetof(struct task_struct, thread.regs.sr[ 7]));138DEFINE(TASK_PT_IASQ0, offsetof(struct task_struct, thread.regs.iasq[0]));139DEFINE(TASK_PT_IASQ1, offsetof(struct task_struct, thread.regs.iasq[1]));140DEFINE(TASK_PT_IAOQ0, offsetof(struct task_struct, thread.regs.iaoq[0]));141DEFINE(TASK_PT_IAOQ1, offsetof(struct task_struct, thread.regs.iaoq[1]));142DEFINE(TASK_PT_CR27, offsetof(struct task_struct, thread.regs.cr27));143DEFINE(TASK_PT_ORIG_R28, offsetof(struct task_struct, thread.regs.orig_r28));144DEFINE(TASK_PT_KSP, offsetof(struct task_struct, thread.regs.ksp));145DEFINE(TASK_PT_KPC, offsetof(struct task_struct, thread.regs.kpc));146DEFINE(TASK_PT_SAR, offsetof(struct task_struct, thread.regs.sar));147DEFINE(TASK_PT_IIR, offsetof(struct task_struct, thread.regs.iir));148DEFINE(TASK_PT_ISR, offsetof(struct task_struct, thread.regs.isr));149DEFINE(TASK_PT_IOR, offsetof(struct task_struct, thread.regs.ior));150BLANK();151DEFINE(TASK_SZ, sizeof(struct task_struct));152/* TASK_SZ_ALGN includes space for a stack frame. */153DEFINE(TASK_SZ_ALGN, align_frame(sizeof(struct task_struct), FRAME_ALIGN));154BLANK();155DEFINE(PT_PSW, offsetof(struct pt_regs, gr[ 0]));156DEFINE(PT_GR1, offsetof(struct pt_regs, gr[ 1]));157DEFINE(PT_GR2, offsetof(struct pt_regs, gr[ 2]));158DEFINE(PT_GR3, offsetof(struct pt_regs, gr[ 3]));159DEFINE(PT_GR4, offsetof(struct pt_regs, gr[ 4]));160DEFINE(PT_GR5, offsetof(struct pt_regs, gr[ 5]));161DEFINE(PT_GR6, offsetof(struct pt_regs, gr[ 6]));162DEFINE(PT_GR7, offsetof(struct pt_regs, gr[ 7]));163DEFINE(PT_GR8, offsetof(struct pt_regs, gr[ 8]));164DEFINE(PT_GR9, offsetof(struct pt_regs, gr[ 9]));165DEFINE(PT_GR10, offsetof(struct pt_regs, gr[10]));166DEFINE(PT_GR11, offsetof(struct pt_regs, gr[11]));167DEFINE(PT_GR12, offsetof(struct pt_regs, gr[12]));168DEFINE(PT_GR13, offsetof(struct pt_regs, gr[13]));169DEFINE(PT_GR14, offsetof(struct pt_regs, gr[14]));170DEFINE(PT_GR15, offsetof(struct pt_regs, gr[15]));171DEFINE(PT_GR16, offsetof(struct pt_regs, gr[16]));172DEFINE(PT_GR17, offsetof(struct pt_regs, gr[17]));173DEFINE(PT_GR18, offsetof(struct pt_regs, gr[18]));174DEFINE(PT_GR19, offsetof(struct pt_regs, gr[19]));175DEFINE(PT_GR20, offsetof(struct pt_regs, gr[20]));176DEFINE(PT_GR21, offsetof(struct pt_regs, gr[21]));177DEFINE(PT_GR22, offsetof(struct pt_regs, gr[22]));178DEFINE(PT_GR23, offsetof(struct pt_regs, gr[23]));179DEFINE(PT_GR24, offsetof(struct pt_regs, gr[24]));180DEFINE(PT_GR25, offsetof(struct pt_regs, gr[25]));181DEFINE(PT_GR26, offsetof(struct pt_regs, gr[26]));182DEFINE(PT_GR27, offsetof(struct pt_regs, gr[27]));183DEFINE(PT_GR28, offsetof(struct pt_regs, gr[28]));184DEFINE(PT_GR29, offsetof(struct pt_regs, gr[29]));185DEFINE(PT_GR30, offsetof(struct pt_regs, gr[30]));186DEFINE(PT_GR31, offsetof(struct pt_regs, gr[31]));187DEFINE(PT_FR0, offsetof(struct pt_regs, fr[ 0]));188DEFINE(PT_FR1, offsetof(struct pt_regs, fr[ 1]));189DEFINE(PT_FR2, offsetof(struct pt_regs, fr[ 2]));190DEFINE(PT_FR3, offsetof(struct pt_regs, fr[ 3]));191DEFINE(PT_FR4, offsetof(struct pt_regs, fr[ 4]));192DEFINE(PT_FR5, offsetof(struct pt_regs, fr[ 5]));193DEFINE(PT_FR6, offsetof(struct pt_regs, fr[ 6]));194DEFINE(PT_FR7, offsetof(struct pt_regs, fr[ 7]));195DEFINE(PT_FR8, offsetof(struct pt_regs, fr[ 8]));196DEFINE(PT_FR9, offsetof(struct pt_regs, fr[ 9]));197DEFINE(PT_FR10, offsetof(struct pt_regs, fr[10]));198DEFINE(PT_FR11, offsetof(struct pt_regs, fr[11]));199DEFINE(PT_FR12, offsetof(struct pt_regs, fr[12]));200DEFINE(PT_FR13, offsetof(struct pt_regs, fr[13]));201DEFINE(PT_FR14, offsetof(struct pt_regs, fr[14]));202DEFINE(PT_FR15, offsetof(struct pt_regs, fr[15]));203DEFINE(PT_FR16, offsetof(struct pt_regs, fr[16]));204DEFINE(PT_FR17, offsetof(struct pt_regs, fr[17]));205DEFINE(PT_FR18, offsetof(struct pt_regs, fr[18]));206DEFINE(PT_FR19, offsetof(struct pt_regs, fr[19]));207DEFINE(PT_FR20, offsetof(struct pt_regs, fr[20]));208DEFINE(PT_FR21, offsetof(struct pt_regs, fr[21]));209DEFINE(PT_FR22, offsetof(struct pt_regs, fr[22]));210DEFINE(PT_FR23, offsetof(struct pt_regs, fr[23]));211DEFINE(PT_FR24, offsetof(struct pt_regs, fr[24]));212DEFINE(PT_FR25, offsetof(struct pt_regs, fr[25]));213DEFINE(PT_FR26, offsetof(struct pt_regs, fr[26]));214DEFINE(PT_FR27, offsetof(struct pt_regs, fr[27]));215DEFINE(PT_FR28, offsetof(struct pt_regs, fr[28]));216DEFINE(PT_FR29, offsetof(struct pt_regs, fr[29]));217DEFINE(PT_FR30, offsetof(struct pt_regs, fr[30]));218DEFINE(PT_FR31, offsetof(struct pt_regs, fr[31]));219DEFINE(PT_SR0, offsetof(struct pt_regs, sr[ 0]));220DEFINE(PT_SR1, offsetof(struct pt_regs, sr[ 1]));221DEFINE(PT_SR2, offsetof(struct pt_regs, sr[ 2]));222DEFINE(PT_SR3, offsetof(struct pt_regs, sr[ 3]));223DEFINE(PT_SR4, offsetof(struct pt_regs, sr[ 4]));224DEFINE(PT_SR5, offsetof(struct pt_regs, sr[ 5]));225DEFINE(PT_SR6, offsetof(struct pt_regs, sr[ 6]));226DEFINE(PT_SR7, offsetof(struct pt_regs, sr[ 7]));227DEFINE(PT_IASQ0, offsetof(struct pt_regs, iasq[0]));228DEFINE(PT_IASQ1, offsetof(struct pt_regs, iasq[1]));229DEFINE(PT_IAOQ0, offsetof(struct pt_regs, iaoq[0]));230DEFINE(PT_IAOQ1, offsetof(struct pt_regs, iaoq[1]));231DEFINE(PT_CR27, offsetof(struct pt_regs, cr27));232DEFINE(PT_ORIG_R28, offsetof(struct pt_regs, orig_r28));233DEFINE(PT_KSP, offsetof(struct pt_regs, ksp));234DEFINE(PT_KPC, offsetof(struct pt_regs, kpc));235DEFINE(PT_SAR, offsetof(struct pt_regs, sar));236DEFINE(PT_IIR, offsetof(struct pt_regs, iir));237DEFINE(PT_ISR, offsetof(struct pt_regs, isr));238DEFINE(PT_IOR, offsetof(struct pt_regs, ior));239DEFINE(PT_SIZE, sizeof(struct pt_regs));240/* PT_SZ_ALGN includes space for a stack frame. */241DEFINE(PT_SZ_ALGN, align_frame(sizeof(struct pt_regs), FRAME_ALIGN));242BLANK();243DEFINE(TI_TASK, offsetof(struct thread_info, task));244DEFINE(TI_EXEC_DOMAIN, offsetof(struct thread_info, exec_domain));245DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));246DEFINE(TI_CPU, offsetof(struct thread_info, cpu));247DEFINE(TI_SEGMENT, offsetof(struct thread_info, addr_limit));248DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));249DEFINE(THREAD_SZ, sizeof(struct thread_info));250/* THREAD_SZ_ALGN includes space for a stack frame. */251DEFINE(THREAD_SZ_ALGN, align_frame(sizeof(struct thread_info), FRAME_ALIGN));252BLANK();253DEFINE(ICACHE_BASE, offsetof(struct pdc_cache_info, ic_base));254DEFINE(ICACHE_STRIDE, offsetof(struct pdc_cache_info, ic_stride));255DEFINE(ICACHE_COUNT, offsetof(struct pdc_cache_info, ic_count));256DEFINE(ICACHE_LOOP, offsetof(struct pdc_cache_info, ic_loop));257DEFINE(DCACHE_BASE, offsetof(struct pdc_cache_info, dc_base));258DEFINE(DCACHE_STRIDE, offsetof(struct pdc_cache_info, dc_stride));259DEFINE(DCACHE_COUNT, offsetof(struct pdc_cache_info, dc_count));260DEFINE(DCACHE_LOOP, offsetof(struct pdc_cache_info, dc_loop));261DEFINE(ITLB_SID_BASE, offsetof(struct pdc_cache_info, it_sp_base));262DEFINE(ITLB_SID_STRIDE, offsetof(struct pdc_cache_info, it_sp_stride));263DEFINE(ITLB_SID_COUNT, offsetof(struct pdc_cache_info, it_sp_count));264DEFINE(ITLB_OFF_BASE, offsetof(struct pdc_cache_info, it_off_base));265DEFINE(ITLB_OFF_STRIDE, offsetof(struct pdc_cache_info, it_off_stride));266DEFINE(ITLB_OFF_COUNT, offsetof(struct pdc_cache_info, it_off_count));267DEFINE(ITLB_LOOP, offsetof(struct pdc_cache_info, it_loop));268DEFINE(DTLB_SID_BASE, offsetof(struct pdc_cache_info, dt_sp_base));269DEFINE(DTLB_SID_STRIDE, offsetof(struct pdc_cache_info, dt_sp_stride));270DEFINE(DTLB_SID_COUNT, offsetof(struct pdc_cache_info, dt_sp_count));271DEFINE(DTLB_OFF_BASE, offsetof(struct pdc_cache_info, dt_off_base));272DEFINE(DTLB_OFF_STRIDE, offsetof(struct pdc_cache_info, dt_off_stride));273DEFINE(DTLB_OFF_COUNT, offsetof(struct pdc_cache_info, dt_off_count));274DEFINE(DTLB_LOOP, offsetof(struct pdc_cache_info, dt_loop));275BLANK();276DEFINE(TIF_BLOCKSTEP_PA_BIT, 31-TIF_BLOCKSTEP);277DEFINE(TIF_SINGLESTEP_PA_BIT, 31-TIF_SINGLESTEP);278BLANK();279DEFINE(ASM_PMD_SHIFT, PMD_SHIFT);280DEFINE(ASM_PGDIR_SHIFT, PGDIR_SHIFT);281DEFINE(ASM_BITS_PER_PGD, BITS_PER_PGD);282DEFINE(ASM_BITS_PER_PMD, BITS_PER_PMD);283DEFINE(ASM_BITS_PER_PTE, BITS_PER_PTE);284DEFINE(ASM_PGD_PMD_OFFSET, -(PAGE_SIZE << PGD_ORDER));285DEFINE(ASM_PMD_ENTRY, ((PAGE_OFFSET & PMD_MASK) >> PMD_SHIFT));286DEFINE(ASM_PGD_ENTRY, PAGE_OFFSET >> PGDIR_SHIFT);287DEFINE(ASM_PGD_ENTRY_SIZE, PGD_ENTRY_SIZE);288DEFINE(ASM_PMD_ENTRY_SIZE, PMD_ENTRY_SIZE);289DEFINE(ASM_PTE_ENTRY_SIZE, PTE_ENTRY_SIZE);290DEFINE(ASM_PFN_PTE_SHIFT, PFN_PTE_SHIFT);291DEFINE(ASM_PT_INITIAL, PT_INITIAL);292BLANK();293DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip));294DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space));295DEFINE(EXCDATA_ADDR, offsetof(struct exception_data, fault_addr));296BLANK();297DEFINE(ASM_PDC_RESULT_SIZE, NUM_PDC_RESULT * sizeof(unsigned long));298BLANK();299return 0;300}301302303