当前位置:网站首页>An executable binary file contains more than machine instructions
An executable binary file contains more than machine instructions
2022-07-03 09:50:00 【Brother gun plays embedded】
Why? Linux and Windows The executable of cannot be used universally ?
The main reasons are different formats and API Different , The former is more important .
An executable binary file contains more than machine instructions , It also includes various data 、 Program running resources , Machine instructions are only part of it .
One When an executable file is to be executed , The operating system needs to allocate resources , These resources include : Memory space ( Physical and virtual ), process 、 Thread resources and so on , The machine instructions of executable files are generally All in code snippets ( In assembly language, it is called text paragraph ), Other resources may be put into data segments and other segments .
there “ paragraph ”(segment) It can be roughly understood as a memory range . Operating system system (Windows/Linux) You need to know how much memory this executable needs , How many segments , Which memory addresses are loaded respectively . The executable needs to tell the operating system , Be enforceable Line file prepares what things it can run .
The article is relatively long , More words , You can first open the avatar and pay attention to me , Then take your time ,/// Insert a : At the beginning of this year, I recorded a set of systematic introductory single chip microcomputer tutorial , If you want, just ask me for it. It's free , I can send a private message ~ Click the black font in the lower left corner of my avatar and I can also get it . I've been relatively idle recently , Take me to finish the design , Take students to provincial or above competitions ///
Executable before execution , The operating system needs some preparation , Because of the different operating systems , Preparation is different , So the format of executable file is not exactly the same .Windows Most of the executable files on are PE Format ,Linux Most executable files in are ELF Format . Different formats lead to different executable files that cannot be used directly across platforms . This is one of the reasons .
Yes, of course , I've seen great gods on the Internet solve some problems with different formats , But cross platform operation still needs to solve another obstacle , It's the operating system API Different . Most operations performed by an executable ( such as : File operations 、 Input and output 、 Memory request release 、 Task scheduling and so on ) Need to interact with the operating system to complete , Different operating systems use these operations in completely different ways , So this obstacle is more difficult to overcome . This is the second reason .
Such as If we can solve the above two reasons , In theory, some executable files can span Windows and Linux stay x86 Running on the platform , because Intel and AMD Of CPU in , The main hard Piece instructions ( Machine instructions ) It's the same , in other words 0101 This binary number , It's the same . But if you switch to ARM platform , The bigger problem is that the hardware instructions are different , Then there is no way 了 .
Friends interested in MCU can come to me , I recorded some introductory tutorials about MCU , If you need children's shoes, just ask me for them , Free of charge , Private confidence in me “ Miss Lin ” You can take ~ Click to open my avatar to receive
Is it possible to have executable files running across platforms , Theoretically, it exists , In the past, there were also some ways , But there are many restrictions , such as Windows too Go for support COM Format of the file , This file has no header , The size cannot exceed 64K, Only in one 16 In an environment ( Real or virtual ) function , Is a real bare binary . Linux In some BIN The file happens to be a raw binary ( There are some BIN No document ELF head , But not all BIN It's all like this ).
After some configuration BIN Documents can also be found in Linux Running on . So some exquisitely designed COM/BIN Files can run across platforms under extremely restrictive circumstances , But maybe it can only be calculated , Unable to output , The size is only 64K Big , also If you want to do something a little more complicated , You need two sets of machine code to realize . in addition , unfortunately 64 In an environment COM Files are no longer supported .
Okay , That's all for this issue , If you think it's helpful to you in front of the screen, please press one button three times
边栏推荐
- Flink CDC practice (including practical steps and screenshots)
- Project cost management__ Topic of comprehensive calculation
- The number of weak characters in the game (1996)
- 【順利畢業】[1]-遊覽 [學生管理信息系統]
- Leetcode daily question (2232. minimize result by addressing parents to expression)
- 在三线城市、在县城,很难毕业就拿到10K
- Vector processor 9_ Basic multilevel interconnection network
- Nodemcu-esp8266 development board to build Arduino ide development environment
- Raspberry pie installation SciPy
- Stm32-hal library learning, using cubemx to generate program framework
猜你喜欢
Mysql database underlying foundation column
Characteristics of PUCCH formats
You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~
Schematic diagram and connection method of six pin self-locking switch
[successful graduation] [1] - visit [student management information system]
How does the memory database give full play to the advantages of memory?
Hal library sets STM32 clock
STM32 external interrupt experiment
当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
IDEA远程断点调试jar包项目
随机推荐
[combinatorics] Introduction to Combinatorics (context of combinatorics | skills of combinatorics | thought of combinatorics 1: one-to-one correspondence)
Electronic product design
Analysis of the implementation principle of an open source markdown to rich text editor
MySQL 数据库基础知识(系统化一篇入门)
Intelligent home design and development
Equality judgment of long type
嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走
STM32 port multiplexing and remapping
【22毕业季】我是毕业生yo~
Definition and use of enum in C language
Global KYC service provider advance AI in vivo detection products have passed ISO international safety certification, and the product capability has reached a new level
UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding
[successful graduation] [1] - visit [student management information system]
Process communication - semaphore
Desktop icon recognition based on OpenCV
Successful graduation [2] - student health management system function development...
顺利毕业[3]-博客系统 更新中。。。
【男保姆式】教你打开第一个微信小程序
Learn the contents of 5g toolbox supporting NR through the NR resources provided by MATLAB
Construction and test of TFTP server under unbuntu (Debian)