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

Volume 2 System Programming (794096), страница 94

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

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

When considering interactions of VMRUN with the TF andRF bits in EFLAGS, one must distinguish between the behavior of host as opposed to that of the guest.From the host point of view, VMRUN acts like a single instruction, even though an arbitrary number ofguest instructions may execute before a #VMEXIT effectively completes the VMRUN. As a singlehost instruction, VMRUN interacts with EFLAGS.RF and EFLAGS.TF like ordinary instructions.EFLAGS.RF suppresses any potential instruction breakpoint match on the VMRUN, and EFLAGS.TFcauses a #DB trap after the VMRUN completes on the host side (i.e., after the #VMEXIT from theguest). As with any normal instruction, completion of the VMRUN instruction clears the hostEFLAGS.RF bit.The value of EFLAGS.RF from the VMCB affects the first guest instruction.

When VMRUN loads aguest value of 1 for EFLAGS.RF, that value takes effect and suppresses any potential (guest)Secure Virtual Machine371AMD64 Technology24593—Rev. 3.13—July 2007instruction breakpoint on the first guest instruction. When VMRUN loads a guest value of 1 inEFLAGS.TF, that value does not cause a trace trap between the VMRUN and the first guestinstruction, but rather after completion of the first guest instruction.Host values of EFLAGS have no effect on the guest and guest values of EFLAGS have no effect on thehost.See also Section 15.7.1 on page 373 regarding the value of EFLAGS.RF saved on #VMEXIT.15.6#VMEXITWhen an intercept triggers, the processor performs a #VMEXIT (i.e., an exit from the guest to the hostcontext).On #VMEXIT, the processor:•••••••••••••Disables interrupts by clearing the GIF, so that after the #VMEXIT, VMM software can completethe state switch atomically.Writes back to the VMCB the current guest state—the same subset of processor state as is loadedby the VMRUN instruction, including the V_IRQ, V_TPR, and the INTERRUPT_SHADOW bits.Saves the reason for exiting the guest in the VMCB’s EXITCODE field; additional informationmay be saved in the EXITINFO1 or EXITINFO2 fields, depending on the intercept.Clears all intercepts.Resets the current ASID register to zero (host ASID).Clears the V_IRQ and V_INTR_MASKING bits inside the processor.Clears the TSC_OFFSET inside the processor.Reloads the host state previously saved by the VMRUN instruction.

The processor reloads thehost’s CS, SS, DS, and ES segment registers and, if required, re-reads the descriptors from thehost’s segment descriptor tables, depending on the implementation. The segment descriptor tablesmust be mapped as present and writable by the host's page tables. Software should keep the host’ssegment descriptor tables consistent with the segment registers when executing VMRUNinstructions. Immediately after #VMEXIT, the processor still contains the guest value for LDTR.So for CS, SS, DS, and ES, the VMM must only use segment descriptors from the global descriptortable. Any exception encountered while reloading the host segments causes a shutdown.If the host is in PAE mode, the processor reloads the host's PDPEs from the page table indicated bythe host's CR3.

If the PDPEs contain illegal state, the processor causes a shutdown.Forces CR0.PE = 1, RFLAGS.VM = 0.Sets the host CPL to zero.Disables all breakpoints in the host DR7 register.Checks the reloaded host state for consistency; any error causes the processor to shutdown. If thehost’s rIP reloaded by #VMEXIT is outside the limit of the host’s code segment or non-canonical(in the case of long mode), a #GP fault is delivered inside the host.372Secure Virtual Machine24593—Rev.

3.13—July 200715.7AMD64 TechnologyIntercept OperationVarious instructions and events (such as exceptions) in the guest can be intercepted by means ofcontrol bits in the VMCB. The two primary classes of intercepts supported by SVM are instruction andexception intercepts.Exception intercepts. Exception intercepts are checked when normal instruction processing mustraise an exception—before resolving possible double-fault conditions according to table 8-3 andbefore attempting delivery of the exception (which includes pushing an exception frame, accessing theIDT, etc.).For some exceptions, the processor still writes certain exception-specific registers even if theexception is intercepted.

