Questions about this topic? Sign up to ask in the talk tab.

Difference between revisions of "Assembly"

From NetSec
Jump to: navigation, search
(Binary)
(Number handling)
Line 22: Line 22:
 
== Number handling ==
 
== Number handling ==
  
* signed
+
* signed - Signed values are required to represent negative numbers. Most languages by default assume values are signed. The range of numbers it can assign extends from -1 downwards, depending on the data type.
* unsigned
+
* unsigned - Despite not being able to assign negative numbers, unsigned values are particularly advantageous for positive ranges. The memory that would have been applied assigning a negative range is instead added to the positive range, giving you twice as many positive numbers.
 
* 2's compliment
 
* 2's compliment
 
  
 
== Data storage ==
 
== Data storage ==

Revision as of 01:03, 21 May 2012

RPU0j.png
Assembly is currently in-progress. You are viewing an entry that is unfinished.
Assembly requires a basic understanding of bitwise math


Introduction

  • assembler - An assembler is a program that compiles human-readable operations into instructions interpreted by the processor
  • linker - A linker is a program that combines the compiled assembly objects into a binary. 'ld' is the standard linker on Linux platforms.

Compilers such as GCC/CC do both operations dynamically.

  • Assemble-time: Assembly & operands -> Opcode Sequence
  • Link-time: Flat binary of opcode sequence -> executable file format for OS
  • Runtime: Opcode Sequence -> hardware gates (may interact with ram etc)

Binary

  • counting
  • endianness
  • nybble - An uncommon unit of memory equivalent to 4 bits.
  • byte - A byte is a unit of memory equivalent to 8 bits.
  • word
  • dword
  • qword

Number handling

  • signed - Signed values are required to represent negative numbers. Most languages by default assume values are signed. The range of numbers it can assign extends from -1 downwards, depending on the data type.
  • unsigned - Despite not being able to assign negative numbers, unsigned values are particularly advantageous for positive ranges. The memory that would have been applied assigning a negative range is instead added to the positive range, giving you twice as many positive numbers.
  • 2's compliment

Data storage

  • register
  • pointer
  • sub-register
  • cpu flag registers
  • architecture-specific registers


Memory Addressing

  • stack pointer
  • instruction pointer
  • base pointer
  • addressing mode
  • index


Instructions

Syntaxes

  • Intel (dest, src)
  • ATT (src, dest)


Data manipulation basic primitives

  • mov
  • push
  • pop


Basic arithmetic

  • add
  • sub
  • div
  • mul


Bitwise mathematics operators

  • and
  • not
  • or
  • xor

Shifts and rotations

  • shl
  • shr
  • rol
  • ror

Control flow operators

  • cmp
  • jmp
  • call
  • ret

Taking it further

  • kernel interrupt
  • architecture
  • operating system