Linux v LinuxUnixUnixlike 1991 v LinuxWhat is Linux
- Slides: 60
什么是Linux? v Linux是一个类Unix(Unix-like)的操作系统, 在 1991年发行了它的第一个版本 v 在Linux内核维护网站上,“What is Linux? ” 10/26/2020 xlanchen:Linux OS Analysis 4
From “www. kernel. org” v Linux的来历和目标: Ø Linux is a clone of the operating system Unix, written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX and Single UNIX Specification compliance. Portable Operating System Interface Standard 可移植操作系统接口标准 v Linux的功能 由IEEE制订,并由ISO接受为国际标准。 Ø It has all the features you would expect in a modern fully. Institute for Electrical and Electronic Engineers fledged Unix, including true multitasking, virtual 电气电子 程师学会[美] memory, shared libraries, demand loading, shared International Organization for Standardization copy-on-write executables, proper memory 国际标准化组织 management, and multistack networking including IPv 4 制定各行各业各种产品和服务的技术规范(国际标准) and IPv 6. 10/26/2020 xlanchen:Linux OS Analysis 5
v Linux支持的目标体系结构 Ø Although originally developed first for 32 -bit x 86 -based PCs (386 or higher), today Linux also runs on (at least) the Alpha AXP, Sun SPARC, Motorola 68000, Power. PC, ARM, Hitachi Super. H, IBM S/390, MIPS, HP PA-RISC, Intel IA-64, AMD x 86 -64, AXIS CRIS, Renesas M 32 R, Atmel AVR 32, Renesas H 8/300, NEC V 850, Tensilica Xtensa, and Analog Devices Blackfin architectures; for many of these architectures in both 32 - and 64 -bit variants. 10/26/2020 xlanchen:Linux OS Analysis 6
v 在内存管理方面不得不说的 Ø Linux is easily portable to most general-purpose 32 - or 64 -bit architectures as long as they have a paged memory management unit (PMMU) and a port of the GNU C compiler (gcc) (part of The GNU Compiler Collection, GCC). Linux has also been ported to a number of architectures without a PMMU, although functionality is then obviously somewhat limited. See the µClinux project for more info. 10/26/2020 xlanchen:Linux OS Analysis 7
v GNU,“g-noo”,“GNU's Not Unix” 10/26/2020 xlanchen:Linux OS Analysis 9
Linux内核维护网站 v http: //www. kernel. org/ v The Linux Kernel Archives Mirror System 10/26/2020 xlanchen:Linux OS Analysis 10
Linux版本 v Linux的内核版本 v 几种流行的Linux发行版本 10/26/2020 xlanchen:Linux OS Analysis 14
几种流行的Linux发行版本 10/26/2020 xlanchen:Linux OS Analysis 16
Linux系统的好处 v 支持多种CPU Ø X 86, ARM, MIPS, SH, i 960, PPC, etc. v 开放源代码(Open source) v 强大的网络功能 v 可移植性 v 使用GNU tools 10/26/2020 xlanchen:Linux OS Analysis 17
一个典型的Linux操作系统的结构 用户应用程序 Shell,lib System call Kernel implementation 对硬件资 源的管理 10/26/2020 xlanchen:Linux OS Analysis 22
补充知识 v AT&T汇编语言和Intel汇编语言 Ø AT&T汇编语言中指令的操作数顺序与Intel相反 l AT&T opcode[b+w+l] src, dest Ø 寄存器:%reg Ø 访存大小:[b+w+l] - 8, 16, 32 bits Ø 引用内存地址:section: disp(base, index, scale) l 实际偏移:base + index*scale + disp 缺省为 0 10/26/2020 取值可以是 1,2,4,8 xlanchen:Linux OS Analysis 28
观察p 2的堆栈框架 v 从test的反汇编文件中找到p 2的反汇编代码 int p 2(int x, int y) { push %ebp mov %esp, %ebp return x+y; mov 0 xc(%ebp), %eax add 0 x 8(%ebp), %eax } pop %ebp ret 建立框架 低地址 ebp esp 拆除框架 ebp x y 调用者 堆栈 框架 ebp 高地址 10/26/2020 xlanchen:Linux OS Analysis 33
观察main函数是如何传递参数给p 2的 esp … z=p 2(x, y); pushl 0 xfffffff 8(%ebp) pushl 0 xfffffff 4(%ebp) call 804839 b <p 2> add $0 x 8, %esp mov %eax, 0 xfffffffc(%ebp) printf("%d=%d+%dn", z, x, y); pushl 0 xfffffff 8(%ebp) pushl 0 xfffffff 4(%ebp) pushl 0 xfffffffc(%ebp) push $0 x 8048510 call 80482 b 0 <printf@plt> … 被调用者 堆栈 框架 ebp esp esp ebp cs: eip x的值 y的值 低地址 调用者 堆栈 框架 ebp 高地址 p 2的返回值是如何返回给main的? 10/26/2020 xlanchen:Linux OS Analysis 34
观察main中的局部变量 int main(void) { push %ebp mov %esp, %ebp sub $0 x 18, %esp … char c='a'; movb $0 x 61, 0 xfffffff 3(%ebp) int x, y, z; x=1; movl $0 x 1, 0 xfffffff 4(%ebp) y=2; movl $0 x 2, 0 xfffffff 8(%ebp) … 10/26/2020 xlanchen:Linux OS Analysis 35 低地址 esp c=‘a’ x=1 y=2 ebp esp ebp 调用者 ebp 高地址
观察程序运行时堆栈的变化 eip eip 10/26/2020 p 1 p 2 main … main p 1(c) … p 2(x, y) … 程序的代码段 xlanchen:Linux OS Analysis esp p 1的堆栈 p 2堆栈 eip x,y c main堆栈 堆栈 36
观察程序运行时堆栈的变化 eip p 1 eip eip p 2 … p 1(c) … p 2 eip eip eip main … p 2(x, y) … main esp p 1堆栈 eip c p 2堆栈 eip x,y main堆栈 esp 堆栈 程序的代码段 10/26/2020 xlanchen:Linux OS Analysis 38
pt_regs结构 10/26/2020 xlanchen:Linux OS Analysis 41
SAVE_ALL和RESTORE_ALL 10/26/2020 xlanchen:Linux OS Analysis 42
do_IRQ的调用方式 v 仔细阅读一下与之相连的汇编码 pushl $n-256 SAVE_ALL call do_IRQ jmp ret_from_intr 10/26/2020 xlanchen:Linux OS Analysis 43
站在CPU执行指令的角度 idle 系统调用处理 进程管理 中断处理 CPU intr idtr esp 内核其他模块 eip wait keyborad queue eip esp Wakeup progress cs ds等等 esp 0 xc 0000000 some action 8259 c=gets() … esp main keyboard 10/26/2020 进程x xlanchen:Linux OS Analysis 进程x 52
QEMU v http: //wiki. qemu. org/Main_Page v QEMU is a generic and open source machine emulator and virtualizer. v When used as a machine emulator, QEMU can run OSes and programs made for one machine (e. g. an ARM board) on a different machine (e. g. your own PC). By using dynamic translation, it achieves very good performance. v When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU. QEMU supports virtualization when executing under the Xen hypervisor or using the KVM kernel module in Linux. When using KVM, QEMU can virtualize x 86, server and embedded Power. PC, and S 390 guests. 10/26/2020 xlanchen:Linux OS Analysis 56
Virtual. Box v http: //www. virtualbox. org/ v Virtual. Box is a powerful x 86 and AMD 64/Intel 64 virtualization product for enterprise as well as home use. Not only is Virtual. Box an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL). v Presently, Virtual. Box runs on Windows, Linux, Macintosh and Open. Solaris hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4. 0, 2000, XP, Server 2003, Vista, Windows 7), DOS/Windows 3. x, Linux (2. 4 and 2. 6), Solaris and Open. Solaris, and Open. BSD. v 安装:sudo apt-get install virtualbox 10/26/2020 xlanchen:Linux OS Analysis 57
- Linux 1991
- 1991 linux
- Linux kernel linux security module m1
- Uclinux
- Industrial licensing policy 1991
- Teori kepemimpinan
- Html 1991
- "howard schultz" and ("land owner" or "conservation")
- December 25 1991
- Cara menulis perkara berbangkit dalam minit mesyuarat
- 1991-1947
- World wide web 1991
- Darna 1991
- 1991
- 1991
- Annie leibovitz mick jagger, buffalo, ny (1975)
- Ajzen (1991)
- Self – marc quinn, 1991
- Como es la pendiente de una recta perpendicular
- Burnard 1991
- Modelo de besseyre des horts
- Dahlgren and whitehead 1991
- Firm resources and sustainable competitive advantage
- Communsim
- 1991 realignment
- 1991-1964
- Hierarquia processadores intel
- Microsoft publisher
- Eruption 1991
- 1991-1979
- Karmen zupanovic
- 1991-1975
- Aaker 1991 brand equity model
- Poblogaeth cymru 1991
- Norma penal
- Ajzen 1991
- Cold war 1947
- Nelson 1991
- Constitucion de 1991
- Self – marc quinn, 1991
- Java diciptakan pada tahun
- Dahlgren og whitehead modell
- Martha stewart 1991
- Java is invented by_______in 1991
- Industrial policy
- School established in 1991
- Codex stan 1-1985, rev. 1-1991
- 19 ninety one
- Html 1991
- Onion model of stakeholders
- Alcock v chief constable of yorkshire
- Dillan 1991
- The little mermaid 1989 characters
- Scans skills assessment
- Chuck close photorealism
- 1979 türkiye güzeli şebnem ünal
- 1947 1991
- Ritter 1991
- Pnacs
- Kprobe vs tracepoint
- Linux is everywhere