@@ -403,9 +403,9 @@ impl KernelDumpParser {
403
403
}
404
404
405
405
/// Read physical memory starting at `gpa` into a `buffer`.
406
- pub fn phys_read ( & self , gpa : Gpa , buffer : & mut [ u8 ] ) -> Result < usize > {
406
+ pub fn phys_read ( & self , gpa : Gpa , buf : & mut [ u8 ] ) -> Result < usize > {
407
407
// Amount of bytes left to read.
408
- let mut amount_left = buffer . len ( ) ;
408
+ let mut amount_left = buf . len ( ) ;
409
409
// Total amount of bytes that we have successfully read.
410
410
let mut total_read = 0 ;
411
411
// The current gpa we are reading from.
@@ -423,7 +423,7 @@ impl KernelDumpParser {
423
423
let left_in_page = ( Page :: size ( ) - gpa. offset ( ) ) as usize ;
424
424
let amount_wanted = min ( amount_left, left_in_page) ;
425
425
// Figure out where we should read into.
426
- let slice = & mut buffer [ total_read..total_read + amount_wanted] ;
426
+ let slice = & mut buf [ total_read..total_read + amount_wanted] ;
427
427
// Read the physical memory!
428
428
let amount_read = self . read ( slice) ?;
429
429
// Update the total amount of read bytes and how much work we have left.
@@ -444,12 +444,12 @@ impl KernelDumpParser {
444
444
445
445
/// Read an exact amount of physical memory starting at `gpa` into a
446
446
/// `buffer`.
447
- pub fn phys_read_exact ( & self , gpa : Gpa , buffer : & mut [ u8 ] ) -> Result < ( ) > {
447
+ pub fn phys_read_exact ( & self , gpa : Gpa , buf : & mut [ u8 ] ) -> Result < ( ) > {
448
448
// Read physical memory.
449
- let len = self . phys_read ( gpa, buffer ) ?;
449
+ let len = self . phys_read ( gpa, buf ) ?;
450
450
451
451
// If we read as many bytes as we wanted, then it's a win..
452
- if len == buffer . len ( ) {
452
+ if len == buf . len ( ) {
453
453
Ok ( ( ) )
454
454
}
455
455
// ..otherwise, we call it quits.
@@ -525,9 +525,9 @@ impl KernelDumpParser {
525
525
}
526
526
527
527
/// Read virtual memory starting at `gva` into a `buffer`.
528
- pub fn virt_read ( & self , gva : Gva , buffer : & mut [ u8 ] ) -> Result < usize > {
528
+ pub fn virt_read ( & self , gva : Gva , buf : & mut [ u8 ] ) -> Result < usize > {
529
529
// Amount of bytes left to read.
530
- let mut amount_left = buffer . len ( ) ;
530
+ let mut amount_left = buf . len ( ) ;
531
531
// Total amount of bytes that we have successfully read.
532
532
let mut total_read = 0 ;
533
533
// The current gva we are reading from.
@@ -541,7 +541,7 @@ impl KernelDumpParser {
541
541
let left_in_page = ( Page :: size ( ) - addr. offset ( ) ) as usize ;
542
542
let amount_wanted = min ( amount_left, left_in_page) ;
543
543
// Figure out where we should read into.
544
- let slice = & mut buffer [ total_read..total_read + amount_wanted] ;
544
+ let slice = & mut buf [ total_read..total_read + amount_wanted] ;
545
545
// Translate the gva into a gpa..
546
546
let gpa = self . virt_translate ( addr) ?;
547
547
// .. and read the physical memory!
@@ -565,17 +565,17 @@ impl KernelDumpParser {
565
565
/// Try to read virtual memory starting at `gva` into a `buffer`. If a
566
566
/// memory translation error occurs, it'll return `None` instead of an
567
567
/// error.
568
- pub fn try_virt_read ( & self , gva : Gva , buffer : & mut [ u8 ] ) -> Result < Option < usize > > {
569
- filter_addr_translation_err ( self . virt_read ( gva, buffer ) )
568
+ pub fn try_virt_read ( & self , gva : Gva , buf : & mut [ u8 ] ) -> Result < Option < usize > > {
569
+ filter_addr_translation_err ( self . virt_read ( gva, buf ) )
570
570
}
571
571
572
572
/// Read an exact amount of virtual memory starting at `gva`.
573
- pub fn virt_read_exact ( & self , gva : Gva , buffer : & mut [ u8 ] ) -> Result < ( ) > {
573
+ pub fn virt_read_exact ( & self , gva : Gva , buf : & mut [ u8 ] ) -> Result < ( ) > {
574
574
// Read virtual memory.
575
- let len = self . virt_read ( gva, buffer ) ?;
575
+ let len = self . virt_read ( gva, buf ) ?;
576
576
577
577
// If we read as many bytes as we wanted, then it's a win..
578
- if len == buffer . len ( ) {
578
+ if len == buf . len ( ) {
579
579
Ok ( ( ) )
580
580
}
581
581
// ..otherwise, we call it quits.
@@ -587,8 +587,8 @@ impl KernelDumpParser {
587
587
/// Try to read an exact amount of virtual memory starting at `gva`. If a
588
588
/// memory translation error occurs, it'll return `None` instead of an
589
589
/// error.
590
- pub fn try_virt_read_exact ( & self , gva : Gva , buffer : & mut [ u8 ] ) -> Result < Option < ( ) > > {
591
- filter_addr_translation_err ( self . virt_read_exact ( gva, buffer ) )
590
+ pub fn try_virt_read_exact ( & self , gva : Gva , buf : & mut [ u8 ] ) -> Result < Option < ( ) > > {
591
+ filter_addr_translation_err ( self . virt_read_exact ( gva, buf ) )
592
592
}
593
593
594
594
/// Read a `T` from virtual memory.
@@ -824,7 +824,7 @@ impl KernelDumpParser {
824
824
use DumpType as D ;
825
825
match dump_type {
826
826
D :: Full => Self :: full_physmem ( headers, reader) ,
827
- D :: Bmp => Self :: bmp_physmem ( reader) ,
827
+ D :: Bmp | D :: LiveKernelMemory => Self :: bmp_physmem ( reader) ,
828
828
D :: KernelMemory | D :: KernelAndUserMemory | D :: CompleteMemory => {
829
829
Self :: kernel_physmem ( dump_type, reader)
830
830
}
0 commit comments