(See the descriptions in Section 15.11 on page 381 and following for details.)When an external or virtual interrupt is intercepted, the interrupt is left pending.When an intercept occurs while the guest is in the process of delivering a non-intercepted interrupt orexception using the IDT, SVM provides additional information on #VMEXIT (See Section 15.7.2 onpage 374).Instruction intercepts. These occur at well-defined points in instruction execution—before theresults of the instruction are committed, but ordered in an intercept-specific priority relative to theinstruction’s exception checks. Generally, instruction intercepts are checked after simple exceptions(such as #GP when CPL is incorrect, or #UD) have been checked, but before exceptions related tomemory accesses (such as page faults) and exceptions based on specific operand values.

There areseveral exceptions to this guideline, e.g., the RSM instruction. Instruction breakpoints for the currentinstruction and pending data breakpoint traps from the previous instruction are designed to be checkedbefore instruction intercepts.15.7.1 State Saved on ExitWhen triggered, intercepts write an EXITCODE into the VMCB identifying the cause of the intercept.The EXITINTINFO field signals whether the intercept occurred while the guest was attempting todeliver an interrupt or exception through the IDT; a VMM can use this information to transparentlycomplete the delivery (see “Event Injection” on page 389).

Some intercepts provide additionalinformation in the EXITINFO1 and EXITINFO2 fields in the VMCB; see the individual interceptdescriptions for details.The guest state saved in the VMCB is the processor state as of the moment the intercept triggers. In thex86 architecture, traps (as opposed to faults) are detected and delivered after the instruction thattriggered them has completed execution.

Accordingly, a trap intercept takes place after the executionof the instruction that triggered the trap in the first place. The saved guest state thus includes the effectsof executing that instruction.Example: Assume a guest instruction triggers a data breakpoint (#DB) trap which is in turnintercepted. The VMCB records the guest state after execution of that instruction, so that the savedSecure Virtual Machine373AMD64 Technology24593—Rev. 3.13—July 2007CS:rIP points to the following instruction, and the saved DR7 includes the effects of matching the databreakpoint.Some exceptions write special registers even when they are intercepted; see the individual descriptionsin “Exception Intercepts” on page 381 for details.15.7.2 Intercepts During IDT Interrupt DeliveryIt is possible for an intercept to occur while the guest is attempting to deliver an exception or interruptthrough the IDT (e.g., #PF because the VMM has paged out the guest’s exception stack).

In somecases, such an intercept can result in the loss of information necessary for transparent resumption ofthe guest. In the case of an external interrupt, for example, the processor will already have performedan interrupt acknowledge cycle with the PIC or APIC to obtain the interrupt type and vector, and theinterrupt is thus no longer pending.To recover from such situations, all intercepts indicate (in the EXITINTINFO field in the VMCB)whether they occurred during exception or interrupt delivery though the IDT. This mechanism allowsthe VMM to complete the intercepted interrupt delivery, even when it is no longer possible to recreatethe event in question.6332 31ERRORCODEBits63–323130–121110–8MnemonicERRORCODEVReserved, 0EVTYPE7–0VECTOR30V12Reserved, 01110EVTYPE870VECTORDescriptionError CodeValidError Code ValidQualifies the guest exception or interrupt. Table 15-1shows possible values returned and their correspondinginterrupt or exception types.

Values not indicated areunused and reserved.8-bit IDT vector of the interrupt or exception.Figure 15-1.EXITINTINFO for All InterceptsTable 15-1. Guest Exception or Interrupt TypesValueType0External or virtual interrupt (INTR)2NMI3Exception (fault or trap)4Software interrupt (caused by INTn instruction)374Secure Virtual Machine24593—Rev.

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

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

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

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