2--x86 Processor

Suppose a variables hexadecimal segment offset

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: m 0 to FFFFF hexadecimal. Programs cannot use linear addresses directly, so addresses are expressed using two 16-bit integers. A segment-offset address includes the following: • A 16-bit segment value, placed in one of the segment registers (CS, DS, ES, SS) • A 16-bit offset value The CPU automatically converts a segment-offset address to a 20-bit linear address. Suppose a variable’s hexadecimal segment-offset address is 08F1:0100. The CPU multiplies the segment value by 16 (10 hexadecimal) and adds the product to the variable’s offset: 08F1h 10h = 08F10h Adjusted Segment value: Add the offset: Linear address: (adjusted segment value) 08F10 0100 09010 A typical program has three segments: code, data, and stack. Three segment registers, CS, DS, and SS, contain the segments’ base locations: • CS contains the 16-bit code segment address • DS contains the 16-bit data segment address • SS contains the 16-bit stack segment address • ES, FS, and GS can point to alternate data segments, that is, segments that supplement the default data segment 2.3.2 Protected Mode Protected mode is the more powerful “native” processor mode. When running in protected mode, a program’s linear address space is 4 GBytes, using addresses 0 to FFFFFFFF hexadecimal. In the context of the Microsoft Assembler, the flat segmentation model is appropriate for protected mode programming. The flat model is easy to use because it requires only a single 32-bit integer to hold the address of an instruction or variable. The CPU performs address calculation and translation in the background, all of which are transparent to application programmers. Segment registers (CS, DS, SS, ES, FS, GS) point to segment descriptor tables, which the operating system uses to keep track of locations of individual program segments. A typical protected-mode program has three segments: code, data, and stack, using the CS, DS, and SS segment registers: • CS references the descriptor table for the code segment • DS references the descriptor table f...
View Full Document

This note was uploaded on 11/29/2013 for the course CSE 451 taught by Professor Hussein during the Winter '13 term at Fatih Üniversitesi.

Ask a homework question - tutors are online