@@ -1394,15 +1394,15 @@ macro_rules! set_general_handler_entry {
1394
1394
extern "x86-interrupt" fn handler( frame: $crate:: structures:: idt:: InterruptStackFrame ) {
1395
1395
$handler( frame, $idx. into( ) , None ) ;
1396
1396
}
1397
- $idt[ $idx as usize ] . set_handler_fn( handler) ;
1397
+ $idt[ $idx] . set_handler_fn( handler) ;
1398
1398
} } ;
1399
1399
}
1400
1400
1401
1401
#[ cfg( test) ]
1402
1402
mod test {
1403
1403
use super :: * ;
1404
1404
1405
- fn entry_present ( idt : & InterruptDescriptorTable , index : usize ) -> bool {
1405
+ fn entry_present ( idt : & InterruptDescriptorTable , index : u8 ) -> bool {
1406
1406
let options = match index {
1407
1407
8 => & idt. double_fault . options ,
1408
1408
10 => & idt. invalid_tss . options ,
@@ -1413,13 +1413,13 @@ mod test {
1413
1413
15 => & idt. reserved_1 . options ,
1414
1414
17 => & idt. alignment_check . options ,
1415
1415
18 => & idt. machine_check . options ,
1416
- i @ 21 ..=28 => & idt. reserved_2 [ i - 21 ] . options ,
1416
+ i @ 21 ..=28 => & idt. reserved_2 [ usize :: from ( i ) - 21 ] . options ,
1417
1417
29 => & idt. vmm_communication_exception . options ,
1418
1418
30 => & idt. security_exception . options ,
1419
1419
31 => & idt. reserved_3 . options ,
1420
1420
other => & idt[ other] . options ,
1421
1421
} ;
1422
- options. 0 . get_bit ( 15 )
1422
+ options. bits . get_bit ( 15 )
1423
1423
}
1424
1424
1425
1425
#[ test]
@@ -1446,31 +1446,31 @@ mod test {
1446
1446
1447
1447
let mut idt = InterruptDescriptorTable :: new ( ) ;
1448
1448
set_general_handler ! ( & mut idt, general_handler, 0 ) ;
1449
- for i in 0 ..256 {
1449
+ for i in 0 ..= 255 {
1450
1450
if i == 0 {
1451
1451
assert ! ( entry_present( & idt, i) ) ;
1452
1452
} else {
1453
1453
assert ! ( !entry_present( & idt, i) ) ;
1454
1454
}
1455
1455
}
1456
1456
set_general_handler ! ( & mut idt, general_handler, 14 ) ;
1457
- for i in 0 ..256 {
1457
+ for i in 0 ..= 255 {
1458
1458
if i == 0 || i == 14 {
1459
1459
assert ! ( entry_present( & idt, i) ) ;
1460
1460
} else {
1461
1461
assert ! ( !entry_present( & idt, i) ) ;
1462
1462
}
1463
1463
}
1464
1464
set_general_handler ! ( & mut idt, general_handler, 32 ..64 ) ;
1465
- for i in 1 ..256 {
1465
+ for i in 1 ..= 255 {
1466
1466
if i == 0 || i == 14 || ( 32 ..64 ) . contains ( & i) {
1467
1467
assert ! ( entry_present( & idt, i) , "{}" , i) ;
1468
1468
} else {
1469
1469
assert ! ( !entry_present( & idt, i) ) ;
1470
1470
}
1471
1471
}
1472
1472
set_general_handler ! ( & mut idt, general_handler) ;
1473
- for i in 0 ..256 {
1473
+ for i in 0 ..= 255 {
1474
1474
if i == 15 || i == 31 || ( 21 ..=28 ) . contains ( & i) {
1475
1475
// reserved entries should not be set
1476
1476
assert ! ( !entry_present( & idt, i) ) ;
0 commit comments