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

Volume 3B System Programming Guide_ Part 2 (794104), страница 61

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

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

Examples include general purpose registers,the CR2 control register, debug registers, floating point registers and so forth.VMM may support lazy loading of FPU, MMX, SSE, and SSE2 states withCR0.TS = 1 (described in Intel® 64 and IA-32 Architectures SoftwareDeveloper’s Manual, Volume 3A).•Execute VMLAUNCH to launch the guest VM.

If VMLAUNCH fails due to anyconsistency checks before guest-state loading, RFLAGS.CF or RFLAGS.ZF will beset and the VM-instruction error field (see Section 20.9.5) will contain the errorcode. If guest-state consistency checks fail upon guest-state loading, theprocessor loads state from the host-state area as if a VM exit had occurred (seeSection 25.6).VMLAUNCH updates the controlling-VMCS pointer with the working-VMCS pointerand saves the old value of controlling-VMCS as the parent pointer. In addition, thelaunch state of the guest VMCS is changed to “launched” from “clear”.

Anyprogrammed exit conditions will cause the guest to VM exit to the VMM. The VMMshould execute VMRESUME instruction for subsequent VM entries to guests in a“launched” state.Vol. 3 25-7VIRTUAL-MACHINE MONITOR PROGRAMMING CONSIDERATIONS25.7HANDLING OF VM EXITSThis section provides examples of software steps involved in a VMM’s handling of VMexit conditions:•Determine the exit reason through a VMREAD of the exit-reason field in theworking-VMCS. Appendix I describes exit reasons and their encodings.•VMREAD the exit-qualification from the VMCS if the exit-reason field provides avalid qualification. The exit-qualification field provides additional details on theVM-exit condition. For example, in case of page faults, the exit-qualification fieldprovides the guest linear address that caused the page fault.•Depending on the exit reason, fetch other relevant fields from the VMCS.Appendix I lists the various exit reasons.•Handle the VM-exit condition appropriately in the VMM.

This may involve theVMM emulating one or more guest instructions, programming the underlyinghost hardware resources, and then re-entering the VM to continue execution.25.7.1Handling VM Exits Due to ExceptionsAs noted in Section 21.3, an exception causes a VM exit if the bit corresponding tothe exception’s vector is set in the exception bitmap.

(For page faults, the error codealso determines whether a VM exit occurs.) This section provide some guidelines ofhow a VMM might handle such exceptions.Exceptions result when a logical processor encounters an unusual condition that software may not have expected. When guest software encounters an exception, it maybe the case that the condition was caused by the guest software. For example, aguest application may attempt to access a page that is restricted to supervisoraccess. Alternatively, the condition causing the exception may have been establishedby the VMM.

For example, a guest OS may attempt to access a page that the VMMhas chosen to make not present.When the condition causing an exception was established by guest software, theVMM may choose to reflect the exception to guest software. When the condition wasestablished by the VMM itself, the VMM may choose to resume guest software afterremoving the condition.25.7.1.1Reflecting Exceptions to Guest SoftwareIf the VMM determines that a VM exit was caused by an exception due to a conditionestablished by guest software, it may reflect that exception to guest software. TheVMM would cause the exception to be delivered to guest software, where it can behandled as it would be if the guest were running on a physical machine. This sectiondescribes how that may be done.In general, the VMM can deliver the exception to guest software using VM-entryevent injection as described in Section 22.5.

The VMM can copy (using VMREAD and25-8 Vol. 3VIRTUAL-MACHINE MONITOR PROGRAMMING CONSIDERATIONSVMWRITE) the contents of the VM-exit interruption-information field (which is valid,since the VM exit was caused by an exception) to the VM-entry interruption-information field (which, if valid, will cause the exception to be delivered as part of the nextVM entry). The VMM would also copy the contents of the VM-exit interruption errorcode field to the VM-entry exception error-code field; this need not be done if bit 11(error code valid) is clear in the VM-exit interruption-information field. After this, theVMM can execute VMRESUME.The following items provide details that may qualify the general approach:•Care should be taken to ensure that reserved bits 30:12 in the VM-entry interruption-information field are 0. In particular, some VM exits may set bit 12 in theVM-exit interruption-information field to indicate NMI unblocking due to IRET.

