Главная » Просмотр файлов » Volume 2A Instruction Set Reference A-M

Volume 2A Instruction Set Reference A-M (794101), страница 33

Файл №794101 Volume 2A Instruction Set Reference A-M (Intel and AMD manuals) 33 страницаVolume 2A Instruction Set Reference A-M (794101) страница 332019-04-28СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

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

(The offset from the target operand is ignored when acall gate is used.)On inter-privilege-level calls, the processor switches to the stack for the privilegelevel of the called procedure. The segment selector for the new stack segment isspecified in the TSS for the currently running task. The branch to the new codesegment occurs after the stack switch. (Note that when using a call gate to performa far call to a segment at the same privilege level, no stack switch occurs.) On thenew stack, the processor pushes the segment selector and stack pointer for thecalling procedure’s stack, an optional set of parameters from the calling proceduresstack, and the segment selector and instruction pointer for the calling procedure’scode segment.

(A value in the call gate descriptor determines how many parametersto copy to the new stack.) Finally, the processor branches to the address of theprocedure being called within the new code segment.Executing a task switch with the CALL instruction is similar to executing a callthrough a call gate. The target operand specifies the segment selector of the taskgate for the new task activated by the switch (the offset in the target operand isignored). The task gate in turn points to the TSS for the new task, which contains thesegment selectors for the task’s code and stack segments. Note that the TSS alsocontains the EIP value for the next instruction that was to be executed before thecalling task was suspended. This instruction pointer value is loaded into the EIPregister to re-start the calling task.The CALL instruction can also specify the segment selector of the TSS directly, whicheliminates the indirection of the task gate.

See Chapter 7, “Task Management,” in theCALL—Call ProcedureVol. 2A 3-123INSTRUCTION SET REFERENCE, A-MIntel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 3A, forinformation on the mechanics of a task switch.When you execute at task switch with a CALL instruction, the nested task flag (NT) isset in the EFLAGS register and the new TSS’s previous task link field is loaded withthe old task’s TSS selector. Code is expected to suspend this nested task by executingan IRET instruction which, because the NT flag is set, automatically uses the previoustask link to return to the calling task.

(See “Task Linking” in Chapter 7 of the Intel®64 and IA-32 Architectures Software Developer’s Manual, Volume 3A, for informationon nested tasks.) Switching tasks with the CALL instruction differs in this regard fromJMP instruction. JMP does not set the NT flag and therefore does not expect an IRETinstruction to suspend the task.Mixing 16-Bit and 32-Bit Calls. When making far calls between 16-bit and 32-bit codesegments, use a call gate.

If the far call is from a 32-bit code segment to a 16-bitcode segment, the call should be made from the first 64 KBytes of the 32-bit codesegment. This is because the operand-size attribute of the instruction is set to 16, soonly a 16-bit return address offset can be saved. Also, the call should be made usinga 16-bit call gate so that 16-bit values can be pushed on the stack. See Chapter 18,“Mixing 16-Bit and 32-Bit Code,” in the Intel® 64 and IA-32 Architectures SoftwareDeveloper’s Manual, Volume 3A, for more information.Far Calls in Compatibility Mode.

When the processor is operating in compatibilitymode, the CALL instruction can be used to perform the following types of far calls:•••Far call to the same privilege level, remaining in compatibility modeFar call to the same privilege level, transitioning to 64-bit modeFar call to a different privilege level (inter-privilege level call), transitioning to 64bit modeNote that a CALL instruction can not be used to cause a task switch in compatibilitymode since task switches are not supported in IA-32e mode.In compatibility mode, the processor always uses the segment selector part of the faraddress to access the corresponding descriptor in the GDT or LDT.

The descriptortype (code segment, call gate) and access rights determine the type of call operationto be performed.If the selected descriptor is for a code segment, a far call to a code segment at thesame privilege level is performed. (If the selected code segment is at a different privilege level and the code segment is non-conforming, a general-protection exceptionis generated.) A far call to the same privilege level in compatibility mode is verysimilar to one carried out in protected mode.

