€•¬;Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ(/translations/zh_CN/arch/x86/x86_64/fred”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/zh_TW/arch/x86/x86_64/fred”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/it_IT/arch/x86/x86_64/fred”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ja_JP/arch/x86/x86_64/fred”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ko_KR/arch/x86/x86_64/fred”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/pt_BR/arch/x86/x86_64/fred”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/sp_SP/arch/x86/x86_64/fred”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒB/var/lib/git/docbuild/linux/Documentation/arch/x86/x86_64/fred.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ)Flexible Return and Event Delivery (FRED)”h]”hŒ)Flexible Return and Event Delivery (FRED)”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒOverview”h]”hŒOverview”…””}”(hhàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÝh²hh³hÇh´KubhŒ paragraph”“”)”}”(hŒ¡The FRED architecture defines simple new transitions that change privilege level (ring transitions). The FRED architecture was designed with the following goals:”h]”hŒ¡The FRED architecture defines simple new transitions that change privilege level (ring transitions). The FRED architecture was designed with the following goals:”…””}”(hhðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K hhÝh²hubhŒenumerated_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒÏImprove overall performance and response time by replacing event delivery through the interrupt descriptor table (IDT event delivery) and event return by the IRET instruction with lower latency transitions. ”h]”hï)”}”(hŒÎImprove overall performance and response time by replacing event delivery through the interrupt descriptor table (IDT event delivery) and event return by the IRET instruction with lower latency transitions.”h]”hŒÎImprove overall performance and response time by replacing event delivery through the interrupt descriptor table (IDT event delivery) and event return by the IRET instruction with lower latency transitions.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)”}”(hŒImprove software robustness by ensuring that event delivery establishes the full supervisor context and that event return establishes the full user context. ”h]”hï)”}”(hŒœImprove software robustness by ensuring that event delivery establishes the full supervisor context and that event return establishes the full user context.”h]”hŒœImprove software robustness by ensuring that event delivery establishes the full supervisor context and that event return establishes the full user context.”…””}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ)”uh1hþhhÝh²hh³hÇh´Kubhï)”}”(hXàThe new transitions defined by the FRED architecture are FRED event delivery and, for returning from events, two FRED return instructions. FRED event delivery can effect a transition from ring 3 to ring 0, but it is used also to deliver events incident to ring 0. One FRED instruction (ERETU) effects a return from ring 0 to ring 3, while the other (ERETS) returns while remaining in ring 0. Collectively, FRED event delivery and the FRED return instructions are FRED transitions.”h]”hXàThe new transitions defined by the FRED architecture are FRED event delivery and, for returning from events, two FRED return instructions. FRED event delivery can effect a transition from ring 3 to ring 0, but it is used also to deliver events incident to ring 0. One FRED instruction (ERETU) effects a return from ring 0 to ring 3, while the other (ERETS) returns while remaining in ring 0. Collectively, FRED event delivery and the FRED return instructions are FRED transitions.”…””}”(hj@h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhhÝh²hubhï)”}”(hŒòIn addition to these transitions, the FRED architecture defines a new instruction (LKGS) for managing the state of the GS segment register. The LKGS instruction can be used by 64-bit operating systems that do not use the new FRED transitions.”h]”hŒòIn addition to these transitions, the FRED architecture defines a new instruction (LKGS) for managing the state of the GS segment register. The LKGS instruction can be used by 64-bit operating systems that do not use the new FRED transitions.”…””}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhhÝh²hubhï)”}”(hŒRFurthermore, the FRED architecture is easy to extend for future CPU architectures.”h]”hŒRFurthermore, the FRED architecture is easy to extend for future CPU architectures.”…””}”(hj\h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K$hhÝh²hubeh}”(h]”Œoverview”ah ]”h"]”Œoverview”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒ Software based event dispatching”h]”hŒ Software based event dispatching”…””}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjrh²hh³hÇh´K(ubhï)”}”(hXÙFRED operates differently from IDT in terms of event handling. Instead of directly dispatching an event to its handler based on the event vector, FRED requires the software to dispatch an event to its handler based on both the event's type and vector. Therefore, an event dispatch framework must be implemented to facilitate the event-to-handler dispatch process. The FRED event dispatch framework takes control once an event is delivered, and employs a two-level dispatch.”h]”hXÛFRED operates differently from IDT in terms of event handling. Instead of directly dispatching an event to its handler based on the event vector, FRED requires the software to dispatch an event to its handler based on both the event’s type and vector. Therefore, an event dispatch framework must be implemented to facilitate the event-to-handler dispatch process. The FRED event dispatch framework takes control once an event is delivered, and employs a two-level dispatch.”…””}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K*hjrh²hubhï)”}”(hŒhThe first level dispatching is event type based, and the second level dispatching is event vector based.”h]”hŒhThe first level dispatching is event type based, and the second level dispatching is event vector based.”…””}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K2hjrh²hubeh}”(h]”Œ software-based-event-dispatching”ah ]”h"]”Œ software based event dispatching”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K(ubhÉ)”}”(hhh]”(hÎ)”}”(hŒFull supervisor/user context”h]”hŒFull supervisor/user context”…””}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj§h²hh³hÇh´K6ubhï)”}”(hXFRED event delivery atomically save and restore full supervisor/user context upon event delivery and return. Thus it avoids the problem of transient states due to %cr2 and/or %dr6, and it is no longer needed to handle all the ugly corner cases caused by half baked entry states.”h]”hXFRED event delivery atomically save and restore full supervisor/user context upon event delivery and return. Thus it avoids the problem of transient states due to %cr2 and/or %dr6, and it is no longer needed to handle all the ugly corner cases caused by half baked entry states.”…””}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K8hj§h²hubhï)”}”(hŒÍFRED allows explicit unblock of NMI with new event return instructions ERETS/ERETU, avoiding the mess caused by IRET which unconditionally unblocks NMI, e.g., when an exception happens during NMI handling.”h]”hŒÍFRED allows explicit unblock of NMI with new event return instructions ERETS/ERETU, avoiding the mess caused by IRET which unconditionally unblocks NMI, e.g., when an exception happens during NMI handling.”…””}”(hjÆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K=hj§h²hubhï)”}”(hŒbFRED always restores the full value of %rsp, thus ESPFIX is no longer needed when FRED is enabled.”h]”hŒbFRED always restores the full value of %rsp, thus ESPFIX is no longer needed when FRED is enabled.”…””}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KAhj§h²hubeh}”(h]”Œfull-supervisor-user-context”ah ]”h"]”Œfull supervisor/user context”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K6ubhÉ)”}”(hhh]”(hÎ)”}”(hŒLKGS”h]”hŒLKGS”…””}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjêh²hh³hÇh´KEubhï)”}”(hX)LKGS behaves like the MOV to GS instruction except that it loads the base address into the IA32_KERNEL_GS_BASE MSR instead of the GS segment’s descriptor cache. With LKGS, it ends up with avoiding mucking with kernel GS, i.e., an operating system can always operate with its own GS base address.”h]”hX)LKGS behaves like the MOV to GS instruction except that it loads the base address into the IA32_KERNEL_GS_BASE MSR instead of the GS segment’s descriptor cache. With LKGS, it ends up with avoiding mucking with kernel GS, i.e., an operating system can always operate with its own GS base address.”…””}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KGhjêh²hubhï)”}”(hX Because FRED event delivery from ring 3 and ERETU both swap the value of the GS base address and that of the IA32_KERNEL_GS_BASE MSR, plus the introduction of LKGS instruction, the SWAPGS instruction is no longer needed when FRED is enabled, thus is disallowed (#UD).”h]”hX Because FRED event delivery from ring 3 and ERETU both swap the value of the GS base address and that of the IA32_KERNEL_GS_BASE MSR, plus the introduction of LKGS instruction, the SWAPGS instruction is no longer needed when FRED is enabled, thus is disallowed (#UD).”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KMhjêh²hubeh}”(h]”Œlkgs”ah ]”h"]”Œlkgs”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KEubhÉ)”}”(hhh]”(hÎ)”}”(hŒ Stack levels”h]”hŒ Stack levels”…””}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´KSubhï)”}”(hŒ™4 stack levels 0~3 are introduced to replace the nonreentrant IST for event handling, and each stack level should be configured to use a dedicated stack.”h]”hŒ™4 stack levels 0~3 are introduced to replace the nonreentrant IST for event handling, and each stack level should be configured to use a dedicated stack.”…””}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KUhjh²hubhï)”}”(hXThe current stack level could be unchanged or go higher upon FRED event delivery. If unchanged, the CPU keeps using the current event stack. If higher, the CPU switches to a new event stack specified by the MSR of the new stack level, i.e., MSR_IA32_FRED_RSP[123].”h]”hXThe current stack level could be unchanged or go higher upon FRED event delivery. If unchanged, the CPU keeps using the current event stack. If higher, the CPU switches to a new event stack specified by the MSR of the new stack level, i.e., MSR_IA32_FRED_RSP[123].”…””}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KYhjh²hubhï)”}”(hŒÐOnly execution of a FRED return instruction ERET[US], could lower the current stack level, causing the CPU to switch back to the stack it was on before a previous event delivery that promoted the stack level.”h]”hŒÐOnly execution of a FRED return instruction ERET[US], could lower the current stack level, causing the CPU to switch back to the stack it was on before a previous event delivery that promoted the stack level.”…””}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K^hjh²hubeh}”(h]”Œ stack-levels”ah ]”h"]”Œ stack levels”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KSubeh}”(h]”Œ'flexible-return-and-event-delivery-fred”ah ]”h"]”Œ)flexible return and event delivery (fred)”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jgjdjojlj¤j¡jçjäjjj_j\uŒ nametypes”}”(jg‰jo‰j¤‰jç‰j‰j_‰uh}”(jdhÊjlhÝj¡jrjäj§jjêj\juŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.