CALL & Pthread.

Slides:



Advertisements
Similar presentations
Chapter 11 Implementing an Assembler and a Linker Using C++ and Java.
Advertisements

1 Lecture 4: Procedure Calls Today’s topics:  Procedure calls  Large constants  The compilation process Reminder: Assignment 1 is due on Thursday.
Wannabe Lecturer Alexandre Joly inst.eecs.berkeley.edu/~cs61c-te
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.
Lecture 8: MIPS Instruction Set
Linking & Loading CS-502 Operating Systems
CS61C L11 Linker © UC Regents 1 CS61C - Machine Structures Lecture 11 - Starting a Program October 4, 2000 David Patterson
CS 31003: Compilers ANIRUDDHA GUPTA 11CS10004 G2 CLASS DATE : 24/07/2013.
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 IKI10230 Pengantar Organisasi Komputer Kuliah no. 09: Compiling-Assembling-Linking Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer.
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++
The assembler is the system program that translate source code written in assembly language to object code( Machine Language) and other information for.
Binghamton University CS-220 Spring 2015 Binghamton University CS-220 Spring 2015 Object Code.
Generating Programs and Linking Professor Rick Han Department of Computer Science University of Colorado at Boulder.
Assembler/Linker/Loader Mooly Sagiv html:// Chapter 4.3.
CS 61C L13 CALL (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #13: CALL Andy Carle.
CS 61C L14Introduction to MIPS: Instruction Representation II (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS 61C L19 Running a Program aka Compiling, Assembling, Loading, Linking (CALL) II (1) Garcia, Fall 2004 © UCB Lecturer PSOE Dan Garcia
MIPS Assembler Programming
CS 61C L14Introduction to MIPS: Instruction Representation II (1) Garcia, Spring 2004 © UCB Roy Wang inst.eecs.berkeley.edu/~cs61c-tf inst.eecs.berkeley.edu/~cs61c.
CS61C L13 CALL I (1) Chae, Summer 2008 © UCB Albert Chae, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #13 – Compiling,
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
Computer Architecture and Design – ECEN 350 Part 4 [Some slides adapted from M. Irwin, D. Paterson and others]
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
MIPS coding. SPIM Some links can be found such as:
1 CS/COE0447 Computer Organization & Assembly Language Chapter 2 Part 4.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /29/2013 Lecture 13: Compile-Link-Load Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 2 Part 3.
CENG 311 Starting a Program. Review (1/2) °IEEE 754 Floating Point Standard: Kahan pack as much in as could get away with +/- infinity, Not-a-Number (Nan),
CS 61C: Great Ideas in Computer Architecture Running a Program - CALL (Compiling, Assembling, Linking, and Loading) 1 Instructors: Nick Weaver & Vladimir.
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.
CS 110 Computer Architecture Lecture 7: Running a Program - CALL (Compiling, Assembling, Linking, and Loading) Instructor: Sören Schwertfeger
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
1 Computer Architecture & Assembly Language Spring 2001 Dr. Richard Spillman Lecture 10 –Assembly V.
1 CS 192 Lecture 4 Winter 2003 December 8-9, 2003 Dr. Shafay Shamail.
Lecture 3 Translation.
Assemblers, linkers, loaders
Instruction Set Architectures
Computer Architecture & Operations I
Computer Science 210 Computer Organization
System Programming and administration
Linking & Loading.
-by Nisarg Vasavada (Compiled*)
May 2006 Saeid Nooshabadi ELEC2041 Microprocessors and Interfacing Lectures 25: Compiler, Assembler, Linker and Loader – II
Program Execution in Linux
Instructor: Justin Hsia
There is one handout today at the front and back of the room!
Computer Science 210 Computer Organization
Assembler, Compiler, Interpreter
Introduction to Operating Systems
Chapter 7 LC-2 Assembly Language.
Chapter 11 Introduction to Programming in C
Green Subscription Based PC Announced
Chapter 11 Introduction to Programming in C
Chapter 7 LC-2 Assembly Language.
Accomplishing Executables
Linking & Loading CS-502 Operating Systems
A Simple Two-Pass Assembler
Assembler, Compiler, Interpreter
Computer Architecture
Chapter 11 Introduction to Programming in C
Appendix F C Programming Environment on UNIX Systems
Loaders and Linkers.
Chapter 6 Programming the basic computer
10/6: Lecture Topics C Brainteaser More on Procedure Call
Linking & Loading CS-502 Operating Systems
An introduction to systems programming
Computer Architecture Assembly Language
Presentation transcript:

CALL & Pthread

CALL & Pthread yiming

Interpretation vs Translation Interpreter: Directly executes a program in the source language For example: python foo.py sh foo.sh Translator: Converts a program from the source language to anequivalent program in another language gcc -FLAG flags foo.c -o foo ./foo javac logism.java –o logism.jar java -jar logism.jar

CALL chain Compiler Assembler Linker Loader

High-Level Language Code -> Assembly Language Code (e.g. MAL) Compiler foo.s High-Level Language Code -> Assembly Language Code (e.g. MAL) Convert marcos … Output may contain pseudo-instructions For example: Move $x $y

Assembler-Proj1.1 foo.o Assembly Language Code (MAL) -> Object Code, information tables(TAL) Totally numbers TAL is some numbers

Assembler-Proj1.1 foo.o Contains 2 passes. first pass Second pass Replace pseudo-instruction To code without labels Second pass Handle branches and labels

Assembler-Proj1.1 pass1 TODO list Skip comments Add labels in symbol table (labels, data) Give addresses Check if invalid inst int pass_one(FILE* input, FILE* output, SymbolTable* symtbl) Note: There are characters. I mean, normal codes No pseudo. The symbol table contains position of labels.

Symbol Table

Relocation Table

Assembler-Proj1.1 pass2 TODO list Check if invalid inst Use label position to generate numbers. Record relocation things to reltbl int pass_two(FILE *input, FILE* output, SymbolTable* symtbl, SymbolTable* reltbl) Note: the pc is with suffix 00 or not

???

After Assembler-Proj1.1 The object file with header Code (number) Data Relocation table Symbol table Debug infos

Linker-Proj1.2 TODO list Object code files, information tables -> Executable code Briefly. Combine multiple object file to a single one Use relocation table and symbol table. Merge text/data segment Create absolute memory addresses Modify & merge symbol and relocation tables Edit Addresses in relocation table Output executable of merged modules(instructions + data + details)

Loader project2 part ./a.out Read instructions allocate space for program Copy data to memory Copy args to stack Init register Execute

Logisim based CPU

Guest lecture: Pthread Yifan