Ifthis bit is copied as 1 into the VM-entry interruption-information field, the nextVM entry will fail because that bit should be 0.•Bit 31 (valid) of the IDT-vectoring information field indicates, if set, that theexception causing the VM exit occurred while another event was being deliveredto guest software. If this is the case, it may not be appropriate simply to reflectthat exception to guest software. To provide proper virtualization of the exceptionarchitecture, a VMM should handle nested events as a physical processor would.Processor handling is described in Chapter 5, “Interrupt 8—Double FaultException (#DF)” in Intel® 64 and IA-32 Architectures Software Developer’sManual, Volume 3A.— The VMM should reflect the exception causing the VM exit to guest softwarein any of the following cases:•The value of bits 10:8 (interruption type) of the IDT-vectoringinformation field is anything other than 3 (hardware exception).•The value of bits 7:0 (vector) of the IDT-vectoring information fieldindicates a benign exception (1, 2, 3, 4, 5, 6, 7, 9, 16, 17, 18, or 19).•The value of bits 7:0 (vector) of the VM-exit interruption-information fieldindicates a benign exception.•The value of bits 7:0 of the IDT-vectoring information field indicates acontributory exception (0, 10, 11, 12, or 13) and the value of bits 7:0 ofthe VM-exit interruption-information field indicates a page fault (14).— If the value of bits 10:8 of the IDT-vectoring information field is 3 (hardwareexception), the VMM should reflect a double-fault exception to guest softwarein any of the following cases:•The value of bits 7:0 of the IDT-vectoring information field and the valueof bits 7:0 of the VM-exit interruption-information field each indicates acontributory exception.•The value of bits 7:0 of the IDT-vectoring information field indicates apage fault and the value of bits 7:0 of the VM-exit interruptioninformation field indicates either a contributory exception or a page fault.Vol.

3 25-9VIRTUAL-MACHINE MONITOR PROGRAMMING CONSIDERATIONSA VMM can reflect a double-fault exception to guest software by setting theVM-entry interruption-information and VM-entry exception error-code fieldsas follows:•Set bits 7:0 (vector) of the VM-entry interruption-information field to 8(#DF).•Set bits 10:8 (interruption type) of the VM-entry interruption-informationfield to 3 (hardware exception).•Set bit 11 (deliver error code) of the VM-entry interruption-informationfield to 1.•••Clear bits 30:12 (reserved) of VM-entry interruption-information field.Set bit 31 (valid) of VM-entry interruption-information field.Set the VM-entry exception error-code field to zero.— If the value of bits 10:8 of the IDT-vectoring information field is 3 (hardwareexception) and the value of bits 7:0 is 8 (#DF), guest software would haveencountered a triple fault.

Event injection should not be used in this case. TheVMM may choose to terminate the guest, or it might choose to enter theguest in the shutdown activity state.25.7.1.2Resuming Guest Software after Handling an ExceptionIf the VMM determines that a VM exit was caused by an exception due to a conditionestablished by the VMM itself, it may choose to resume guest software afterremoving the condition. The approach for removing the condition may be specific tothe VMM’s software architecture. and algorithms This section describes how guestsoftware may be resumed after removing the condition.In general, the VMM can resume guest software simply by executing VMRESUME. Thefollowing items provide details of cases that may require special handling:•If the “NMI exiting” VM-execution control is 0, bit 12 of the VM-exit interruptioninformation field indicates that the VM exit was due to a fault encountered duringan execution of the IRET instruction that unblocked non-maskable interrupts(NMIs).

In particular, it provides this indication if the following are both true:— Bit 31 (valid) in the IDT-vectoring information field is 0.— The value of bits 7:0 (vector) of the VM-exit interruption-information field isnot 8 (the VM exit is not due to a double-fault exception).If both are true and bit 12 of the VM-exit interruption-information field is 1, NMIswere blocked before guest software executed the IRET instruction that causedthe fault that caused the VM exit. The VMM should set bit 3 (blocking by NMI) inthe interruptibility-state field (using VMREAD and VMWRITE) before resumingguest software.•If the “virtual NMIs” VM-execution control is 1, bit 12 of the VM-exit interruptioninformation field indicates that the VM exit was due to a fault encountered during25-10 Vol.

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

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

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

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