€•Ã:Œ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Œ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.”…””}”(hhõhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhŸh³h Khhñubah}”(h]”h ]”h"]”h$]”h&]”uh1hïhhìhžhhŸh³h Nubhð)”}”(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 Khj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hïhhìhž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.”…””}”(hj:hž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.”…””}”(hjHhž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”…””}”(hjahžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj^hž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.”…””}”(hjohžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhŸh³h K*hj^hž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 K2hj^hž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”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj hž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.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhŸh³h KUhj hž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 KYhj hž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.”…””}”(hj8hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhŸh³h K^hj hž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”jyŒ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”}”(jSjPj[jXjjjÓjÐjjjKjHuŒ nametypes”}”(jS‰j[‰j‰jÓ‰j‰jK‰uh}”(jPh¶jXhÉjj^jÐj“jjÖjHj uŒ 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.