Topic 2d High-Level languages and Systems Software

Slides:



Advertisements
Similar presentations
Hand-Held Devices and Embedded Systems Course Student: Tomás Sánchez López Student ID:
Advertisements

Programs in Memory Bryce Boe 2012/08/29 CS32, Summer 2012 B.
CS Spring 2014 Prelim 2 Review
Part IV: Memory Management
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
The University of Adelaide, School of Computer Science
MIPS ISA-II: Procedure Calls & Program Assembly. (2) Module Outline Review ISA and understand instruction encodings Arithmetic and Logical Instructions.
MIPS ISA-II: Procedure Calls & Program Assembly. (2) Module Outline Review ISA and understand instruction encodings Arithmetic and Logical Instructions.
1 Lecture 4: Procedure Calls Today’s topics:  Procedure calls  Large constants  The compilation process Reminder: Assignment 1 is due on Thursday.
Lecture 8 Sept 23 Completion of Ch 2 translating procedure into MIPS role of compilers, assemblers, linking, loading etc. pitfalls, conclusions Chapter.
Computer Architecture CSCE 350
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /17/2013 Lecture 12: Procedures Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL.
Program Development Tools The GNU (GNU’s Not Unix) Toolchain The GNU toolchain has played a vital role in the development of the Linux kernel, BSD, and.
1 Computer Architecture MIPS Simulator and Assembly language.
The University of Adelaide, School of Computer Science
CS3350B Computer Architecture Winter 2015 Lecture 4
Assembler/Linker/Loader Mooly Sagiv html:// Chapter 4.3 J. Levine: Linkers & Loaders
Lecture 10: Linking and loading. Lecture 10 / Page 2AE4B33OSS 2011 Contents Linker vs. loader Linking the executable Libraries Loading executable ELF.
Computer Organization CS224 Fall 2012 Lesson 12. Synchronization  Two processors or threads sharing an area of memory l P1 writes, then P2 reads l Data.
1 Starting a Program The 4 stages that take a C++ program (or any high-level programming language) and execute it in internal memory are: Compiler - C++
Lec 9Systems Architecture1 Systems Architecture Lecture 9: Assemblers, Linkers, and Loaders Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some.
 Procedures (subroutines) allow the programmer to structure programs making them : › easier to understand and debug and › allowing code to be reused.
CPSC Compiler Tutorial 8 Code Generator (unoptimized)
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
C and Data Structures Baojian Hua
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
7/13/20151 Topic 3: Run-Time Environment Memory Model Activation Record Call Convention Storage Allocation Runtime Stack and Heap Garbage Collection.
Memory Layout C and Data Structures Baojian Hua
Software Development and Software Loading in Embedded Systems.
OBJECT MODULE FORMATS. The object module format we have employed as an educational device is called OMF (relocatable object format). It’s one of the earliest.
Enabling the ARM Learning in INDIA ARM DEVELOPMENT TOOL SETUP.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Memory/Storage Architecture Lab Computer Architecture MIPS Instruction Set Architecture ( Supporting Procedures )
13/02/2009CA&O Lecture 04 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
Chapter 8 – Main Memory (Pgs ). Overview  Everything to do with memory is complicated by the fact that more than 1 program can be in memory.
OCC - CS/CIS CS116-Ch00-Orientation Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 1CS 116 Fall 2003 Not quite finished Creating.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
April 23, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Assemblers, Linkers, and Loaders * Jeremy R. Johnson Mon. April 23,
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /29/2013 Lecture 13: Compile-Link-Load Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
CS412/413 Introduction to Compilers and Translators April 14, 1999 Lecture 29: Linking and loading.
12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt1 Topic 2b High-Level languages and System Software (Languages) Introduction to Computer Systems Engineering.
1 CS503: Operating Systems Spring 2014 Part 0: Program Structure Dongyan Xu Department of Computer Science Purdue University.
Chapter 13 : Symbol Management in Linking
Programs and Processes. The Virtual Address Space A typical process VAS space includes: user regions in the lower half V->P mappings specific to each.
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
CSc 453 Linking and Loading
CS252: Systems Programming Ninghui Li Based on Slides by Gustavo Rodriguez-Rivera Topic 2: Program Structure and Using GDB.
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Hello world !!! ASCII representation of hello.c.
Memory Management 백 일 우
Object Files & Linking. Object Sections Compiled code store as object files – Linux : ELF : Extensible Linking Format – Windows : PE : Portable Execution.
Program Execution in Linux David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Lecture 3 Translation.
Assemblers, linkers, loaders
Computer Architecture & Operations I
The University of Adelaide, School of Computer Science
Program Execution in Linux
Software Development with uMPS
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Topic 2e High-Level languages and Systems Software
Memory Allocation CS 217.
The University of Adelaide, School of Computer Science
Computer Organization and Design Assembly & Compilation
Computer Architecture
Program Execution in Linux
Program Assembly.
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
Topic 2b ISA Support for High-Level Languages
Presentation transcript:

Topic 2d High-Level languages and Systems Software (Memory Layout) Introduction to Computer Systems Engineering (CPEG 323) 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Reading List Slides: Topic2d Operating System and Compiler Books Other papers as assigned in class or home works 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Several Topics Object File Format GP register and GP area Process Memory Image Run-time Stack Virtual / Physical memory 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Object File Format Compiler or assembler translates the program into an object file, which is consequently linked into a executable file. These "object" files and "executable" files have a specific format. Several common formats are: a.out: assembler and linker output format COFF: Common Object File Format ECOFF: Extended Common Object File Format ELF: Executable and Linking Format 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Object File Format(Cont.) a.out: assembler and linker output format A fairly primitive format, lacking some key features to enable easy shared libraries, etc. On UNIX boxes, a.out is the default output format of the system assembler and the linker. The linker makes a.out executable files. A file in a.out format consists of: a header, the program text, program data, text and data relocation information, a symbol table, and a string table (in that order). 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Object File Format(Cont.) Common Object File Format (COFF) binary files COFF is a portable format for binary applications on UNIX System V Extended Common Object File Format (ECOFF) binary files Under Windows, Visual C, C++ and every Windows compiler generates ECOFF files. MIPS 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Object File Format(Cont.) ELF: Executable and Linking Format ELF and COFF formats are very similar but ELF has greater power and flexibility Become the standard in file format ELF representation is platform independent 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Object File Format(Cont.) Three main types of ELF files executable file supplies information necessary for the operating system to create a process image. relocatable file describes how it should be linked with other object files to create an executable file or shared library. shared object file contains information needed in both static and dynamic linking. 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

ELF Object File Format ELF Format Linking and Execution Views 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

ELF Object File Format(Cont.) The ELF Header ELF Header is always the first section of the file(The other sections can be in any order) What does the ELF Header describe? ● the type of the object file ● target architecture ● The location of the Program Header table, Section Header table, and String table ● number and size of entries for each table in the ELF ● the location of the first executable instruction 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

ELF Object File Format(Cont.) The Program Header Table only important in executable and shared object files It is an array of entries each entry is a structure describing a segment in the object file The OS copies the segment into memory according to the location and size information 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

ELF Object File Format(Cont.) The Section Header Table Has pointers to all sections in object files It is similar to the program header Each entry correlates to a section in the file. Each entry provides the name, type, memory image starting address, file offset, the section’s size, alignment, and how the information in the section should be interpreted. 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

ELF Object File Format(Cont.) The ELF Sections Hold code, data, dynamic linking information, debugging data, symbol tables, relocation information, comments, string tables, and notes. Sections are treated in different ways ● loaded into the process image ● or provide information needed in the building of a process image ● or are used only in linking object files 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

ELF Object File Format(Cont.) The ELF Segments Group related sections ● text segment groups executable code, ● data segment groups the program data, ● dynamic segment groups information relevant to dynamic loading. Each segment consists of one or more sections. A process image is created by loading and interpreting segments. The OS logically copies a file’s segment to a virtual memory segment according to the information provided in the program header table. 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Process Memory Image (32-bit Linux) code Text variables with initial values Data BSS variables without initial values Heap Why separate BSS and DATA? 0x7FFFFFFF Stack 0x80000000 OS Reserved initialized/uninitialized Image space 0xFFFFFFFF 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

GP Register and GP Area Stack Heap BSS positive offset 0xEFFFFFFF Stack Heap BSS positive offset Global data area 64k GP 0x10008000 negative offset Data Text 0x00000000 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

GP Register and GP Area(Cont.) Why Global Data Area ? Load variable x to r10 Without GP: 3 instructions Li r9, x -- low 16-bit of x Addiu r9, x -- high 16-bit of x Lw r10, 0(r9) -- load With GP: 1 – instruction LW r10, 24(GP) -- load 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

