a.out.h 头文件分析 \linux-1.0\linux\include\linux\a.out.h

#ifndef __A_OUT_GNU_H__
#define __A_OUT_GNU_H__#define __GNU_EXEC_MACROS__#ifndef __STRUCT_EXEC_OVERRIDE__//定义执行文件结构
struct exec
{unsigned long a_info;		/* Use macros N_MAGIC, etc for access */unsigned a_text;		/* length of text, in bytes */unsigned a_data;		/* length of data, in bytes */unsigned a_bss;		/* length of uninitialized data area for file, in bytes */unsigned a_syms;		/* length of symbol table data in file, in bytes */unsigned a_entry;		/* start address */unsigned a_trsize;		/* length of relocation info for text, in bytes */unsigned a_drsize;		/* length of relocation info for data, in bytes */
};#endif /* __STRUCT_EXEC_OVERRIDE__ *///机器类型设定
/* these go in the N_MACHTYPE field */
enum machine_type {
#if defined (M_OLDSUN2)M__OLDSUN2 = M_OLDSUN2,
#elseM_OLDSUN2 = 0,
#endif
#if defined (M_68010)M__68010 = M_68010,
#elseM_68010 = 1,
#endif
#if defined (M_68020)M__68020 = M_68020,
#elseM_68020 = 2,
#endif
#if defined (M_SPARC)M__SPARC = M_SPARC,
#elseM_SPARC = 3,
#endif/* skip a bunch so we don't run into any of sun's numbers */M_386 = 100,
};//定义MAGIC地址为32位的有效值。0-16位
#if !defined (N_MAGIC)
#define N_MAGIC(exec) ((exec).a_info & 0xffff)
#endif//获取机器类型 16-23位
#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))//标记 24-31位
#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)//设定Magic,机器类型,标记
#define N_SET_INFO(exec, magic, type, flags) \((exec).a_info = ((magic) & 0xffff) \| (((int)(type) & 0xff) << 16) \| (((flags) & 0xff) << 24))//单独设定Magic值
#define N_SET_MAGIC(exec, magic) \((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))//设定机器类型
#define N_SET_MACHTYPE(exec, machtype) \((exec).a_info = \((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))//设定机器标记
#define N_SET_FLAGS(exec, flags) \((exec).a_info = \((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))//不纯净的执行方式
/* Code indicating object file or impure executable.  */
#define OMAGIC 0407//纯净的执行方式
/* Code indicating pure executable.  */
#define NMAGIC 0410//需求页执行方式
/* Code indicating demand-paged executable.  */
#define ZMAGIC 0413//带有头文件的需求页执行方式
/* This indicates a demand-paged executable with the header in the text. The first page is unmapped to help trap NULL pointer references */
#define QMAGIC 0314//核心文件执行方式
/* Code indicating core file.  */
#define CMAGIC 0421//判断是不是没有定义的执行方式 1为该执行方式没有定义 0为已经定义的执行方式
#if !defined (N_BADMAG)
#define N_BADMAG(x)	  (N_MAGIC(x) != OMAGIC	\&& N_MAGIC(x) != NMAGIC	\&& N_MAGIC(x) != ZMAGIC \&& N_MAGIC(x) != QMAGIC)
#endif//获取1024空间存放程序信息后的剩余的大小。
#define _N_HDROFF(x) (1024 - sizeof (struct exec))//获取TEXT文本的偏移地址
//如果为按需求页执行方式(ZMAGIC); 剩余文本空间为1024;
//如果为带有头文件的需求页执行方式(QMAGIC); 剩余文本空间为0;
//如果2者都不是 剩余文本空间为执行程序空间的大小;
#if !defined (N_TXTOFF)
#define N_TXTOFF(x) \(N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \(N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
#endif//获取DATA数据的偏移地址
#if !defined (N_DATOFF)
#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
#endif//获取重新配置Text数据的偏移地址
#if !defined (N_TRELOFF)
#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
#endif//获取重新配置dat啊数据的偏移地址
#if !defined (N_DRELOFF)
#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
#endif//获取标志表数据的偏移地址
#if !defined (N_SYMOFF)
#define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize)
#endif//获取BSS数据的偏移地址
#if !defined (N_STROFF)
#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
#endif//TEXT地址 如果为 带有头文件的需求页执行方式 地址为4096  不是为0
/* Address of text segment in memory after it is loaded.  */
#if !defined (N_TXTADDR)
#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
#endif//段的大小设定
/* Address of data segment in memory after it is loaded.Note that it is up to you to define SEGMENT_SIZEon machines not listed here.  */
#if defined(vax) || defined(hp300) || defined(pyr)
#define SEGMENT_SIZE page_size
#endif
#ifdef	sony
#define	SEGMENT_SIZE	0x2000  //8192
#endif	/* Sony.  */
#ifdef is68k
#define SEGMENT_SIZE 0x20000   //131072
#endif
#if defined(m68k) && defined(PORTAR)
#define PAGE_SIZE 0x400              //1024
#define SEGMENT_SIZE PAGE_SIZE       //4096
#endif//linux段的大小设定 1024
#ifdef linux
#include <linux/page.h>
#define SEGMENT_SIZE	1024
#endif//段的大小。需要段X×每个段的大小
#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))//执行程序Text文件的结束点。
#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)//获取执行程序DATA数据的地址 
//如果为不纯净的执行方式 在TEXT文件结束点;
//如果为非 地址为X的TEXT位置×每个段的大小
#ifndef N_DATADDR
#define N_DATADDR(x) \(N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \: (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
#endif/* Address of bss segment in memory after it is loaded.  */
//获取执行程序BSS数据的地址 
#if !defined (N_BSSADDR)
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
#endif//定义nList列表结构
#if !defined (N_NLIST_DECLARED)
struct nlist {union {char *n_name;struct nlist *n_next;long n_strx;} n_un;                 //统一4位的unionunsigned char n_type;  //列表类型char n_other;          //列表它项short n_desc;          //减少值unsigned long n_value; //列表值
};
#endif /* no N_NLIST_DECLARED.  *///定义必要的宏!
#if !defined (N_UNDF)
#define N_UNDF 0
#endif
#if !defined (N_ABS)
#define N_ABS 2
#endif
#if !defined (N_TEXT)
#define N_TEXT 4
#endif
#if !defined (N_DATA)
#define N_DATA 6
#endif
#if !defined (N_BSS)
#define N_BSS 8
#endif
#if !defined (N_FN)
#define N_FN 15
#endif#if !defined (N_EXT)
#define N_EXT 1
#endif
#if !defined (N_TYPE)
#define N_TYPE 036
#endif
#if !defined (N_STAB)
#define N_STAB 0340
#endif/* The following type indicates the definition of a symbol as beingan indirect reference to another symbol.  The other symbolappears as an undefined reference, immediately following this symbol.Indirection is asymmetrical.  The other symbol's value will be usedto satisfy requests for the indirect symbol, but not vice versa.If the other symbol does not have a definition, libraries willbe searched to find a definition.  */
#define N_INDR 0xa/* The following symbols refer to set elements.All the N_SET[ATDB] symbols with the same name form one set.Space is allocated for the set in the text section, and each setelement's value is stored into one word of the space.The first word of the space is the length of the set (number of elements).The address of the set is made into an N_SETV symbolwhose name is the same as the name of the set.This symbol acts like a N_DATA global symbolin that it can satisfy undefined external references.  *///元素标记
/* These appear as input to LD, in a .o file.  */
#define	N_SETA	0x14		/* Absolute set element symbol */
#define	N_SETT	0x16		/* Text set element symbol */
#define	N_SETD	0x18		/* Data set element symbol */
#define	N_SETB	0x1A		/* Bss set element symbol *//* This is output from LD.  */
#define N_SETV	0x1C		/* Pointer to set vector in data area.  */#if !defined (N_RELOCATION_INFO_DECLARED)
/* This structure describes a single relocation to be performed.The text-relocation section of the file is a vector of these structures,all of which apply to the text section.Likewise, the data-relocation section applies to the data section.  *///重新分配信息结构8位,2整数大小
struct relocation_info
{//重新分配地址/* Address (within segment) to be relocated.  */int r_address;//标号数/* The meaning of r_symbolnum depends on r_extern.  */unsigned int r_symbolnum:24;//pcrel偏移位/* Nonzero means value is a pc-relative offsetand it should be relocated for changes in its own addressas well as for changes in the symbol or section specified.  */unsigned int r_pcrel:1;//分配域的长度/* Length (as exponent of 2) of the field to be relocated.Thus, a value of 2 indicates 1<<2 bytes.  */unsigned int r_length:2;//扩展位/* 1 => relocate with value of symbol.r_symbolnum is the index of the symbolin file's the symbol table.0 => relocate with the address of a segment.r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS(the N_EXT bit may be set also, but signifies nothing).  */ unsigned int r_extern:1;//pad值/* Four bits that aren't used, but when writing an object fileit is desirable to clear them.  */
#ifdef NS32Kunsigned r_bsr:1;unsigned r_disp:1;unsigned r_pad:2;
#elseunsigned int r_pad:4;
#endif
};
#endif /* no N_RELOCATION_INFO_DECLARED.  */#endif /* __A_OUT_GNU_H__ */

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/462391.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

