Главная » Просмотр файлов » Volume 3A System Programming Guide_ Part 1

Volume 3A System Programming Guide_ Part 1 (794103), страница 33

Файл №794103 Volume 3A System Programming Guide_ Part 1 (Intel and AMD manuals) 33 страницаVolume 3A System Programming Guide_ Part 1 (794103) страница 332019-04-28СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 33)

The base address plus the offset thus forms a linear address in theprocessor’s linear address space.Logical Address(or Far Pointer)SegmentSelectorOffsetLinear AddressSpaceGlobal DescriptorTable (GDT)DirLinear AddressTableOffsetSegmentPage TableSegmentDescriptorPage DirectoryLin. Addr.PhysicalAddressSpacePagePhy. Addr.EntryEntrySegmentBase AddressPageSegmentationPagingFigure 3-1. Segmentation and PagingIf paging is not used, the linear address space of the processor is mapped directlyinto the physical address space of processor. The physical address space is defined asthe range of addresses that the processor can generate on its address bus.Because multitasking computing systems commonly define a linear address spacemuch larger than it is economically feasible to contain all at once in physical memory,some method of “virtualizing” the linear address space is needed.

This virtualizationof the linear address space is handled through the processor’s paging mechanism.Paging supports a “virtual memory” environment where a large linear address spaceis simulated with a small amount of physical memory (RAM and ROM) and some disk3-2 Vol. 3PROTECTED-MODE MEMORY MANAGEMENTstorage. When using paging, each segment is divided into pages (typically 4 KByteseach in size), which are stored either in physical memory or on the disk.

The operating system or executive maintains a page directory and a set of page tables to keeptrack of the pages. When a program (or task) attempts to access an address locationin the linear address space, the processor uses the page directory and page tables totranslate the linear address into a physical address and then performs the requestedoperation (read or write) on the memory location.If the page being accessed is not currently in physical memory, the processor interrupts execution of the program (by generating a page-fault exception). The operating system or executive then reads the page into physical memory from the diskand continues executing the program.When paging is implemented properly in the operating-system or executive, theswapping of pages between physical memory and the disk is transparent to thecorrect execution of a program.

Even programs written for 16-bit IA-32 processorscan be paged (transparently) when they are run in virtual-8086 mode.3.2USING SEGMENTSThe segmentation mechanism supported by the IA-32 architecture can be used toimplement a wide variety of system designs. These designs range from flat modelsthat make only minimal use of segmentation to protect programs to multisegmented models that employ segmentation to create a robust operating environment in which multiple programs and tasks can be executed reliably.The following sections give several examples of how segmentation can be employedin a system to improve memory management performance and reliability.3.2.1Basic Flat ModelThe simplest memory model for a system is the basic “flat model,” in which the operating system and application programs have access to a continuous, unsegmentedaddress space.

To the greatest extent possible, this basic flat model hides thesegmentation mechanism of the architecture from both the system designer and theapplication programmer.To implement a basic flat memory model with the IA-32 architecture, at least twosegment descriptors must be created, one for referencing a code segment and onefor referencing a data segment (see Figure 3-2).

Both of these segments, however,are mapped to the entire linear address space: that is, both segment descriptorshave the same base address value of 0 and the same segment limit of 4 GBytes. Bysetting the segment limit to 4 GBytes, the segmentation mechanism is kept fromgenerating exceptions for out of limit memory references, even if no physicalmemory resides at a particular address. ROM (EPROM) is generally located at the topof the physical address space, because the processor begins execution atVol. 3 3-3PROTECTED-MODE MEMORY MANAGEMENTFFFF_FFF0H. RAM (DRAM) is placed at the bottom of the address space because theinitial base address for the DS data segment after reset initialization is 0.3.2.2Protected Flat ModelThe protected flat model is similar to the basic flat model, except the segment limitsare set to include only the range of addresses for which physical memory actuallyexists (see Figure 3-3).

