第0章Linux环境到内核基础知识
#include<stdio.h>
int main(void)
{
printf("hello world\n");
return 0;
}
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x4003c0
Start of program headers: 64 (bytes into file)
Start of section headers: 2560 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 8
Size of section headers: 64 (bytes)
Number of section headers: 29
Section header string table index: 26
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .interp PROGBITS 0000000000400200 00000200
000000000000001c 0000000000000000 A 0 0 1
[ 2] .note.ABI-tag NOTE 000000000040021c 0000021c
0000000000000020 0000000000000000 A 0 0 4
[ 3] .hash HASH 0000000000400240 00000240
0000000000000024 0000000000000004 A 4 0 8
[ 4] .dynsym DYNSYM 0000000000400268 00000268
0000000000000060 0000000000000018 A 5 1 8
[ 5] .dynstr STRTAB 00000000004002c8 000002c8
000000000000003d 0000000000000000 A 0 0 1
[ 6] .gnu.version VERSYM 0000000000400306 00000306
0000000000000008 0000000000000002 A 4 0 2
[ 7] .gnu.version_r VERNEED 0000000000400310 00000310
0000000000000020 0000000000000000 A 5 1 8
[ 8] .rela.dyn RELA 0000000000400330 00000330
0000000000000018 0000000000000018 A 4 0 8
[ 9] .rela.plt RELA 0000000000400348 00000348
0000000000000030 0000000000000018 A 4 11 8
[10] .init PROGBITS 0000000000400378 00000378
0000000000000018 0000000000000000 AX 0 0 4
[11] .plt PROGBITS 0000000000400390 00000390
0000000000000030 0000000000000010 AX 0 0 4
[12] .text PROGBITS 00000000004003c0 000003c0
0000000000000258 0000000000000000 AX 0 0 16
[13] .fini PROGBITS 0000000000400618 00000618
000000000000000e 0000000000000000 AX 0 0 4
[14] .rodata PROGBITS 0000000000400628 00000628
0000000000000010 0000000000000000 A 0 0 4
[15] .eh_frame_hdr PROGBITS 0000000000400638 00000638
0000000000000024 0000000000000000 A 0 0 4
[16] .eh_frame PROGBITS 0000000000400660 00000660
000000000000007c 0000000000000000 A 0 0 8
[17] .ctors PROGBITS 00000000006006e0 000006e0
0000000000000010 0000000000000000 WA 0 0 8
[18] .dtors PROGBITS 00000000006006f0 000006f0
0000000000000010 0000000000000000 WA 0 0 8
[19] .jcr PROGBITS 0000000000600700 00000700
0000000000000008 0000000000000000 WA 0 0 8
[20] .dynamic DYNAMIC 0000000000600708 00000708
0000000000000190 0000000000000010 WA 5 0 8
[21] .got PROGBITS 0000000000600898 00000898
0000000000000008 0000000000000008 WA 0 0 8
[22] .got.plt PROGBITS 00000000006008a0 000008a0
0000000000000028 0000000000000008 WA 0 0 8
[23] .data PROGBITS 00000000006008c8 000008c8
0000000000000010 0000000000000000 WA 0 0 8
[24] .bss NOBITS 00000000006008d8 000008d8
0000000000000010 0000000000000000 WA 0 0 8
[25] .comment PROGBITS 0000000000000000 000008d8
000000000000003e 0000000000000001 MS 0 0 1
[26] .shstrtab STRTAB 0000000000000000 00000916
00000000000000e7 0000000000000000 0 0 1
[27] .symtab SYMTAB 0000000000000000 00001140
0000000000000660 0000000000000018 28 47 8
[28] .strtab STRTAB 0000000000000000 000017a0
000000000000025b 0000000000000000 0 0 1
execve("./hello", ["./hello"], [/* 41 vars */]) = 0
brk(0) = 0x151b000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f30733ef000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=62458, ...}) = 0
mmap(NULL, 62458, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f30733df000
close(3)= 0
open("/lib64/libc.so.6", O_RDONLY) = 3 //加载c语言库
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\356!\2478\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1928936, ...}) = 0
mmap(0x38a7200000, 3750184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x38a7200000
mprotect(0x38a738a000, 2097152, PROT_NONE) = 0
mmap(0x38a758a000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18a000) = 0x38a758a000
mmap(0x38a7590000, 14632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x38a7590000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f30733de000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f30733dd000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f30733dc000
arch_prctl(ARCH_SET_FS, 0x7f30733dd700) = 0
mprotect(0x38a758a000, 16384, PROT_READ) = 0
mprotect(0x38a701f000, 4096, PROT_READ) = 0
munmap(0x7f30733df000, 62458) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f30733ee000
write(1, "hello world\n", 12hello world
) = 12
exit_group(0) = ?
+++ exited with 0 +++
int __open_nocancel(const char *file,int oflag,...)
{
int mode=0;if(oflagO_CREAT)
{va_list arg;
va_start(arg,oflag);
mode=va_arg(arg,int);
va_end(arg);
}
//系统调用编号
return INLINE_SYSCALL(openat,4,AT_FDCWD,file,oflag,mode);
}
# define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \
register unsigned int resultvar; \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
"movl %1, %%eax\n\t" \
"int $0x80\n\t" \
RESTOREARGS_##nr \
: "=a" (resultvar) \
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; })
第0章Linux环境到内核基础知识的更多相关文章
- 【菜鸟学习Linux】-第三章- Linux环境搭建-使用VMware9安装Ubuntu 12.04系统
上一步,我们安装了VMware9虚拟机,现在我们就是用它来安装Ubuntu12.04系统,至于Ubuntu是什么,我就不废话了,大家google一下,比我讲的清楚,好了,开始干活! Ubuntu官网下 ...
- 【RL-TCPnet网络教程】第38章 TFTP简单文件传输基础知识
第38章 TFTP简单文件传输基础知识 本章节为大家讲解TFTP(Trivial File Transfer Protocol,简单文件传输协议)的基础知识,方便后面章节的实战操作. (本章 ...
- 【RL-TCPnet网络教程】第16章 UDP用户数据报协议基础知识
第16章 UDP用户数据报协议基础知识 本章节为大家讲解UDP(User Datagram Protocol,用户数据报协议),需要大家对UDP有个基础的认识,方便后面章节UDP实战操作. ...
- 【STM32H7教程】第47章 STM32H7的FMC总线基础知识和HAL库API
完整教程下载地址:http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第47章 STM32H7的FMC总线基础知识和HA ...
- 【RL-TCPnet网络教程】第41章 HTTP超文本传输协议基础知识
第41章 HTTP超文本传输协议基础知识 本章节为大家讲解HTTP(HyperText Transfer Protocol,超文本传输协议),从本章节开始,正式进入嵌入式Web的设计和学习. ...
- 【STM32H7教程】第32章 STM32H7的TIM定时器基础知识和HAL库API
完整教程下载地址:http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第32章 STM32H7的TIM定时器基础知识和H ...
- 【STM32H7教程】第29章 STM32H7的USART串口基础知识和HAL库API
完整教程下载地址:http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第29章 STM32H7的USART串口基础知识和 ...
- Windows内核基础知识-1-段寄存器
Windows内核基础知识-1-段寄存器 学过汇编的应该都知道段寄存器,在Windows里段寄存器有很多,之前可能只接触了ds数据段,cs 代码段这种,今天这个博客就介绍Windows一些比较常用的段 ...
- Windows内核基础知识-2-段描述符
Windows内核基础知识-2-段描述符 比如: ES 002B 0(FFFFFFFF) 意思就是es段寄存器,段选择子/段选择符 为002B, 起始地址base为0, 限制范围Limit地址最大能寻 ...
随机推荐
- [51Nod] 1218 最长递增子序列 V2
如何判断一个元素是否一定在LIS中?设f[i]为以ai结尾的LIS长度,g[i]为以ai开头的LIS长度,若f[i]+g[i]-1==总LIS,那么i就一定在LIS中出现 显然只出现一次的元素一定是必 ...
- MySQL中文转换成拼音的函数
CREATE DEFINER=`root`@`localhost` FUNCTION `fristPinyin`(`P_NAME` VARCHAR(255) CHARSET utf8) RETURNS ...
- DeepFaceLab小白入门(6):脸部替换以及合成视频!
前面的都是准备工作,这个环节才是真的换脸.换脸主要分两部分,1,图片换脸,2,把图片合成视频. 7) convert H64 debug.bat 这个环节是和训练环节相对于的,比如我们之前选的是H64 ...
- 用Python手把手教你搭建一个web框架-flask微框架!
在之前的文章当中,小编已经教过大家怎么搭建一个Django框架,今天我们来探索另外的一种框架的搭建,这个框架就是web框架-flask微框架啦!首先我们带着以下的几个问题来阅读本文: 1.flask是 ...
- linux下安装mysql并设置远程连接
腾讯云环境为Centos7.4 mysql版本为5.6 本次安装使用yum安装 检查是否已有mysql: yum list installed | grep mysql 下载yum源文件: wge ...
- 浅谈内核的Makefile、Kconfig和.config文件
Linux内核源码文件繁多,搞不清Makefile.Kconfig..config间的关系,不了解内核编译体系,编译修改内核有问题无从下手,自己写的驱动不知道怎么编进内核,不知道怎么配置内核,这些问题 ...
- Django基于Pycharm开发之一【创建django工程】
Django的工程结构,可以通过pycharm里面,选择创建django工程来直接创建,也可以通过命令行通过pip来安装. 一.通过命令行安装的步骤 Install Python. Install a ...
- HashMap的C++实现
#include <iostream> #include <cstring> #include <string> typedef unsigned int SIZE ...
- 转:Generating PDFs from Web Pages on the Fly with jsPDF
The Portable Document Format has been one the major innovations in the fields of desktop publishing ...
- 【转载】logistic回归
原文地址:https://www.cnblogs.com/zichun-zeng/p/3824745.html 1. logistic回归与一般线性回归模型的区别: (1) 线性回归的结果变量 ...