[TypeScript] vs code TSLint常见错误解决方案

TSLint是一个Typescrip{过滤}t验证工具&#xff0c;用于检测代码。 TSLint: comment must start with a space (comment-format)注释必须从一个空格开始(comment-format)也就是说//之后必须跟随一个空格。“Missing semicolon.” : “缺少分号.”,“Use the function form of \…

ios开发笔记之 线程间通信

performSelectorOnMainThread:selector:waitUntilDone: 用于线程间通信 使两个线程同步或者时异步执行。 block阻塞转载于:https://www.cnblogs.com/vincent-lu/archive/2011/11/29/2267974.html

SQL Cookbook—数字、日期

1、计算不包含最大值和最小值的均值2、把字母数字串转换为数值3、更改累计和中的值–显示存款或取款后的值4、加减日、月、年5、计算两个日期之间的天数6、确定两个日期之间的工作日数目表EMP中&#xff0c;计算BLAKE和JONES的hiredate&#xff08;聘用日期&#xff09;之间的工…

file_table.c 文件分析 linux1_0\linux\fs\file_table.c

/** linux/fs/file_table.c** Copyright (C) 1991, 1992 Linus Torvalds*/#include <linux/fs.h> #include <linux/string.h> #include <linux/mm.h>struct file * first_file; //开头文件. int nr_files 0; //文件位置为0//文件双向链表插入文…

