Skip to content

Commit 9c4a2c9

Browse files
committed
Update SS docs to indicate why it is still sometimes set
Signed-off-by: Joe Richey <[email protected]>
1 parent 22aeec3 commit 9c4a2c9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/instructions/segmentation.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,25 @@ impl Segment for CS {
151151

152152
/// Stack Segment
153153
///
154-
/// Entirely unused in 64-bit mode, setting the segment register does nothing.
154+
/// Entirely unused in 64-bit mode; setting the segment register does nothing.
155+
/// However, this register is often set by the `syscall`/`sysret` and
156+
/// `sysenter`/`sysexit` instructions (even on 64-bit transitions). This is to
157+
/// maintain symmetry with 32-bit transitions where setting SS actually will
158+
/// actually have an effect.
155159
#[derive(Debug)]
156160
pub struct SS;
157161
segment_impl!(SS, "ss", x86_64_asm_get_ss, x86_64_asm_load_ss);
158162

159163
/// Data Segment
160164
///
161-
/// Entirely unused in 64-bit mode, setting the segment register does nothing.
165+
/// Entirely unused in 64-bit mode; setting the segment register does nothing.
162166
#[derive(Debug)]
163167
pub struct DS;
164168
segment_impl!(DS, "ds", x86_64_asm_get_ds, x86_64_asm_load_ds);
165169

166170
/// ES Segment
167171
///
168-
/// Entirely unused in 64-bit mode, setting the segment register does nothing.
172+
/// Entirely unused in 64-bit mode; setting the segment register does nothing.
169173
#[derive(Debug)]
170174
pub struct ES;
171175
segment_impl!(ES, "es", x86_64_asm_get_es, x86_64_asm_load_es);

0 commit comments

Comments
 (0)