Dr. Dobb's Toolbook of 80286/80386 Programming [1 ed.] 0934375429


226 100 193MB

English Pages [737] Year 1988

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Cover
Limits of Liability and Disclaimer of Warranty
How to Order the Accompanyying Disk
Contents
Introduction
I: Architecture and Implications of the 80386
1 Anatomy of a 386 - Winn L. Rosch
Wathching the Clock
Moving Memory
Static Subterfuge
Weaving Memories
Coprocessor Choice
Compatibility Concerns
Mass Storage
2 Upward to the 80386 - Caldwell Crosswy and Mike Perez
Solid Foundations
80286 Expands Limits
A Few Constraints
Stepping up to 32 Bits
Instruction Enhancements
A 4 GB Improvement
Modes of Operation
Full Family Compatibility
Virtual Perfomance
Programming Considerations for the Intel Family
Making the Most of the 80386 Today
3 Programming on the 80386 - Ross Nelson
Operating Modes
The 286/386 Protection Model
Native Architecture and Instruction Set
Paging
Performance
Additional Features
Summary
Bibliography
II: Moving Up from the 8088 and Real Mode to the 286/386 Generation and Protected Mode
4 Determining CPU Type - Bob Felts
5 Performance Programming - Joel Rosenblum and Dan Jacobs
Defining Performance Programming
Defining the Generic PC
Defining a Features Table
Using the Features Table
Determining CPU Type
Detecting Video Type
6 Moving from the 8088 to the 80286 - William J. Claff
The 8088 Microprocessor
8088 Addressing
8088 Interrupts
The 80286 Central Processing Unit
80286 Execution Unit
80286 Interrupts
Protected Mode
Differences
Conclusion
References
7 Experimenting with Protected Mode on the AT - Marshall Brain
Differences Between the PC and the AT
Segment Registers
How Descriptor Tables Work
Getting Into Protected Mode
An Example Program
Experimenting
Conclusion
References
8 A Protected-Mode Program for the PC AT - Ross Nelson
Processor Overview
Protection
The Protected-Mode Program
Tables
Initialization
Protected-Mode Execution
Fault Handlers
Suggestions for Expansion
Bibliography
9 286/386 Protected-Mode Programming - Joel Barnum
Modes of Operation
The Segment Descriptor
Behavioral Problems
Sensitive and Privileged
Living Within Limits
Time to Day Piper
10 80286/80386 Programming - Bud E. Smith
Higher Clock Speeds
Fewer Clocks per Instruction
Pipelining
New Instructions
Speed Increases for the 80386 Only
Why Assembler on the 80386
Better 80386 Programs
III: Using More Memory: Expanded and Virtual
11 Virtual Memory, Virtual Machines - John Shiell
Virtual Memory Schemes
The 80286 VM Schemes
The 80386 VM Schemes
Effects of Virtual Memory
Virtual Machines
The Wrap-Up
Why No 80386 Virtual Machine?
12 Memory Addressing on the Intel 80386 - Howard Vigorita
13 LIM EMS 4.0: A Definition for the Next Generation of Expanded Memory - Marion Hansen and John Driscoll
New Feature Set
EMS 4.0 Enhancements
The Page Frame
New EMM Parameters
The EMM Functions
Program Functions
Environment Functions
Example Programs
To Get EMS 4.0
IV: Operating Systems Part I: DOS, Environments, and UNIX
14 386 Operating Environments - Ed McNierney
Concurrent Heritage
Getting Acquainted
Using Concurrent
Concurrent Compatibility
Modular System
Setup
Using PC-MOS/386
Compatibility and Performance
Mutiuser Asset
Virtual Environment
Getting Started
Using Windows/386
Compatibility and Performance
Impressive Environment
Multitasking Platform
Simple Start-Up
Using DESQview
Compatibility and Performance
EGA Version on the Way
Multiple Applications Now
Virtual Machines on the 80386
15 Microsoft Windows/386: Creating a Virtual Machine Environment - Ray Duncan
An Intel Retrospective
The Four Modes
Device Virtualization
The User Interface
How Windows/386 Works
Windows/386 Multitasking
Many Machines, One DOS
Communications
Portents of the Future
16 Choosing an Operating System - Ed McNierney
The Range of Features
Application Availability
Multitasking
Large Address Space
Multiuser Support
Realtime Capability
Files Larger Than 32MB
Graphics Support
Communication Support
Sweeping Approaches
Enhanced Operating Systems
Control Programs (Application Managers)
Application Environments
The Choice is Yours
17 Marrying UNIX and the 80386 - Carl Hensler and Ken Sarno
Address Translation
Page Faults
Memory Protection
Segmented versus Nonsegmented Addressing
Separate or Combined User and Kernel Address Spaces
Who's on Top?
User and Kernel Segment Layout
Kernel Sections
User Program Sections
Memory Management Data Structures
Processes and Sections
Page Table and Page Frame Management
Pages in Memory and on Disk
Page Caching
How it Works
A Happy Marriage
18 Intel's 386 Unites UNIX and DOS Software - Clif Purkiser
Suppors Virtual Machines
V86 Accelerates DOS Execution
VM Monitor Translates 8086 Calls
How to Create a VM Monitor
Interrupt Handler Directs Trafic
Translator Operates Functions
Emulator Simulates Peripherals
Virtual Machine Speeds Execution
The 80386 as a UNIX Engine
19 Programming Considerations in Porting to Microsoft XENIX System V/386 - Martin Dunsmuir
Small-Model Programs
Large- and Middle-Model
Large Code
Large Data
Hybrid Model
32-Bit Programming
New XENIX Applications
Application Size
Portability
XENIX and UNIX Markets
Performance
Demand Paging and Virtual Memory
Conclusion
V: Operating Systems Part II: OS/2 Basics
20. An Architecture for the Future - Martin Heller
The Hardware Environment
The Multitasking Edge
Memory Management
DOS Compatibility
I/O Services
Dynamic Linking
Dexterous Drivers
Timing Specifications
How Protected Mode Protects
Coding for Virtual Memory
21. A Programmer's Introduction to OS/2 - Ray Duncan
Key Features of OS/2
Application Program Interface
Preemptive Nultitasking
Interprocess Comunication
Memory Protection and Virtual Memory
Dynamic Linking
Compatibility with MS-DOS
A Simple OS/2 Application
Building the Application
Making a Family App
22. The OS/2 Applications Family - Ray Duncan
"Old" MS-DOS Applications
Family Apps
Kernel Apps
Windows/Presentation Manager Apps
The Tools
An Example Kernel App
Assembling and Linking DUMP.ASM
Compiling and Linking DUMP.C
To Port a Program
23. OS/2 Multitasking: Exploiting the Protected Mode of the 80286 - Ray Duncan
Processes
Threads
Configuring the OS/2 Multitasker
Screen Groups
OS/2 Programming
Managing Threads
Summary
24. Multiple Tasks - Steven Armbrust and Ted Forgeron
Sessions
Processes
Threads
Scheduling Threads
Dividing Applications
Interprocess Comunication
Semaphores
Shared Memory
Queues
Signals
25. OS/2 Virtual Memory Management Vic Heller
Dynamic Linking and Sharing
Some Tips On Usage
VI: Operating Systems Part III: Porting to OS/2 and the Presentation Manager
26 Compatibility and Transition for MS-DOS Programs - Joel Gillman
Compatibility Mode
Handling Devices
80286 Restrictions
FAPI
Bimodal Device Drivers
New Tools
Device Monitors
The Tradeoff
Some Programming Don'ts for OS/2
OS/2 API Calls
27 Converting DOS Programs to OS/2 Protected Mode - David A. Schmitt
Programmers, Know Thy Code!
Programs: The Good, the Bad, and the Ugly
1) Well-Behaved Programs
2) Higly Interactive Programs
2.1) Converting The Keyboard Interface
2.2) Converting The Mouse Interface
2.3) Converting Video BIOS Calls
2.4) Converting Video RAM Accesses
2.5) Converting Graphic Programs
3) Terminate-Stay_Resident (TSR) Programs
4) I/O Drivers
Family Mode Considerations
Summary
28 Porting to OS/2 - Steven Armbrust
Planning the Conversion
Switch to C
One-Man Job
Better with OS/2
29 Preparing for Presentation Manager: Paradox Steps Up to Windows 2.0 - Craig Stinson
Sound Design Pays Off
Why Windows
The Good News
A Natural Fit
Visual Interaction
Implementation Advantages
Debugging Difficulties
User Advantages
Performance Hits
Fears Allayed
Paradox Under Microsoft OS/2
30 The OS/2 Windows Presentation Manager: Microsoft Windows on the Future - Manny Vellon
Protected Mode
User Interface
API
The Future
VII: 286/386 Programming Products and Tips
31 80386 Operating Systems Examples - Chris Crawford
Syntax
Segment/Ends
USE32/USE16
AT
ORG
ASSUME
Syntax Example
Initialization Example
Overview of Example 1
Assumptions
Multitasking and Protection
Virtual Address Space
Linear Address Space
Page Mapping
Physical Address
Task Switch
Details of Initialization Example
Equates
Segment Definitions
Code Sequence 1 - Cold Start
Code Sequence 2 - Miscellaneous
Code Sequence 3 - Build GDT, LGDT
Code Sequence 4 - Enter Protected Mode
Code Sequence 5 - load Segment Descriptors
Code Sequence 6 - Build LDT, LLDT
Code Sequence 7 - Build IDT
Code Sequence 8 - Build Page Directory
Code Sequence 9 - Build Page Tables
Code Sequence 10 - Enable Paging
Code Sequence 11 - Load Operating-System Stack Pointer
Code Sequence 12 - Build TSS
Load User Stack
Prepare for User Task Invocation
Invoke User Task
Coprocessor Exception Handler
Overview of Example 2
Details of Exception Handler
Code Sequience 1 - Emulation
Code Sequience 2 - Current Task Base
Code Sequience 3 - Save Old State
Code Sequience 4 - Load New State
32 80386 Software Development - M. Steven Baker
Why Bother with the 386 Anyway?
80386 DOS Runtime Environments
Some General Observations
A.I. Architects OS/386
IGC X-AM Development Environment
Phar Lap 386|DOS Extender
MetaWare High C and High C-386
LPI FORTRAN
MicroWay NDP FORTRAN-386
SAIC FORTRAN-386
A.I. Architects' Humminboard Coprocessor
And the Envelope, Please
33 Developing 80386 Applications ... Today - Richard Relph
The Compiler
Compiler Perfomance
The Linker
The Environments
The Hardware
Summary
Vendors
VIII: Coprocessors
34 Peripherals Enhance 80386 Design Options - V. Siva Kumar
Math Coprecessor Speed Floating-Point Performance
Match Memory Bandwidth to Processor Cycle
DMA Controller Takes Over Data Transfer
System Hardware Examples
Software Compatibility Brings Huge Selection
35 Increase the Performance of Your Programs with a Math Coprocessor - Marion Hansen and Lori Sargent
Development Tools
Synergy
Data Types
Registers
Exceptions
Instructions
Real vs. Protected
36 The 80387 and Its Applications - David Perlmutter and Alan Kin-Wah Yuen
External Architecture
Interface Protocols
Internal Architecture
Features and Major Enhancements
Applications
Numeric Programming Example
Additional Reading
37 Programming the 80387 Coprocessor - Prakash Chandra
Architectural Overview
New Instructions in the 80387
Extended Operand Range
Rounding Control
Denormal Operations
Types of Exceptions
Programming Examples
New Look
Processor Initialization and Control
80387 Performance
38 How to Get Better Floating-Point Results - Carl Byington
Precision and How to Keep It
39 Avoiding Coprocessor Bottlenecks - Mauro Bonomi
Bottlenecks Limit Performance
Low-Latency Data Paths
View of the System Address Bus
Generating Instructions
Large Register Set
Compiling: An Example
Programming for Performance
Boiling Down
40 New Issues in PC Graphics - Ed McNierney
Two Examples
Optimized for Graphics
New Expertice is Needed
Communication and Synchronization
Black Boxes
Dealing with Text
Virtual Displays
The Next Generation
Conclusion
41 High-Performance Graphics: Intel 82786 - Ed McNierney
BIU Control
Display Processor
Graphics Processor
Local Memory
Slaves and Masters
Heart of Multitasking
42 Inside the 82786 Graphics Chip Bill Nicholls
Graphics Coprocessor Architecture
The Graphics Processor
The Display Processor
Memory-Access Priorities
Manipulating Bit Maps
Graphics Memory
The Programmer's Model
Raster Operations
Future Impact
Managing Windows
Appendix: IBM PC Family BIOS Comparison - John Shiell
More Programming Tools from M&T Books