Skip to content

Commit c8d062d

Browse files
committed
-1 after max
1 parent ee27c96 commit c8d062d

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
@@ -322,7 +322,6 @@ impl Descriptor {
322322
iomap_size: u16,
323323
) -> Descriptor {
324324
use self::DescriptorFlags as Flags;
325-
use core::mem::size_of;
326325

327326
let ptr = tss as *const _ as u64;
328327

@@ -331,10 +330,10 @@ impl Descriptor {
331330
low.set_bits(16..40, ptr.get_bits(0..24));
332331
low.set_bits(56..64, ptr.get_bits(24..32));
333332
// limit (the `-1` is needed since the bound is inclusive)
334-
let iomap_limit = tss.iomap_base as u64 + iomap_size as u64 - 1;
333+
let iomap_limit = tss.iomap_base as u64 + iomap_size as u64;
335334
low.set_bits(
336335
0..16,
337-
cmp::max(mem::size_of::<TaskStateSegment>() as u64, iomap_limit),
336+
cmp::max(mem::size_of::<TaskStateSegment>() as u64, iomap_limit) - 1,
338337
);
339338
// type (0b1001 = available 64-bit tss)
340339
low.set_bits(40..44, 0b1001);

0 commit comments

Comments
 (0)