Assembly Language - Segment Register

Assembly Language - Segment Register

 
                      So in the previous blog post we saw different data types used in the assembly language. Now in this blog post we are going to see different section in the assembly language.

                      And BTW section and segment are the same thing.

Segment Registers :-

  • These are special registers which generates memory addresses when combined with other registers
  • There are six segment registers as we already talked CS, DS, SS, ES, FS, GS.
  • If you still understand nothing then keep in mind that these segments are used to store different type of data/instruction. 
  • like for example code segment (CS) holds the code/instructions.
  • Data segment (DS) holds the initialized and uninitialized data.
  • stack segment (SS) used as stack.
  • Extra segment (ES) used as an extra data segment
  • FS and GS we will talk about them in future but remember that they are just data segment.
Assembly Language, Reverse Engineering, Binary Exploitation

Why each segment is of 64kb each?

  • As you can see in the above diagram the segment registers are 16 bit in size.
  • So whats the maximum value a 16 bit register can represent obviously it is 16 times 1 right (1111 1111 1111 1111)
  • so whats binary 1111 1111 1111 1111 in decimal that is 65535 right and in hex it is FFFF.
  • 1 KB = 1024 bytes so 65353 / 1024  gives 64 KB 
Assembly Language, Reverse Engineering, Binary Exploitation

Assembly Language, Reverse Engineering, Binary Exploitation

How many sections are there?

                        There are many sections but only four which are important to us are listed below
  • .text - Where your instructions are stored
  • .data - Where your initialized data is stored
  • .bss - Where your uninitialized data is stored
  • .rodata - Where read-only data is stored


Assembly Language, Reverse Engineering, Binary Exploitation


     The .text belongs to the code segment (CS) while .data .bss and .rodata belongs to data segment

      I hope you got this concepts if not feel free to ask and still didn't get it then don't worry we are going to study it in detail in future posts.



Assembly Language - Segment Register Assembly Language - Segment Register Reviewed by h4kk4 on March 27, 2020 Rating: 5

No comments:

Enter your comments here if you need any help:

Powered by Blogger.