A general-protection exception (#GP) is then generated onany attempt to access nonexistent memory. This model provides a minimum level ofhardware protection against some kinds of program bugs.Linear Address Space(or Physical Memory)SegmentRegistersCSCodeCode- and Data-SegmentDescriptorsNot PresentSSDSESFFFFFFFFHAccessLimitBase AddressData andStack0FSGSFigure 3-2. Flat ModelSegmentRegistersSegmentDescriptorsLinear Address Space(or Physical Memory)AccessLimitBase AddressCodeFFFFFFFFHCSNot PresentESSSDSFSMemory I/OAccessLimitBase AddressData andStackGS0Figure 3-3.

Protected Flat Model3-4 Vol. 3PROTECTED-MODE MEMORY MANAGEMENTMore complexity can be added to this protected flat model to provide more protection. For example, for the paging mechanism to provide isolation between user andsupervisor code and data, four segments need to be defined: code and datasegments at privilege level 3 for the user, and code and data segments at privilegelevel 0 for the supervisor. Usually these segments all overlay each other and start ataddress 0 in the linear address space. This flat segmentation model along with asimple paging structure can protect the operating system from applications, and byadding a separate paging structure for each task or process, it can also protect applications from each other.

Similar designs are used by several popular multitaskingoperating systems.3.2.3Multi-Segment ModelA multi-segment model (such as the one shown in Figure 3-4) uses the full capabilities of the segmentation mechanism to provided hardware enforced protection ofcode, data structures, and programs and tasks. Here, each program (or task) is givenits own table of segment descriptors and its own segments. The segments can becompletely private to their assigned programs or shared among programs. Access toall segments and to the execution environments of individual programs running onthe system is controlled by hardware.Vol.

3 3-5PROTECTED-MODE MEMORY MANAGEMENTSegmentRegistersSegmentDescriptorsLinear Address Space(or Physical Memory)CSAccessLimitBase AddressStackSSAccessLimitBase AddressDSAccessLimitBase AddressESAccessLimitBase AddressFSAccessLimitBase AddressGSAccessLimitBase AddressAccessLimitBase AddressCodeDataDataDataAccessLimitBase AddressAccessLimitBase AddressDataAccessLimitBase AddressFigure 3-4. Multi-Segment ModelAccess checks can be used to protect not only against referencing an address outsidethe limit of a segment, but also against performing disallowed operations in certainsegments.

For example, since code segments are designated as read-only segments,hardware can be used to prevent writes into code segments. The access rights information created for segments can also be used to set up protection rings or levels.Protection levels can be used to protect operating-system procedures from unauthorized access by application programs.3.2.4Segmentation in IA-32e ModeIn IA-32e mode of Intel 64 architecture, the effects of segmentation depend onwhether the processor is running in compatibility mode or 64-bit mode.

In compatibility mode, segmentation functions just as it does using legacy 16-bit or 32-bitprotected mode semantics.3-6 Vol. 3PROTECTED-MODE MEMORY MANAGEMENTIn 64-bit mode, segmentation is generally (but not completely) disabled, creating aflat 64-bit linear-address space.

The processor treats the segment base of CS, DS,ES, SS as zero, creating a linear address that is equal to the effective address. The FSand GS segments are exceptions. These segment registers (which hold the segmentbase) can be used as an additional base registers in linear address calculations. Theyfacilitate addressing local data and certain operating system data structures.Note that the processor does not perform segment limit checks at runtime in 64-bitmode.3.2.5Paging and SegmentationPaging can be used with any of the segmentation models described in Figures 3-2,3-3, and 3-4.

The processor’s paging mechanism divides the linear address space(into which segments are mapped) into pages (as shown in Figure 3-1). These linearaddress-space pages are then mapped to pages in the physical address space. Thepaging mechanism offers several page-level protection facilities that can be usedwith or instead of the segment-protection facilities. For example, it lets read-writeprotection be enforced on a page-by-page basis. The paging mechanism alsoprovides two-level user-supervisor protection that can also be specified on a pageby-page basis.3.3PHYSICAL ADDRESS SPACEIn protected mode, the IA-32 architecture provides a normal physical address spaceof 4 GBytes (232 bytes).

Характеристики

Тип файла
PDF-файл
Размер
3,12 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6418
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее