File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -131,9 +131,14 @@ pub struct CS;
131
131
impl Segment for CS {
132
132
get_reg_impl ! ( "cs" , x86_64_asm_get_cs) ;
133
133
134
- /// Note this is special since we cannot directly move to [`CS`]. Instead we
135
- /// push the new segment selector and return value on the stack and use
136
- /// `retfq` to reload [`CS`] and continue at the end of our function.
134
+ /// Note this is special since we cannot directly move to [`CS`]; x86 requires the instruction
135
+ /// pointer and [`CS`] to be set at the same time. To do this, we push the new segment selector
136
+ /// and return value onto the stack and use a "far return" (`retfq`) to reload [`CS`] and
137
+ /// continue at the end of our function.
138
+ ///
139
+ /// Note we cannot use a "far call" (`lcall`) or "far jmp" (`ljmp`) to do this because then we
140
+ /// would only be able to jump to 32-bit instruction pointers. Only Intel implements support
141
+ /// for 64-bit far calls/jumps in long-mode, AMD does not.
137
142
unsafe fn set_reg ( sel : SegmentSelector ) {
138
143
#[ cfg( feature = "inline_asm" ) ]
139
144
asm ! (
You can’t perform that action at this time.
0 commit comments