File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
tests/test_kernels/map_phys_mem Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ fn main() {
9
9
#[ cfg( feature = "binary" ) ]
10
10
mod binary {
11
11
use quote:: quote;
12
+ use std:: convert:: TryInto ;
12
13
13
14
pub fn main ( ) {
14
15
use llvm_tools_build as llvm_tools;
@@ -394,10 +395,23 @@ mod binary {
394
395
if num % 0x1000 == 0 {
395
396
Ok ( AlignedAddress ( num) )
396
397
} else {
397
- Err ( serde:: de:: Error :: custom ( format ! ( "address {:#x} is not page aligned" , num) ) )
398
+ Err ( serde:: de:: Error :: custom ( format ! (
399
+ "address {:#x} is not page aligned" ,
400
+ num
401
+ ) ) )
398
402
}
399
403
}
400
404
405
+ fn visit_i64 < E > ( self , num : i64 ) -> Result < Self :: Value , E >
406
+ where
407
+ E : serde:: de:: Error ,
408
+ {
409
+ let unsigned: u64 = num
410
+ . try_into ( )
411
+ . map_err ( |_| serde:: de:: Error :: custom ( format ! ( "address {} is negative" , num) ) ) ?;
412
+ self . visit_u64 ( unsigned)
413
+ }
414
+
401
415
fn visit_str < E > ( self , value : & str ) -> Result < Self :: Value , E >
402
416
where
403
417
E : serde:: de:: Error ,
@@ -411,7 +425,10 @@ mod binary {
411
425
u64:: from_str_radix ( & value, 10 )
412
426
}
413
427
. map_err ( |_err| {
414
- serde:: de:: Error :: custom ( format ! ( "string \" {}\" is not a valid memory address" , value) )
428
+ serde:: de:: Error :: custom ( format ! (
429
+ "string \" {}\" is not a valid memory address" ,
430
+ value
431
+ ) )
415
432
} ) ?;
416
433
417
434
self . visit_u64 ( num)
Original file line number Diff line number Diff line change @@ -11,4 +11,4 @@ uart_16550 = "0.2.10"
11
11
12
12
[package .metadata .bootloader ]
13
13
map-physical-memory = true
14
- physical-memory-offset = " 0x0000_4000_0000_0000"
14
+ physical-memory-offset = 0x0000_4000_0000_0000
You can’t perform that action at this time.
0 commit comments