@@ -10,6 +10,7 @@ fn main() {
1010 compile_error ! ( "This crate only supports the x86_64 architecture." ) ;
1111}
1212
13+ #[ cfg( feature = "binary" ) ]
1314#[ derive( Default ) ]
1415struct BootloaderConfig {
1516 physical_memory_offset : Option < u64 > ,
@@ -58,19 +59,16 @@ fn parse_to_config(cfg: &mut BootloaderConfig, table: &toml::value::Table) {
5859 ( "kernel-stack-address" , Value :: String ( s) ) => {
5960 cfg. kernel_stack_address = Some ( parse_aligned_addr ( key. as_str ( ) , & s) ) ;
6061 }
62+ #[ cfg( not( feature = "map_physical_memory" ) ) ]
63+ ( "physical-memory-offset" , Value :: String ( _) ) => {
64+ panic ! (
65+ "`physical-memory-offset` is only supported when the `map_physical_memory` \
66+ feature of the crate is enabled"
67+ ) ;
68+ }
69+ #[ cfg( feature = "map_physical_memory" ) ]
6170 ( "physical-memory-offset" , Value :: String ( s) ) => {
62- #[ cfg( feature = "map_physical_memory" ) ]
63- {
64- cfg. physical_memory_offset = Some ( parse_aligned_addr ( key. as_str ( ) , & s) ) ;
65- }
66-
67- #[ cfg( not( feature = "map_physical_memory" ) ) ]
68- {
69- panic ! (
70- "`physical-memory-offset` is only supported when the `map_physical_memory` \
71- feature of the crate is enabled"
72- ) ;
73- }
71+ cfg. physical_memory_offset = Some ( parse_aligned_addr ( key. as_str ( ) , & s) ) ;
7472 }
7573 ( "kernel-stack-size" , Value :: Integer ( i) ) => {
7674 if i <= 0 {
0 commit comments