@@ -35,7 +35,7 @@ impl BootloaderConfig {
35
35
0x3D ,
36
36
] ;
37
37
#[ doc( hidden) ]
38
- pub const SERIALIZED_LEN : usize = 115 ;
38
+ pub const SERIALIZED_LEN : usize = 124 ;
39
39
40
40
/// Creates a new default configuration with the following values:
41
41
///
@@ -77,6 +77,7 @@ impl BootloaderConfig {
77
77
aslr,
78
78
dynamic_range_start,
79
79
dynamic_range_end,
80
+ ramdisk_memory,
80
81
} = mappings;
81
82
let FrameBuffer {
82
83
minimum_framebuffer_height,
@@ -133,13 +134,15 @@ impl BootloaderConfig {
133
134
} ,
134
135
) ;
135
136
136
- concat_106_9 (
137
+ let buf = concat_106_9 (
137
138
buf,
138
139
match minimum_framebuffer_width {
139
140
Option :: None => [ 0 ; 9 ] ,
140
141
Option :: Some ( addr) => concat_1_8 ( [ 1 ] , addr. to_le_bytes ( ) ) ,
141
142
} ,
142
- )
143
+ ) ;
144
+
145
+ concat_115_9 ( buf, ramdisk_memory. serialize ( ) )
143
146
}
144
147
145
148
/// Tries to deserialize a config byte array that was created using [`Self::serialize`].
@@ -197,6 +200,7 @@ impl BootloaderConfig {
197
200
let ( & dynamic_range_start, s) = split_array_ref ( s) ;
198
201
let ( & dynamic_range_end_some, s) = split_array_ref ( s) ;
199
202
let ( & dynamic_range_end, s) = split_array_ref ( s) ;
203
+ let ( & ramdisk_memory, s) = split_array_ref ( s) ;
200
204
201
205
let mappings = Mappings {
202
206
kernel_stack : Mapping :: deserialize ( & kernel_stack) ?,
@@ -227,6 +231,7 @@ impl BootloaderConfig {
227
231
[ 1 ] => Option :: Some ( u64:: from_le_bytes ( dynamic_range_end) ) ,
228
232
_ => return Err ( "invalid dynamic range end value" ) ,
229
233
} ,
234
+ ramdisk_memory : Mapping :: deserialize ( & ramdisk_memory) ?
230
235
} ;
231
236
( mappings, s)
232
237
} ;
@@ -381,6 +386,9 @@ pub struct Mappings {
381
386
///
382
387
/// Defaults to `0xffff_ffff_ffff_f000`.
383
388
pub dynamic_range_end : Option < u64 > ,
389
+ /// Virtual address to map ramdisk image, if present on disk
390
+ /// Defaults to dynamic
391
+ pub ramdisk_memory : Mapping
384
392
}
385
393
386
394
impl Mappings {
@@ -397,6 +405,7 @@ impl Mappings {
397
405
aslr : false ,
398
406
dynamic_range_start : None ,
399
407
dynamic_range_end : None ,
408
+ ramdisk_memory : Mapping :: new_default ( )
400
409
}
401
410
}
402
411
@@ -429,6 +438,7 @@ impl Mappings {
429
438
} else {
430
439
Option :: None
431
440
} ,
441
+ ramdisk_memory : Mapping :: random ( )
432
442
}
433
443
}
434
444
}
0 commit comments