The target operand specifies an absolute far address either directly with a pointer (ptr16:16 or ptr16:32) or indirectly witha memory location (m16:16 or m16:32). The operand-size attribute determines thesize of the offset (16 or 32 bits) in the far address. The new code segment selectorand its descriptor are loaded into CS register and the offset from the instruction isloaded into the EIP register.

The difference is that 64-bit mode may be entered. Thisspecified by the L bit in the new code segment descriptor.3-124 Vol. 2ACALL—Call ProcedureINSTRUCTION SET REFERENCE, A-MNote that a 64-bit call gate (described in the next paragraph) can also be used toperform a far call to a code segment at the same privilege level.

However, using thismechanism requires that the target code segment descriptor have the L bit set,causing an entry to 64-bit mode.When executing an inter-privilege-level far call, the code segment for the procedurebeing called must be accessed through a 64-bit call gate. The segment selector specified by the target operand identifies the call gate.

The target operand can specify thecall gate segment selector either directly with a pointer (ptr16:16 or ptr16:32) orindirectly with a memory location (m16:16 or m16:32). The processor obtains thesegment selector for the new code segment and the new instruction pointer (offset)from the 16-byte call gate descriptor. (The offset from the target operand is ignoredwhen a call gate is used.)On inter-privilege-level calls, the processor switches to the stack for the privilegelevel of the called procedure. The segment selector for the new stack segment is setto NULL. The new stack pointer is specified in the TSS for the currently running task.The branch to the new code segment occurs after the stack switch. (Note that whenusing a call gate to perform a far call to a segment at the same privilege level, animplicit stack switch occurs as a result of entering 64-bit mode.

The SS selector isunchanged, but stack segment accesses use a segment base of 0x0, the limit isignored, and the default stack size is 64-bits. The full value of RSP is used for theoffset, of which the upper 32-bits are undefined.) On the new stack, the processorpushes the segment selector and stack pointer for the calling procedure’s stack andthe segment selector and instruction pointer for the calling procedure’s codesegment. (Parameter copy is not supported in IA-32e mode.) Finally, the processorbranches to the address of the procedure being called within the new code segment.Near/(Far) Calls in 64-bit Mode. When the processor is operating in 64-bit mode, theCALL instruction can be used to perform the following types of far calls:•••Far call to the same privilege level, transitioning to compatibility modeFar call to the same privilege level, remaining in 64-bit modeFar call to a different privilege level (inter-privilege level call), remaining in 64-bitmodeNote that in this mode the CALL instruction can not be used to cause a task switch in64-bit mode since task switches are not supported in IA-32e mode.In 64-bit mode, the processor always uses the segment selector part of the faraddress to access the corresponding descriptor in the GDT or LDT.

The descriptortype (code segment, call gate) and access rights determine the type of call operationto be performed.If the selected descriptor is for a code segment, a far call to a code segment at thesame privilege level is performed. (If the selected code segment is at a different privilege level and the code segment is non-conforming, a general-protection exceptionis generated.) A far call to the same privilege level in 64-bit mode is very similar toone carried out in compatibility mode. The target operand specifies an absolute faraddress indirectly with a memory location (m16:16, m16:32 or m16:64). The formof CALL with a direct specification of absolute far address is not defined in 64-bitCALL—Call ProcedureVol. 2A 3-125INSTRUCTION SET REFERENCE, A-Mmode.

The operand-size attribute determines the size of the offset (16, 32, or 64bits) in the far address. The new code segment selector and its descriptor are loadedinto the CS register; the offset from the instruction is loaded into the EIP register. Thenew code segment may specify entry either into compatibility or 64-bit mode, basedon the L bit value.A 64-bit call gate (described in the next paragraph) can also be used to perform a farcall to a code segment at the same privilege level.

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

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

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

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