没有合适的资源?快使用搜索试试~ 我知道了~
电子书《x86-64 Assembly Language Programming with Ubuntu 》
需积分: 1 1 下载量 47 浏览量
2023-10-10
14:07:23
上传
评论
收藏 2.37MB PDF 举报
温馨提示
试读
367页
电子书《x86-64 Assembly Language Programming with Ubuntu 》 网页链接 在Ubuntu 上做x86-64汇编语言编程。本文针对流行的 x86-64 类处理器的指令集。 虽然提供的代码和 各种示例应该可以在任何基于 Linux 的 64 位操作系统下运行,它们有 仅在 Ubuntu 14/16/18 LTS(64 位)下测试。 The purpose of this text is to provide a reference for University level assembly language and systems programming courses. Specifically, this text addresses the x86-64 instruction set for the popular x86-64 class of processors using the Ubuntu 64-bit Operating System (OS). While the provided code and var
资源推荐
资源详情
资源评论
x86-64
Assembly Language
Programming
with
Ubuntu
Ed Jorgensen, Ph.D.
Version 1.1.44
May 2022
Cover image:
Top view of an Intel central processing unit Core i7 Skylake type core,
model 6700K, released in June 2015.
Source: Eric Gaba, https://commons.wikimedia.org/wiki/File :
Intel_CPU_Core_i7_6700K_Skylake_top.jpg
Cover background:
By Benjamint444 (Own work)
Source: http://commons.wikimedia.org/wiki/File%3ASwirly_belt444.jpg
Copyright © 2015 - 2022 by Ed Jorgensen
You are free:
To Share — to copy, distribute and transmit the work
To Remix — to adapt the work
Under the following conditions:
Attribution — you must attribute the work in the manner specified by the author
or licensor (but not in any way that suggests that they endorse you or your use of
the work).
Noncommercial — you may not use this work for commercial purposes.
Share Alike — if you alter, transform, or build upon this work, you may
distribute the resulting work only under the same or similar license to this one.
Table of Contents
Table of Contents
1.0 Introduction...........................................................................................................1
1.1 Prerequisites........................................................................................................1
1.2 What is Assembly Language...............................................................................2
1.3 Why Learn Assembly Language.........................................................................2
1.3.1 Gain a Better Understanding of Architecture Issues...................................3
1.3.2 Understanding the Tool Chain.....................................................................3
1.3.3 Improve Algorithm Development Skills.....................................................3
1.3.4 Improve Understanding of Functions/Procedures.......................................3
1.3.5 Gain an Understanding of I/O Buffering.....................................................4
1.3.6 Understand Compiler Scope........................................................................4
1.3.7 Introduction Multi-processing Concepts.....................................................4
1.3.8 Introduction Interrupt Processing Concepts................................................4
1.4 Additional References.........................................................................................4
1.4.1 Ubuntu References......................................................................................5
1.4.2 BASH Command Line References..............................................................5
1.4.3 Architecture References..............................................................................5
1.4.4 Tool Chain References................................................................................5
1.4.4.1 YASM References...............................................................................6
1.4.4.2 DDD Debugger References.................................................................6
2.0 Architecture Overview.........................................................................................7
2.1 Architecture Overview........................................................................................7
2.2 Data Storage Sizes...............................................................................................8
2.3 Central Processing Unit.......................................................................................9
2.3.1 CPU Registers...........................................................................................10
2.3.1.1 General Purpose Registers (GPRs)....................................................10
2.3.1.2 Stack Pointer Register (RSP).............................................................12
2.3.1.3 Base Pointer Register (RBP)..............................................................12
2.3.1.4 Instruction Pointer Register (RIP).....................................................12
2.3.1.5 Flag Register (rFlags)........................................................................12
2.3.1.6 XMM Registers..................................................................................13
2.3.2 Cache Memory..........................................................................................14
2.4 Main Memory....................................................................................................15
2.5 Memory Layout.................................................................................................17
Page iii
Table of Contents
2.6 Memory Hierarchy............................................................................................17
2.7 Exercises............................................................................................................19
2.7.1 Quiz Questions..........................................................................................19
3.0 Data Representation...........................................................................................21
3.1 Integer Representation.......................................................................................21
3.1.1 Two's Complement....................................................................................23
3.1.2 Byte Example............................................................................................23
3.1.3 Word Example...........................................................................................24
3.2 Unsigned and Signed Addition.........................................................................24
3.3 Floating-point Representation...........................................................................24
3.3.1 IEEE 32-bit Representation.......................................................................25
3.3.1.1 IEEE 32-bit Representation Examples..............................................26
3.3.1.1.1 Example → -7.75
10
.....................................................................26
3.3.1.1.2 Example → -0.125
10
...................................................................26
3.3.1.1.3 Example → 41440000
16
.............................................................27
3.3.2 IEEE 64-bit Representation.......................................................................27
3.3.3 Not a Number (NaN).................................................................................27
3.4 Characters and Strings.......................................................................................28
3.4.1 Character Representation...........................................................................28
3.4.1.1 American Standard Code for Information Interchange.....................28
3.4.1.2 Unicode..............................................................................................29
3.4.2 String Representation................................................................................29
3.5 Exercises............................................................................................................29
3.5.1 Quiz Questions..........................................................................................30
4.0 Program Format.................................................................................................33
4.1 Comments..........................................................................................................33
4.2 Numeric Values.................................................................................................33
4.3 Defining Constants............................................................................................34
4.4 Data Section......................................................................................................34
4.5 BSS Section.......................................................................................................35
4.6 Text Section.......................................................................................................36
4.7 Example Program..............................................................................................37
4.8 Exercises............................................................................................................39
4.8.1 Quiz Questions..........................................................................................39
5.0 Tool Chain...........................................................................................................41
5.1 Assemble/Link/Load Overview........................................................................41
5.2 Assembler..........................................................................................................43
Page iv
Table of Contents
5.2.1 Assemble Commands................................................................................43
5.2.2 List File......................................................................................................43
5.2.3 Two-Pass Assembler.................................................................................45
5.2.3.1 First Pass............................................................................................46
5.2.3.2 Second Pass........................................................................................46
5.2.4 Assembler Directives.................................................................................47
5.3 Linker................................................................................................................47
5.3.1 Linking Multiple Files...............................................................................48
5.3.2 Linking Process.........................................................................................48
5.3.3 Dynamic Linking.......................................................................................49
5.4 Assemble/Link Script........................................................................................50
5.5 Loader................................................................................................................51
5.6 Debugger...........................................................................................................52
5.7 Exercises............................................................................................................52
5.7.1 Quiz Questions..........................................................................................52
6.0 DDD Debugger....................................................................................................55
6.1 Starting DDD.....................................................................................................55
6.1.1 DDD Configuration Settings.....................................................................57
6.2 Program Execution with DDD..........................................................................57
6.2.1 Setting Breakpoints...................................................................................57
6.2.2 Executing Programs...................................................................................58
6.2.2.1 Run / Continue...................................................................................60
6.2.2.2 Next / Step.........................................................................................60
6.2.3 Displaying Register Contents....................................................................60
6.2.4 DDD/GDB Commands Summary.............................................................62
6.2.4.1 DDD/GDB Commands, Examples....................................................64
6.2.5 Displaying Stack Contents........................................................................65
6.2.6 Interactive Debugger Commands File.......................................................65
6.2.6.1 Debugger Commands File (non-interactive).....................................66
6.2.6.2 Non-interactive Debugger Commands File.......................................67
6.3 Exercises............................................................................................................67
6.3.1 Quiz Questions..........................................................................................67
6.3.2 Suggested Projects.....................................................................................68
7.0 Instruction Set Overview....................................................................................71
7.1 Notational Conventions.....................................................................................71
7.1.1 Operand Notation......................................................................................72
7.2 Data Movement.................................................................................................73
Page v
剩余366页未读,继续阅读
资源评论
汪宁宇
- 粉丝: 752
- 资源: 42
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功