A Free Lunch Tected Mode? Extra Kilobytes Can Be Quite Handy

Total Page:16

File Type:pdf, Size:1020Kb

A Free Lunch Tected Mode? Extra Kilobytes Can Be Quite Handy DOS UNBOUND: USES OF PROTECTED MODE exist but seem not to, the word virtual re- TWO VERSIONS OF THE DOS WRITE FUNCTION fers to things that seem to exist but don't. The 386 provides a V86 mode that Table 4:DOS extenders alter the normal DOS protocol; the source buffer can creates the illusicn of an 8086 machine hold 4 gigabytes of data. located in an arb:trary place in the 386 address space. The 386's segmentation Real -mode MS-DOS Int 21h function 40h and paging provide hardware assistance Write file or device for virtual memory; this allows it to pre- BX = handle tend that it has more memory than is CX = number of bytes to write physically present. DS:DX = segment:offset of buffer While V86 mode is generally used by 32 -bit protected -mode DOS extender multitaskers such as Desqview and Win- Int 21h function 40h dows or memory managers such as 386 - Write file or device Max or QEMM, Ergo's OS/386 makes a BX = handle ECX = number of bytes to write novel use of V86 mode. It uses it as a DS:EDX = segment:offset of buffer quick -and -dirty way to provide simple DOS applications (normally limited to something less than 640K bytes) with several hundred kilobytes more memory. without a program's knowledge andality. the DOS API includes the follow- Ergo's up program, which runs .EXP without any source code changes, almosting: absolute memory locations, port ad- files, can also run real -mode .EXE files. all genuine programs that use VM re-dresses, undocumented DOS calls and As table1 shows, when up runs underquire some recoding to get decent perfor- data structures, interrupt handlers, DOS OS/386 in this configuration, the real - mance. For example, if a program allo- exter sions (e.g., the mouse or NetBIOS), mode MEM program now allocatescates 13 MB of memory (of which only 3 and even the vagaries of real mode itself 617K bytes. MBis physical memory), and if the pro-(e.g., a segment ID corresponds to its ab- OS/386 also provides a utility calledgram frequently loops over, say, 4 MB at solute physical address divided by 16). giveameg. When this utility runs onany one time, the program will thrash Such code may represent less than 5 per- simple programs like MEM, it can pro- horribly. To be usable, the program cent of all code in a real DOS applica- vide up to1 MB of memory in V86 tion. Some of it may have been written to mode. (This only works on the 386.) Be- get around the 640K -byte or 64K -byte cause the resulting program isn't really DOS barriers, so you can simply ditch it running at the memory location that it when you work in 32 -bit protected mode. thinks it's running at, this technique Something But what about graphics code, interrupt won't work if yoJ need to address abso- handlers, and telecommunications or lute memory locations such as B8000h or that at first seems like networking code? How can you make 400h. But compilers and other stdio text such low-level code work in 32 -bit pro- processors may find that the few hundred a free lunch tected mode? extra kilobytes can be quite handy. This Most of the work in porting to pro- technique just takes a real -mode execut- is virtual memory. tected mode will be confined to small able and runs it; n a funny way. To take portions of your code. The best way to full advantage cf the 386, though, you proceed with such a port is to get all your have to switch to a 32 -bit compiler. modules to compile and link for 32 -bit Something that at first seems like a protected mode and then try to run the free lunch is virtual memory. Both Phar would need to be tweaked until its "lo-thing. The chances are good that the pro- Lap and Ergo crovide VM options forcality of reference" fell within 3 MB. gram will, in some way, break one of the their 32 -bit DOS extenders. From table 1 rules of protected mode. Because of you can see that, on the same machine Protection Violations these rules, protected mode is sometimes with 4 MB of memory, and with the So far, I haven't described anything re- regarded as an unfair and stern task mas- same source code (and, in fact, the same sembling the sort of work you might ex-ter, forcing you to change all your pro- MEM.EXP), the tiny program can allo- pect when porting code to a new environ- gramming habits in exchange for extra cate 13 MB of memory when it runsment. Unlike OS/2, for example, whichmegabytes of memory. In fact, you under VM. The 13 -MB limit was merelypresents an entirely new world view,should look on protected mode as a the amount of free disk space I had. DOS extenders try to preserve as much offriend that will help you incrementally For Ergo OS/386, using VM requiresyour old source code as possible. Their port your program. Because of protec- installing the os386vm TSR instead ofrelationship to MS-DOS is somewhat like tion, it's fairly difficult to crash the ma- os386. By default, this uses "only" 8that of early DOS to CP/M. The use ofchir.e. Instead, you just run your pro- MB of VM (i.e.. disk space), but you can INT 21h is, of course, the prime exam-gram until it violates protection, fix the reconfigure it. The 3861VMM option tople: 32 -bit protected -mode operationsproblem, and then let the program run Phar Lap's 386 DOS -Extender is a pro- have been made to look like plain -vanilla until it hits the next protection violation. tected -mode executable, VMMDRV DOS operations. The CPU itself, running in protected .EXP, which you can bind into your exe- But for most commercial DOS appli-mode, will find most of your problems cutable or, during development, run oncations, the MS-DOS application pro- for you. the DOS command line: run386 -vmgramming interface does not consist en- What does a protection violation look vmmdrv. exp mein. tirely of INT 21h calls, or even of BIOS like? For an example, look at TICKS, the While this shows that you can use VM calls such as INT 10h or INT 13h. In re- continued BYTE IBM Special Edition Fall 1990 255.
Recommended publications
  • Computing :: Operatingsystems :: DOS Beyond 640K 2Nd
    DOS® Beyond 640K 2nd Edition DOS® Beyond 640K 2nd Edition James S. Forney Windcrest®/McGraw-Hill SECOND EDITION FIRST PRINTING © 1992 by James S. Forney. First Edition © 1989 by James S. Forney. Published by Windcrest Books, an imprint of TAB Books. TAB Books is a division of McGraw-Hill, Inc. The name "Windcrest" is a registered trademark of TAB Books. Printed in the United States of America. All rights reserved. The publisher takes no responsibility for the use of any of the materials or methods described in this book, nor for the products thereof. Library of Congress Cataloging-in-Publication Data Forney, James. DOS beyond 640K / by James S. Forney. - 2nd ed. p. cm. Rev. ed. of: MS-DOS beyond 640K. Includes index. ISBN 0-8306-9717-9 ISBN 0-8306-3744-3 (pbk.) 1. Operating systems (Computers) 2. MS-DOS (Computer file) 3. PC -DOS (Computer file) 4. Random access memory. I. Forney, James. MS-DOS beyond 640K. II. Title. QA76.76.063F644 1991 0058.4'3--dc20 91-24629 CIP TAB Books offers software for sale. For information and a catalog, please contact TAB Software Department, Blue Ridge Summit, PA 17294-0850. Acquisitions Editor: Stephen Moore Production: Katherine G. Brown Book Design: Jaclyn J. Boone Cover: Sandra Blair Design, Harrisburg, PA WTl To Sheila Contents Preface Xlll Acknowledgments xv Introduction xvii Chapter 1. The unexpanded system 1 Physical limits of the system 2 The physical machine 5 Life beyond 640K 7 The operating system 10 Evolution: a two-way street 12 What else is in there? 13 Out of hiding 13 Chapter 2.
    [Show full text]
  • Open WATCOM Programmer's Guide
    this document downloaded from... Use of this document the wings of subject to the terms and conditions as flight in an age stated on the website. of adventure for more downloads visit our other sites Positive Infinity and vulcanhammer.net chet-aero.com Watcom FORTRAN 77 Programmer's Guide Version 1.8 Notice of Copyright Copyright 2002-2008 the Open Watcom Contributors. Portions Copyright 1984-2002 Sybase, Inc. and its subsidiaries. All rights reserved. Any part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of anyone. For more information please visit http://www.openwatcom.org/ Portions of this manual are reprinted with permission from Tenberry Software, Inc. ii Preface The Watcom FORTRAN 77 Programmer's Guide includes the following major components: · DOS Programming Guide · The DOS/4GW DOS Extender · Windows 3.x Programming Guide · Windows NT Programming Guide · OS/2 Programming Guide · Novell NLM Programming Guide · Mixed Language Programming · Common Problems Acknowledgements This book was produced with the Watcom GML electronic publishing system, a software tool developed by WATCOM. In this system, writers use an ASCII text editor to create source files containing text annotated with tags. These tags label the structural elements of the document, such as chapters, sections, paragraphs, and lists. The Watcom GML software, which runs on a variety of operating systems, interprets the tags to format the text into a form such as you see here. Writers can produce output for a variety of printers, including laser printers, using separately specified layout directives for such things as font selection, column width and height, number of columns, etc.
    [Show full text]
  • Operating System
    OPERATING SYSTEM INDEX LESSON 1: INTRODUCTION TO OPERATING SYSTEM LESSON 2: FILE SYSTEM – I LESSON 3: FILE SYSTEM – II LESSON 4: CPU SCHEDULING LESSON 5: MEMORY MANAGEMENT – I LESSON 6: MEMORY MANAGEMENT – II LESSON 7: DISK SCHEDULING LESSON 8: PROCESS MANAGEMENT LESSON 9: DEADLOCKS LESSON 10: CASE STUDY OF UNIX LESSON 11: CASE STUDY OF MS-DOS LESSON 12: CASE STUDY OF MS-WINDOWS NT Lesson No. 1 Intro. to Operating System 1 Lesson Number: 1 Writer: Dr. Rakesh Kumar Introduction to Operating System Vetter: Prof. Dharminder Kr. 1.0 OBJECTIVE The objective of this lesson is to make the students familiar with the basics of operating system. After studying this lesson they will be familiar with: 1. What is an operating system? 2. Important functions performed by an operating system. 3. Different types of operating systems. 1. 1 INTRODUCTION Operating system (OS) is a program or set of programs, which acts as an interface between a user of the computer & the computer hardware. The main purpose of an OS is to provide an environment in which we can execute programs. The main goals of the OS are (i) To make the computer system convenient to use, (ii) To make the use of computer hardware in efficient way. Operating System is system software, which may be viewed as collection of software consisting of procedures for operating the computer & providing an environment for execution of programs. It’s an interface between user & computer. So an OS makes everything in the computer to work together smoothly & efficiently. Figure 1: The relationship between application & system software Lesson No.
    [Show full text]
  • 2015 Test Questions
    VERSION 00000001 COMPSCI340/SOFTENG370 THE UNIVERSITY OF AUCKLAND SECOND SEMESTER, 2015 Campus: City COMPUTER SCIENCE / SOFTWARE ENGINEERING Operating Systems TEST (Time Allowed: 45 minutes) NOTE: Calculators are NOT permitted. Compare the test version number on the Teleform sheet supplied with the version number above. If they do not match, ask the test supervisor for a new sheet. Enter your name and student ID (in pencil) on the Teleform sheet. Your name and Student Id should both be entered left aligned. If your name is longer than the number of boxes provided, truncate it. Answer all questions on the Teleform answer sheet provided. Use a dark pencil to shade in your answers in the multiple choice answer boxes on the Teleform sheet. Check that the question number on the sheet corresponds to the question number in this question book. If you spoil your sheet, ask the supervisor for a replacement. Questions are worth marks as indicated. There are 26 questions worth 30 marks in total. CONTINUED VERSION 00000001 - 2 - COMPSCI340/SOFTENG370 THIS PAGE HAS BEEN INTENTIONALLY LEFT BLANK. CONTINUED VERSION 00000001 - 3 - COMPSCI340/SOFTENG370 MULTIPLE CHOICE QUESTIONS For each question, choose the best answer according to the information presented in lectures and in the textbook. Select your preferred answer on the Teleform answer sheet by shading in the appropriate box in pencil. There are 26 questions worth 30 marks in total. Question 1 [1 mark] Which of the following was NOT a theme/model for discussing operating systems in lectures? (a) The bare machine model (b) The resource allocator model (c) The manager model (d) The dustbin model (e) The onion model Question 2 [1 mark] Which of the following statements about environmental subsystems is FALSE? (a) The MS-DOS API could be provided as an environmental subsystem.
    [Show full text]
  • Intellio C320turbo User's Manual
    Intellio C320Turbo User's Manual An Advanced Professional Intelligent Multiport System for ISA bus with Desktop and Rackmount Options Jun. 1999 (3rd Edition) The content of this manual is also available in CD-ROM and at Moxa Web Site. Moxa Technologies Co., Ltd. Tel: +866-2-8665-6373 Fax: +886-2-8665-6372 www.moxa.com [email protected] Intellio C320Turbo User's Manual The software described in this manual is furnished under a license agreement and may be used only in accordance with the terms of the agreements. Copyright Notice Copyright ã 1999 Moxa Technologies Co., Ltd. All rights reserved. Reproduction in any form without permission is prohibited. Trademarks MOXA is a registered trademark of Moxa Technologies Co., Ltd. All other trademarks or registered marks in this manual belong to their respective manufacturers. Disclaimer Information in this document is subject to change without notice and does not represent a commitment on the part of Moxa. Moxa provides this document “as is”, without warranty of any kind, either expressed or implied, including, but not limited to, the particular purpose. Moxa may make improvements and/or changes in this manual or in the product(s) and/or the program(s) described in this manual at any time. Information provided in this manual is intended to be accurate and reliable. However, Moxa Technologies assumes no responsibility for its use, or for any infringements of rights of the fourth parties which may result from its use. This product could include technical or typographical errors. Changes are periodically made to the information herein; these changes may be incorporated in new editions of the publication.
    [Show full text]
  • Active Silicon SNAPPER SDK
    Active Silicon SNAPPER SDK SNAPPER SOFTWARE DEVELOPER’S KIT (SDK) • Allows rapid system development and integration using Snapper hardware. • Comprehensive library functions and documentation for all Snappers and Bus Interface Boards. • Comprehensive application examples with full source code. • Libraries supplied as dynamic link libraries (DLLs/.so) for all operating systems apart from static libraries for MS-DOS. • Royalty free (provided it is used in conjunction with Snapper hardware). • SDKs are available for the following operating systems: Windows NT, Windows 95, Windows 98, Windows 3.1x, MS-DOS (protected mode), MacOS, Solaris 2, LynxOS and Snapper SDK VxWorks. OVERVIEW The Snapper SDK is designed for OEMs and integrators using Snapper hardware. It contains comprehensive example applications and optimised libraries for a variety of operating systems (listed above). The API (application programming interface) is consistent across operating systems and hardware platforms allowing easy migration between for example, Windows 3.1x to Windows 95/98/NT, or perhaps from the ISA Bus Interface Board to the PCI Bus Interface Board. The Snapper SDK (pictured above) contains detailed manual pages on all the Snapper functions as well as sections on installation, a developer’s guide, error handling, JPEG (“Crunch”) compression, a glossary and technical notes. Also included is a general purpose imaging library - the “TMG” library, which again runs on all of the above operating systems. This imaging library contains many general purpose imaging functions for the loading, saving, displaying and pixel format conversion of images. A key feature of the display functionality is that the API is virtually independent of the programming environment (e.g.
    [Show full text]
  • Are Central to Operating Systems As They Provide an Efficient Way for the Operating System to Interact and React to Its Environment
    1 www.onlineeducation.bharatsevaksamaj.net www.bssskillmission.in OPERATING SYSTEMS DESIGN Topic Objective: At the end of this topic student will be able to understand: Understand the operating system Understand the Program execution Understand the Interrupts Understand the Supervisor mode Understand the Memory management Understand the Virtual memory Understand the Multitasking Definition/Overview: An operating system: An operating system (commonly abbreviated to either OS or O/S) is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer. The operating system acts as a host for applications that are run on the machine. Program execution: The operating system acts as an interface between an application and the hardware. Interrupts: InterruptsWWW.BSSVE.IN are central to operating systems as they provide an efficient way for the operating system to interact and react to its environment. Supervisor mode: Modern CPUs support something called dual mode operation. CPUs with this capability use two modes: protected mode and supervisor mode, which allow certain CPU functions to be controlled and affected only by the operating system kernel. Here, protected mode does not refer specifically to the 80286 (Intel's x86 16-bit microprocessor) CPU feature, although its protected mode is very similar to it. Memory management: Among other things, a multiprogramming operating system kernel must be responsible for managing all system memory which is currently in use by programs. www.bsscommunitycollege.in www.bssnewgeneration.in www.bsslifeskillscollege.in 2 www.onlineeducation.bharatsevaksamaj.net www.bssskillmission.in Key Points: 1.
    [Show full text]
  • Dos Protected Mode Interface (Dpmi) Specification
    DOS PROTECTED MODE INTERFACE (DPMI) SPECIFICATION Version 1.0 March 12, 1991 Application Program Interface (API) for Protected Mode DOS Applications © Copyright The DPMI Committee, 1989-1991. All rights reserved. Please send written comments to: Albert Teng, DPMI Committee Secretary Mailstop: NW1-18 2801 Northwestern Parkway Santa Clara, CA 95051 FAX: (408) 765-5165 Intel order no.: 240977-001 DOS Protected Mode Interface Version 1.0 Copyright The DPMI Specification Version 1.0 is copyrighted 1989, 1990, 1991 by the DPMI Committee. Although this Specification is publicly available and is not confidential or proprietary, it is the sole property of the DPMI Committee and may not be reproduced or distributed without the written permission of the Committee. The founding members of the DPMI Committee are: Borland International, IBM Corporation, Ergo Computer Solutions, Incorporated, Intelligent Graphics Corporation, Intel Corporation, Locus Computing Corporation, Lotus Development Corporation, Microsoft Corporation, Phar Lap Software, Incorporated, Phoenix Technologies Ltd, Quarterdeck Office Systems, and Rational Systems, Incorporated. Software vendors can receive additional copies of the DPMI Specification at no charge by contacting Intel Literature JP26 at (800) 548-4725, or by writing Intel Literature JP26, 3065 Bowers Avenue, P.O. Box 58065, Santa Clara, CA 95051-8065. DPMI Specification Version 0.9 will be sent out along with Version 1.0 for a period about six months. Once DPMI Specification Version 1.0 has been proven by the implementation of a host, Version 0.9 will be dropped out of the distribution channel. Disclaimer of Warranty THE DPMI COMMITTEE EXCLUDES ANY AND ALL IMPLIED WARRANTIES, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    [Show full text]
  • Egrabber-4Plus, English
    eGrabber-4plus Hardware Manual Edition June 2004 A product of a PHYTEC Technology Holding company eGrabber-4plus In this manual are descriptions for copyrighted products that are not explicitly indicated as such. The absence of the trademark () and copyright () symbols does not imply that a product is not protected. Additionally, registered patents and trademarks are similarly not expressly indicated in this manual. The information in this document has been carefully checked and is believed to be entirely reliable. However, PHYTEC Meßtechnik GmbH assumes no responsibility for any inaccuracies. PHYTEC Meßtechnik GmbH neither gives any guarantee nor accepts any liability whatsoever for consequential damages resulting from the use of this manual or its associated product. PHYTEC Meßtechnik GmbH reserves the right to alter the information contained herein without prior notification and accepts no responsibility for any damages which might result. Additionally, PHYTEC Meßtechnik GmbH offers no guarantee nor accepts any liability for damages arising from the improper usage or improper installation of the hardware or software. PHYTEC Meßtechnik GmbH further reserves the right to alter the layout and/or design of the hardware without prior notification and accepts no liability for doing so. Copyright 2004 PHYTEC Meßtechnik GmbH, D-55129 Mainz. Rights - including those of translation, reprint, broadcast, photomechanical or similar reproduction and storage or processing in computer systems, in whole or in part - are reserved. No reproduction may
    [Show full text]
  • Datalight ROM-DOS User's Guide
    Datalight ROM-DOS User’s Guide Created: April 2005 Datalight ROM-DOS User’s Guide Copyright © 1999-2005 by Datalight, Inc . Portions copyright © GpvNO 2005 All Rights Reserved. Datalight, Inc. assumes no liability for the use or misuse of this software. Liability for any warranties implied or stated is limited to the original purchaser only and to the recording medium (disk) only, not the information encoded on it. U.S. Government Restricted Rights. Use, duplication, reproduction, or transfer of this commercial product and accompanying documentation is restricted in accordance with FAR 12.212 and DFARS 227.7202 and by a license agreement. THE SOFTWARE DESCRIBED HEREIN, TOGETHER WITH THIS DOCUMENT, ARE FURNISHED UNDER A SEPARATE SOFTWARE OEM LICENSE AGREEMENT AND MAY BE USED OR COPIED ONLY IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF THAT AGREEMENT. Datalight and ROM-DOS are registered trademarks of Datalight, Inc. FlashFX ® is a trademark of Datalight, Inc. All other product names are trademarks of their respective holders. Part Number: 3010-0200-0716 Contents Chapter 1, ROM-DOS Introduction..............................................................................................1 About ROM-DOS ......................................................................................................................1 Conventions Used in this Manual .......................................................................................1 Terminology Used in this Manual ......................................................................................1
    [Show full text]
  • Irmx ICU User's Guide and Quick Reference
    iRMX® ICU User’s Guide and Quick Reference _______________________________ Order Number: 611036-003 In the United States, additional copies of this manual or other Intel literature may be obtained by writing: Literature Distribution Center Intel Corporation P.O. Box 7641 Mt. Prospect, IL 60056-7641 Or you can call the following toll-free number: 1-800-548-4725 In locations outside the United States, obtain additional copies of Intel documentation by contacting your local Intel sales office. For your convenience, international sales office addresses are printed on the last page of this document. Contact your local sales office to obtain the latest specifications before placing your order. Intel Corporation (Intel) makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Intel assumes no responsibility for any errors that may appear in this document. Intel makes no commitment to update nor to keep current the information contained in this document. No part of this document may be copied or reproduced in any form or by any means without prior written consent of Intel. Intel retains the right to make changes to these specifications at any time, without notice. Intel software products are copyrighted by and shall remain the property of Intel Corporation. Use, duplication or disclosure is subject to restrictions stated in Intel's Software License Agreement. U.S. GOVERNMENT RESTRICTED RIGHTS: These software products and documentation were developed at private expense and are provided with "RESTRICTED RIGHTS." Use, duplication, or disclosure by the Government is subject to restrictions as set forth in FAR 52.227-14 and DFAR 252.227-7013 et seq.
    [Show full text]
  • DOS Extender (Often Called a DOS Extender,Or Even Just an Extender) Is a Library That Assists in Running 32-Bit MS-DOS-Based Programs
    Chen_Rev_Appendix B.qxp 12/6/06 10:54 AM Page 1 HOW TO ENSURE THAT YOUR PROGRAM DOES NOT RUN HUNDER WINDOWS 95 My primary focus for much of the Windows 95 project was MS-DOS application compatibility, specifically games. To help maintain my sanity, I found myself writing the following account, illustrating the phenomenal creativity of software developers in doing everything within their power to be incompatible with Windows 95. This chapter is a very technical one, originally written for an audience con- sisting of developers deeply steeped in the minutiae of protected-mode pro- gramming. I have attempted to clarify the jargon, but the issue is unavoidably technical. Here are some terms you will encounter: •The Global Descriptor Table (GDT) is a central data structure that is used by the CPU and that controls how programs access memory. Allowing access to the GDT effectively grants total control of the computer. • Real mode was the only mode supported by the CPU prior to the introduction of the 80286. MS-DOS was originally developed to run in real mode. Real mode has no memory protection. Modern operating systems use real mode only transitionally on their way to 1 Chen_Rev_Appendix B.qxp 12/6/06 10:54 AM Page 2 2 the old new thing protected mode, which is a mode of the CPU in which memory protection becomes available. •The DOS Protected-Mode Interface (DPMI) and the Virtual Control Program Interface (VCPI) are two popular interfaces for writing 32-bit DOS-based programs. Windows 3.0 and higher support DPMI.
    [Show full text]