如何获得内核linux下运行的可执行的二进制文件? [英] How does kernel get an executable binary file running under linux?

查看:553
本文介绍了如何获得内核linux下运行的可执行的二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何内核得到一个可执行的二进制文件在Linux下运行?

How does kernel get an executable binary file running under linux?

这似乎是一个简单的问题,但任何人都可以帮我深挖?该文件是如何加载到内存以及如何执行code上手?

It seems a simple question, but anyone can help me dig deep? How the file is loaded to memory and how execution code get started?

谁能帮助我,告诉什么是一步一步发生的?

Can anyone help me and tell what's happening step by step?

推荐答案

从的 = http://en.wikipedia.org/wiki/Linux_kernel\">linux内核是相关的。该系统调用(或者的vfork 克隆)用于创建新的进程,类似于呼叫一个(每个Linux用户空间的过程,除了的init 通过或朋友)。该 的execve系统调用用新的(基本上是由的mmap -ing从ELF可执行文件和匿名段段,然后初始化寄存器,包括堆栈指针)。该的x86-64 ABI补充和的 Linux的装配HOWTO 透露详情。

Two system calls from the linux kernel are relevant. The fork system call (or perhaps vfork or clone) is used to create a new process, similar to the calling one (every Linux user-land process except init is created by fork or friends). The execve system call replace the process address space by a fresh one (essentially by sort-of mmap-ing segments from the ELF executable and anonymous segments, then initializing the registers, including the stack pointer). The x86-64 ABI supplement and the Linux assembly howto give details.

该动态链接后的execve 发生,涉及 /lib/x86_64-linux-gnu/ld-2.13.so 文件,该文件为ELF被看作是一个跨preTER。

The dynamic linking happens after execve and involves the /lib/x86_64-linux-gnu/ld-2.13.so file, which for ELF is viewed as an "interpreter".

这篇关于如何获得内核linux下运行的可执行的二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