hardware basics se 2xa3
play

Hardware basics SE 2XA3 Term I, 2020/21 Outline Basic - PowerPoint PPT Presentation

Hardware basics SE 2XA3 Term I, 2020/21 Outline Basic architecture Byte order Endianess NASM 64 Hardware platform Basic architecture fetch instructions data memory bus 64 bits 64 bits execute registers 64 bits CPU memory


  1. Hardware basics SE 2XA3 Term I, 2020/21

  2. Outline Basic architecture Byte order – Endianess NASM 64 Hardware platform

  3. Basic architecture fetch instructions data memory bus 64 bits 64 bits execute registers 64 bits CPU memory Central Processing Unit store

  4. ◮ Average Desktop Processor speed is 1.5 to 2.5 GHz ◮ Average Laptop Processor Speed is 1.0 GHz ◮ One gigahertz is equal to 1,000,000,000 Hz. ◮ Gigahertz is used to measure CPU clock speed.

  5. Byte order – Endianess Whenever a number is represented by more than one byte, the question arises as to the order in which the bytes are arranged. ◮ If the most significant bits come first, that is, are stored at the lowest memory address or at the first location in the file, the representation is said to be big-endian . ◮ If the least significant bits come first, the representation is said to be little-endian .

  6. bit pattern 00001101 00000110 11111111 00000010 hex pattern 0D 06 80 03 decimal value 13 6 128 3 big-endian 13 ∗ 256 3 + 6 ∗ 256 2 + 128 ∗ 256 + 3 = 218 , 529 , 795 3 ∗ 256 3 + 128 ∗ 256 2 + 6 ∗ 256 + 13 = 58 , 721 , 805 little-endian

  7. Most computers these days are little-endian since the Intel and AMD processors that most PCs use are little-endian. Big-endian is the most common format in data networking; for this reason, big-endian byte order is also referred to as network byte order . Netwide Assembler (NASM for short) 64 being an x86-64 platform (Intel) is little-endian.

  8. NASM 64 Hardware platform There are 16 64-bit registers: RAX, RBX, RCX, RDX, RSI, RDI, RSP , RBP , R8, ..., R15. The registers the callee (called function) must preserve for the caller are referred to as callee-saved registers. 64-bit 32-bit 16-bit 8-bit register description subreg subreg subreg(s) RAX EAX AX AL , AH Used for return values from functions RBX EBX BX BL , BH Callee-saved register. Must be saved/restored ! RCX ECX CX CL , CH Some instructions also use it as a counter. RDX EDX DX DL , DH AX RAX AL AH EAX

  9. 64-bit 32-bit 16-bit 8-bit register description subreg subreg subreg(s) RSI ESI SI SIL Used to pass function arg. #2 in 64-bit Linux. RDI EDI DI DIL Used to pass function arg. #1 in 64-bit Linux. RSP The Stack Pointer . Points to the top of the stack. ESP SP SPL Do not use without fully understanding its role. RBP EBP BP BPL The Base Pointer . Points to the “base”. Do not use without fully understanding its role. DI RDI DIL EDI

  10. 64-bit 32-bit 16-bit 8-bit register description subreg subreg subreg(s) R8 R8D R8W R8B R9 R9D R9W R9B R10 R10D R10W R10B R11 R11D R11W R11B R12 R12D R12W R12B Callee-saved register. Must be saved/restored ! R13 R13D R13W R13B Callee-saved register. Must be saved/restored ! R14 R14D R14W R14B Callee-saved register. Must be saved/restored ! R15 R15D R15W R15B Callee-saved register. Must be saved/restored ! R8W R8 R8B R8D

Recommend


More recommend