Presentation is loading. Please wait.

Presentation is loading. Please wait.

CALL & Pthread.

Similar presentations


Presentation on theme: "CALL & Pthread."— Presentation transcript:

1 CALL & Pthread

2 CALL & Pthread yiming

3 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

4 CALL chain Compiler Assembler Linker Loader

5 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

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

7 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

8 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.

9 Symbol Table

10 Relocation Table

11 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

12 ???

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

14

15 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)

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

17 Logisim based CPU

18 Guest lecture: Pthread
Yifan


Download ppt "CALL & Pthread."

Similar presentations


Ads by Google