Skip to content

Commit 2fef3bd

Browse files
RestiosonFreax13
authored andcommitted
-1 after max
1 parent 5a0ffc2 commit 2fef3bd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/structures/gdt.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ impl Descriptor {
457457
iomap_size: u16,
458458
) -> Descriptor {
459459
use self::DescriptorFlags as Flags;
460-
use core::mem::size_of;
461460

462461
let ptr = tss as *const _ as u64;
463462

@@ -466,10 +465,10 @@ impl Descriptor {
466465
low.set_bits(16..40, ptr.get_bits(0..24));
467466
low.set_bits(56..64, ptr.get_bits(24..32));
468467
// limit (the `-1` is needed since the bound is inclusive)
469-
let iomap_limit = tss.iomap_base as u64 + iomap_size as u64 - 1;
468+
let iomap_limit = tss.iomap_base as u64 + iomap_size as u64;
470469
low.set_bits(
471470
0..16,
472-
cmp::max(mem::size_of::<TaskStateSegment>() as u64, iomap_limit),
471+
cmp::max(mem::size_of::<TaskStateSegment>() as u64, iomap_limit) - 1,
473472
);
474473
// type (0b1001 = available 64-bit tss)
475474
low.set_bits(40..44, 0b1001);

0 commit comments

Comments
 (0)