Day 16 包 json模块和os模块

目录 包什么是包包被导入时发生的三件事包和模块的区别相对路径和绝对路径json模块OS模块列出目录下所有文件重命名文件删除文件拼接路径判断是否为文件判断是否为文件夹判断文件是否存在新建文件夹包 什么是包 包就是里一个文件夹,里面存放了多个模块,并且包会自带__init__.py…

人的左右脑

右脑支配左手、左脚、左耳等人体的左半身神经和感觉&#xff0c;而左脑支配右半身的神经和感觉&#xff0c;正如实验一所表明的&#xff0c;右视野同左脑&#xff0c;左视野同右脑相连。因为语言中枢在左脑&#xff0c;所以左脑主要完成语言的、逻辑的、分析的、代数的思考认识…

DevExpress控件使用经验总结

DevExpress控件使用经验总结 DevExpress是一个比较有名的界面控件套件&#xff0c;提供了一系列的界面控件套件的DotNet界面控件。本文主要介绍我在使用DevExpress控件过程中&#xff0c;遇到或者发现的一些问题解决方案&#xff0c;或者也可以所示一些小的经验总结。总体来讲&…

struct task_struct 结构分析 \linux-1.0\linux\include\linux\sched.h

//任务机构体&#xff0c;大小大概1024字节 struct task_struct {/* these are hardcoded - dont touch */ //硬件代码 不可被修改volatile long state; //状态标志 /* -1 unrunnable, 0 runnable, >0 stopped */ long counter; //计数long priority; //…

