Skip to content

Commit c47d482

Browse files
committed
Add CS::set_reg doc comment explaining its weirdness
Signed-off-by: Joe Richey <[email protected]>
1 parent 9c4a2c9 commit c47d482

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/instructions/segmentation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ pub struct CS;
128128
impl Segment for CS {
129129
get_reg_impl!("cs", x86_64_asm_get_cs);
130130

131+
/// Note this is special since we cannot directly move to [`CS`]. Instead we
132+
/// push the new segment selector and return value on the stack and use
133+
/// `retfq` to reload [`CS`] and continue at the end of our function.
131134
unsafe fn set_reg(sel: SegmentSelector) {
132-
// Note this is special since we cannot directly move to cs. Instead we
133-
// push the new segment selector and return value on the stack and use
134-
// retfq to reload cs and continue at 1:.
135135
#[cfg(feature = "inline_asm")]
136136
asm!(
137137
"push {sel}",

0 commit comments

Comments
 (0)