Special segment-registers

Slides:



Advertisements
Similar presentations
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
Advertisements

Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
FEATURES OF 80386: Two versions of are commonly available: 1) 80386DX
Intel MP.
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Lecture 6 Machine Code: How the CPU is programmed.
IA32 Paging Scheme Introduction to the Pentium’s support for “virtual” memory.
Task-Switching How the x86 processor assists with context-switching among multiple program-threads.
Operating Systems: Segments 1 Segmentation Hardware Support single user program system: – wish somehow to relocate address 0 to after operating system.
IA32 Paging Scheme Introduction to the Intel x86’s support for “virtual” memory.
Getting Ready to Enter x86 Protected Mode Survival tactics for enabling Protected-Mode with a minimum of supporting infrastructure.
EM64T ‘fast’ system-calls A look at the requirements for using Intel’s ‘syscall’ and ‘sysret’ instructions in 64-bit mode.
IA-32 Processor Architecture
Page-Faults in Linux How can we study the handling of page-fault exceptions?
Interrupts in Protected-Mode Writing a protected-mode interrupt-service routine for the timer-tick interrupt.
The various x86 ‘modes’ On understanding key differences among the processor’s several execution-architectures.
Defining protected-mode segment-descriptors An example of a protected-mode bootsector application that draws a message to the video display.
Venturing into protected-mode A first look at the CPU registers and instructions which provide the essential supporting infrastructure.
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
Venturing into 64-bit mode Examining the steps needed to take the processor into IA-32e mode -- and then back out again.
Segment-registers’ hidden bits A look at how segmentation attributes are cached within the CPU’s segment-registers.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Venturing into protected-mode
Model-Specific Registers A look at Intel’s scheme for introducing new CPU features.
A ‘protected-mode’ exploration A look at the steps needed to build segment-descriptors for displaying a message while in protected-mode.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Venturing into protected-mode A first look at the CPU registers and instructions which provide the essential supporting infrastructure.
Interrupts in Protected-Mode Writing a protected-mode interrupt-service routine for the timer-tick interrupt.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
ADDRESSING MODES OF Addressing Modes of  To perform any operation, we have to give the corresponding instructions to the microprocessor.
Intel MP (32-bit microprocessor) Designed to overcome the limits of its predecessor while maintaining the software compatibility with the.
Microprocessor system architectures – IA32 segmentation Jakub Yaghob.
The Pentium Processor.
The Pentium Processor Chapter 3 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
The Pentium Processor Chapter 3 S. Dandamudi.
The Intel Microprocessors. Real Mode Memory Addressing Real mode, also called real address mode, is an operating mode of and later x86-compatible.
Multitasking Mr. Mahendra B. Salunke Asst. Prof. Dept. of Computer Engg., STES SITS, Narhe, Pune-41 STES Sinhgad Institute of Tech. & Science Dept. of.
Intel Pentium II Processor Brent Perry Pat Reagan Brian Davis Umesh Vemuri.
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
(-133)*33+44* *33+44*14 Input device memory calculator Output device controller Control bus data bus memory.
Microprocessor system architectures – IA32 tasks Jakub Yaghob.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
AMD K-6 Processor Evaluation. Registers AMD-K6 Registers General purpose registers Segment registers Floating point registers MMX registers EFLAGS register.
1 Microprocessors CSE Protected Mode Memory Addressing Remember using real mode addressing we were previously able to address 1M Byte of memory.
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
Chapter 2 The Microprocessor Architecture Microprocessors prepared by Dr. Mohamed A. Shohla.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
RISC / CISC Architecture by Derek Ng. Overview CISC Architecture RISC Architecture  Pipelining RISC vs CISC.
Information Security - 2. Descriptor Tables There are two descriptor tables – Global Descriptor Tables – Local Descriptor Tables The global descriptor.
Computer Science 516 Intel x86 Overview. Intel x86 Family Eight-bit 8080, 8085 – 1970s 16-bit 8086 – was internally 16 bits, externally 8 bits.
EEL 4709C Prof. Watson Herman Group 4 Ali Alshamma, Derek Montgomery, David Ortiz 11/11/2008.
Chapter Overview General Concepts IA-32 Processor Architecture
Assembly language.
Part of the Assembler Language Programmers Toolbox
William Stallings Computer Organization and Architecture 8th Edition
143A: Principles of Operating Systems Lecture 5: Address translation
Information Security - 2
Basic Microprocessor Architecture
Homework Reading Continue work on mp1
Page Replacement Implementation Issues
CS 301 Fall 2002 Computer Organization
Page Replacement Implementation Issues
Computer Architecture and the Fetch-Execute Cycle
Computer Architecture CST 250
Information Security - 2
CPU Structure CPU must:
CS334: MIPS language _Mars simulator Lab 2_1
Computer Architecture and System Programming Laboratory
CS444/544 Operating Systems II Virtual Memory
Presentation transcript:

Special segment-registers How to utilize registers FS and GS for addressing memory-operands while in IA-32e mode

Code/Data Descriptor-Format 63 32 Base[31..24] G D L A V L Limit [19..16] P D P L S X C / D R / W A Base[23..16] Base[15..0] Limit[15..0] 31 Legend: G = Granularity: (0=byte-granularity, 1=page-granularity) D = Default operand and address size: (0=16-bits, 1=32-bits) L = Long (0=compatibility mode code/data, 1=64-bit code) AVL = Available (this bit can be used by programmers for any purpose) NOTE: These descriptors can only store 32-bits as a segment’s base-address

IA32_FS_BASE This Model-Specific Register is now a part of the official Intel Architecture It provides a “back door” to the hidden part of segment-register FS It allows use of a 64-bit base-address for segment-register addressed by FS when the CPU is executing in 64-bit mode Its MSR register-index is 0xC0000100

Loading register FS In “compatibility” mode the upper 32-bits of the “hidden” 64-bit segment base-address for FS will be disregarded by the CPU for computing memory-operand addresses But in 64-bit mode the full 64-bit value of the “hidden” FS segment’s base-address will be used in forming effective addresses How does FS segment-base get loaded?

It depends on cpu mode In “compatibility” mode, we continue to put segment-sectors into register FS: mov $sel_fs, %ax mov %ax, %fs This loads the bottom 32-bits into FS from the Global (or the Local) Descriptor Table The upper 32-bit are unmodified, and are disregarded, in “compatibility” mode

Use ‘wrmsr’ in 64-bit mode In 64-bit mode, the ‘wrmsr’ instruction can be used to load the full 64-bits of segment base-address into the “hidden” part of the FS segment-register: mov base_lo32, %eax mov base_hi32, %edx mov $0xC0000100, %ecx wrmsr

GS is similar The foregoing remarks about register FS also apply to register GS There is a 64-bit IA32_GS_BASE register that is accessed with ‘rdmsr’ and ‘wrmsr’ Its MSR register-index is 0xC0000101

The ‘swapgs” instruction There is a third Model Specific Register that gets used (in 64-bit mode) with the IA32_GS_BASE register, officially named the IA32_KERNEL_GS_BASE register Its MSR register-index is 0xC0000102 A special instuction can be used by ring0 code to exchange the contents of these two Model-Specific Registers

In-class exercise Use our ‘newapp64.cpp’ development-tool to quickly create the boilerplate code for a boot-time program that takes the CPU into its IA-32e mode (where you can try some experiments with registers FS and GS, as well as the privileged ‘swapgs’ instruction) Can you “map” the topmost page-frame to video-memory, then use IA32_FS_BASE to write a message to screen-memory?