Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź

Similar documents
Complex Instruction Set Computer (CISC)

Introduction to IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung

The Instruction Set. Chapter 5

Lecture Dependable Systems Practical Report Software Implemented Fault Injection. July 31, 2010

The Microprocessor and its Architecture

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

Chapter 2: The Microprocessor and its Architecture

Computer System Architecture

IA32/Linux Virtual Memory Architecture

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture Included elements of the IA-64 bit

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

IA32 Intel 32-bit Architecture

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1

MICROPROCESSOR TECHNOLOGY

The x86 Architecture

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

Assembly Language. Lecture 2 x86 Processor Architecture

Hardware and Software Architecture. Chapter 2

Basic Execution Environment

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

Memory Models. Registers

Computer Organization (II) IA-32 Processor Architecture. Pu-Jen Cheng

History of the Intel 80x86

EEM336 Microprocessors I. The Microprocessor and Its Architecture

Mechanisms for entering the system

Chapter 11. Addressing Modes

Tutorial 10 Protection Cont.

CHAPTER 3 BASIC EXECUTION ENVIRONMENT

iapx Systems Electronic Computers M

ICS143A: Principles of Operating Systems. Midterm recap, sample questions. Anton Burtsev February, 2017

IA-32 Architecture COE 205. Computer Organization and Assembly Language. Computer Engineering Department

Addressing Modes on the x86

EECE416 :Microcomputer Fundamentals and Design. X86 Assembly Programming Part 1. Dr. Charles Kim

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

CMSC Lecture 03. UMBC, CMSC313, Richard Chang

3. Process Management in xv6

Load Effective Address Part I Written By: Vandad Nahavandi Pour Web-site:

Assembly I: Basic Operations. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Assembler Programming. Lecture 2

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model

What You Need to Know for Project Three. Dave Eckhardt Steve Muckle

Systems Architecture I

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

Communicating with People (2.8)

CS3210: Booting and x86

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998

Assembly Language for x86 Processors 7 th Edition. Chapter 2: x86 Processor Architecture

EC-333 Microprocessor and Interfacing Techniques

CS 16: Assembly Language Programming for the IBM PC and Compatibles

Protection and System Calls. Otto J. Anshus

Reverse Engineering II: Basics. Gergely Erdélyi Senior Antivirus Researcher

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)

Unit 08 Advanced Microprocessor

Reverse Engineering II: The Basics

An Introduction to x86 ASM

Microkernel Construction

Computer Organization & Assembly Language Programming

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 03, SPRING 2013

Microkernel Construction

+ Overview. Projects: Developing an OS Kernel for x86. ! Handling Intel Processor Exceptions: the Interrupt Descriptor Table (IDT)

CS3210: Booting and x86. Taesoo Kim

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

Assembly Language: Function Calls

Addressing Modes. Outline

Information Security II Prof. Kamakoti Department of Computer Science and Engineering Indian Institute of Technology, Madras

µ-kernel Construction (12)

Assembly Language Programming Introduction

Assembly Language for Intel-Based Computers, 4 th Edition. Kip R. Irvine. Chapter 2: IA-32 Processor Architecture

Assembly Language: Function Calls" Goals of this Lecture"

Advanced Microprocessors

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture. Chapter Overview.

Architecture of 8086 Microprocessor

W4118: PC Hardware and x86. Junfeng Yang

T Reverse Engineering Malware: Static Analysis I

Assembly Language: Function Calls" Goals of this Lecture"

Program Exploitation Intro

PROTECTION CHAPTER 4 PROTECTION

Assembly Language: Function Calls. Goals of this Lecture. Function Call Problems

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-11: 80x86 Architecture

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

Lab 2: Introduction to Assembly Language Programming

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

Assembly Language Lab # 9

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

Digital Forensics Lecture 3 - Reverse Engineering

Darshan Institute of Engineering & Technology

MICROPROCESSOR ALL IN ONE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

x86 Assembly Tutorial COS 318: Fall 2017

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP.

SYSTEM CALL IMPLEMENTATION. CS124 Operating Systems Fall , Lecture 14

Module 3 Instruction Set Architecture (ISA)

UMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.

The x86 Architecture. ICS312 - Spring 2018 Machine-Level and Systems Programming. Henri Casanova

MICROPROCESSOR ARCHITECTURE

Transcription:

Low Level Programming Lecture 2

Intel processors' architecture reminder Fig. 1. IA32 Registers

IA general purpose registers EAX- accumulator, usually used to store results of integer arithmetical or binary operations EBX- used in memory addressing to hold the base offset, ECX- as above, also used as a loop counter EDX- as above, also used to store partial results of some 32-bit integer instructions in pair with EAX register ESI - as above, also used as a source index by memory block operations EDI - as above, also used as a destination index by memory block operations ESP - as above, also it's a processor's stack pointer EBP - as above, also used as a base pointer for stack frame operations

IA segment, status and control registers Segment registers: CS code segment register DS data segment register SS stack segment register ES, FS, GS extended (additional) data segment registers Status registers: EFLAGS flag register which stores processor's status and particulary a status of the last arithmetical operation performed by the processor. Flags can be tested and utilizezed for controlling program execution paths. Control registers: EIP processor's instruction pointer used along with the CS register to store next processor's instruction to be executed.

IA system, control, debug and test registers System registers: GDTR global descriptor table register stores the address of a processor's global descriptor table used in protected mode IDTR interrupt descriptor table register stores the address of an interrupt descriptor table used in protected mode LDTR local descriptor table register stores the address of a current task's local descriptor table used in protected mode TR task register stores the current task's state segment pointer Control registers: CR0-CR3 processor's control words used to store bit's describing processor's current mode of operation and memory paging mode. Debug and test registers: DR0 DR7 - used for debugging purposes for controlling hardware traps TR6 - TR7 - used while testing cosistency of memory descriptors and also while processor's self test

IA integer data types and sizes

IA floating point data types and sizes Note: Internal FPU registers are 10 bytes long. In operational memory floating point numbers are stored as 32-bit (single precision), 64-bit (double) or 80-bit (long double) precision numbers with the same format as indicated above. Fig. 2. Example of dot product computation

IA Real Mode Addressing

IA Real Mode Addressing

IA Protected Mode Addressing

Assemby language DOS program structure DOS COM program has a simplified format and is totally unrelocable. It means that when it's compiled to a binary file it must be loaded at specific address without any modification of it's binary form. It must have only one segment reserved for code an data and no stack segment (it uses DOS system stack). The code of a binary file must start at 256 (100h) byte offset from the beginning of the program segment. Program with only one, no more than 64KB segment 256 byte offset Define which instruction starts the program Omit data, so that the data bytes won't be treated as the instruction codes by the processor One and only program segment

Assemby language DOS program structure DOS EXE program has universal structure. It can have as many code, data and stack segments as one wishes. It can occupy as much memory as one wants. It is relocable, which means that the actual binary form of the program can be freely modified by the operating system during program loading process. It usually has it's own stack, but it can also use DOS system stack, which is quite risky. Program with one code, data and at most one stack segments Data segment Code segment Define which instruction starts the program 1024 byte long Stack segment

Assemby language DOS program structure Hence the typical DOS program can be composed of the following segments: - Code segment, - Data segment, - Stack segment, - Additional data segment. It is understood that a code segment is obligatory. In the following figure the typical usage of segment registers to address program segments is presented.

Thank You for today's lecture