mysql基础14(关于mysql数据库在没有主键情况下去除重复数据办法)

关于mysql数据库在没有主键情况下去除重复数据办法 约定 表名:mat 根据 cat 字段去重 新增加主键为 id 步骤 1、为mat新增一列自增主键 alter table mat add column id int(11) PRIMARY KEY AUTO_INCREMENT; 2、根据cat字段分组&#xff0c;找到数量大于1的&#xff0c;…

ctype.h,ctype.c 结构分析 \linux-1.0\linux\include\linux\ctype

\linux-1.0\linux\include\linux\ctype.h #ifndef _LINUX_CTYPE_H #define _LINUX_CTYPE_H#define _U 0x01 /* upper */ //大写字母 #define _L 0x02 /* lower */ //小写字母 #define _D 0x04 /* digit */ //数字 #define _C 0x08 /* cntrl */ //控制按键 #define _P 0x10 …

AaronYang WCF教程目录

原创&#xff0c;讲究实践 1. 那天有个小孩教我WCF[一][1/3] 基本搭建 阅读 2013年6月27日1:29:02 2. 那天有个小孩教我WCF[一][2/3] 基本竣工 阅读 2013年6月29日01:30:22 3. 那天有个小孩教我WCF[一][3/3] 第二种代理引用服务&#xff0c;小…

plsql中文乱码 显示问号

输入sql语句select * from V$NLS_PARAMETERS查看字符集&#xff0c;查看第一行value值是否为简体中文 解决方案&#xff1a; 新增环境变量 变量名&#xff1a; NLS_LANG 变量值: SIMPLIFIED CHINESE_CHINA.ZHS16GBK 重启PL/SQL 解决 转载于:https://www.cnblogs.com/tonyzt/p/1…

第二阶段团队绩效评分

第二阶段评分结果&#xff1a; 转载于:https://www.cnblogs.com/xczd/p/11068692.html

从最大似然到EM算法浅解(转载)

http://blog.csdn.net/zouxy09/article/details/8537620#comments转载于:https://www.cnblogs.com/zhihaowang/p/10128356.html

Shanghai Barcamp

早上起来晚了&#xff0c;晚睡晚起的习惯很不好&#xff01;总是有段时间会养成这样的不好习惯&#xff0c;过一段时间又会早睡早起。总结的说&#xff0c;去了还是有不少收获的&#xff0c;而且刚好就在前一段时间看了不少关于vc和初期投资培养方面的知识&#xff0c;结果这次…

我的虚拟机上网记录

联网时把虚拟机设置成共享IP模式就可以。如果要通过NFS链接开发板就选择桥接网络

随堂小测冲刺.第19天

我们小组的logo出来的&#xff0c;太酷了&#xff0c;不符合我的审美&#xff0c;本人表示无法接受。。。 还要谢谢李泽宇的女盆友&#xff0c;O(∩_∩)O哈哈~ 转载于:https://www.cnblogs.com/daisy99lijing/p/11024465.html

对象存储系统Swift官方文档

对象存储系统Swift技术详解&#xff1a;综述与概念 OpenStack Object Storage (Swift) 是用来创建冗余的、可扩展的对象存储&#xff08;引擎&#xff09;的开源软件。通过阅读Swift的技术文档&#xff0c;我们可以理解其中的设计的原理和实现的方法 。 Swift项目已经进展有两年…

MSBuild编译扩展

新增一个C#工程&#xff0c;用记事本打开工程文件&#xff08;.csproj结尾&#xff09;&#xff0c;滚动条拉到最后&#xff0c;大家可以看到一段如下的代码&#xff0c;其中<Target Name"BeforeBuild">和<Target Name"AfterBuild">大家根据名…

电影bt

电影&#xff1a; http://www.bttiantang.com/