What should be put into Global Data Area ? GP Register and GP Area(Cont.) What should be put into Global Data Area ? Most Frequently Access Data How to Use Global Data Area ? • Global Data Area requires linker support • $gp register must be correctly initialized (by the startup routine) • assembly code must not modify the $gp register 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Stack Stack organization High memory argumentn …… argument1 Virtual frame Pointer($fp) argument1 Frame offset Local & temporaries Saved registers (including returnreg) framesize Procedure call Argument area stack Pointer($sp) …… low memory 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; i1=foo(4, s1); printf(“i1= %d %s\n”, i1, s1); Q: which variable in which section? 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text foo(), main() .rodata s1=“hello world” .data i3 .bss i1, i2, p1 Stack Heap 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; i1=foo(4, s1); printf(“i1= %d %s\n”, i1, s1); Q: where is i4? 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text foo(), main() .rodata s1=“hello world” .data i3 .bss i1, i2, i4, p1 Stack Heap 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 I4 p1 FP i1.0 SP 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 I4 p1 FP i1.0 SP 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 i4 p1 FP i1.0 SP Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 i4 p1 FP i1.0 4 copy of p1 SP Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 i4 p1 i1.0 4 copy of p1 FP Return address of main() callee saved registers p2 SP Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 i4 p1 i1.0 4 copy of p1 FP Return address of main() callee saved registers p2 SP Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 i4 p1 i1.0 4 copy of p1 FP Return address of main() callee saved registers p2 Hello world SP Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 i4 p1 FP i1.0 4 copy of p1 SP Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 i4 p1 FP i1.0 =15 4 copy of p1 SP Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2) { static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); .text s1=“hello world” i3=2 i1 i2 i4 p1 FP SP Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples int i1, i2[10], i3=2; int *p1; const char *s1=“hello world”; int foo(int a1, char * a2){ static int i4; char * p2; p2=alloc(strlen(a2)); strcpy(p2, a2); return a1+strlen(p2); } main() { int i1; p1=malloc(strlen(s1)+1); strcpy(p1, s1); i1=foo(4, p1); printf(“i1= %d %s\n”, i1, s1); free(p1); .text s1=“hello world” i3=2 i1 i2 i4 p1 FP SP Memory Leak Hello world 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples .text s1=“hello world” Why do we need both SP and FP? Can we only use one of them? (Under what kind of situation?) i3=2 i1 i2 i4 p1 FP SP 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples .text Why do we need both SP and FP? Answer: because of “alloc()” Can we only use one of them? (Under what kind of situation?) Answer: if no dynamically allocated object on stack s1=“hello world” i3=2 i1 i2 i4 p1 FP SP 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples .text In case both FP and SP are present, which one should be used to access variables on stack? s1=“hello world” i3=2 i1 i2 i4 p1 FP SP 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples .text Offset is always limited (16-bit). One may not be able to access all the variables from one end, when? LDD R9, OFFSET(FP) s1=“hello world” i3=2 i1 i2 i4 p1 FP SP 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Runtime Execution Examples .text For 16-bit offset, when frame size >64KB, more instructions are needed ADD R5, SP, OFFSET LDD R9, 0(R5) s1=“hello world” i3=2 i1 i2 i4 p1 FP SP 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Virtual / Physical memory User memory space OS memory space 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

(virtual memory - user) 0x7FFF EFFF Stack Heap BSS Text: instructions Data: variables with initial value BSS: variables without initial value HEAP: for malloc/free STACK: for function call Global Data Data Text 0x0040 0000 Layout of Memory (virtual memory - user) 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Layout of Memory ( OS memory space) Reserved for kernel 800000016 Stack segment Dynamic data Data segment Static data Text segment 40 000016 Reserved For Interrupt vector Firmware Layout of Memory ( OS memory space) 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Virtual Memory / Physical Memory Why Virtual Memory Limited physical memory size 64MB to 1GB Unlimited virtual memory size Each process may have 2GB Many processes in the system 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Virtual Memory/Physical Memory Physical memory as cache of virtual memory (disk) Physical memory and virtual memory broke into fixed size pages; Each physical page holds a virtual page (may come from different processes) Only the active pages of each process reside in physical memory, physical memory works as cache of virtual memory (disk) Other pages stay on disk P1: pagek P2: pagen Pn: pagem Physical pagei Page table Physical address Virtual address v rwx Physical page Start address Virtual page Disk address Present bit Protection bits 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Virtual and Physical Memory Process 1 Process 2 OS Page 0 U1/P0 U2/P0 OS U1/P1 U2/P1 Page 1 U1/P0 U1/P2 U2/P2 Page 2 U2/P3 U1/P3 U2/P3 Page 3 U1/P3 U1/P4 U2/P4 Page 4 U1/P7 U1/P5 U2/P5 Page 5 U1/P6 U1/P6 U2/P6 Page 6 U2/P1 U1/P7 U2/P7 Page 7 On Disk 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Process Memory Image • what will happen with the following code? int x; int * p = NULL; *p = 12; • why? Invalid pointer – p points to arbitrary address (address 0?) Page protection will assign “readable/executable” to the pages in this section 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Process Memory Image 0x0 .text Segmentation Fault .rodata .data .bss Different page permissions: .text -> read and execute .rodata -> read .data and .bss -> read and write Stack: read, write and execute Heap: read and write .bss Stack Heap 2GB 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Process Memory Image #include <malloc.h> main() { int *p; p=(int *)malloc(sizeof(int)); *p=12; } 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt

Summary Object file formats (a.out, COFF, ECOFF, ELF) Process memory image Runtime stack Mapping between Virtual memory and physical memory 4/24/2017 \course\cpeg323-08F\Topic2d-323.ppt