瀏覽代碼

Add start_address and end_address methods

Philipp Oppermann 9 年之前
父節點
當前提交
e2708bdac7
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/lib.rs

+ 8 - 0
src/lib.rs

@@ -24,6 +24,14 @@ pub struct BootInformation {
 }
 
 impl BootInformation {
+    pub fn start_address(&self) -> usize {
+        self as *const _ as usize
+    }
+
+    pub fn end_address(&self) -> usize {
+        self.start_address() + self.total_size as usize
+    }
+
     pub fn elf_sections_tag(&self) -> Option<&'static ElfSectionsTag> {
         self.get_tag(9).map(|tag| unsafe{&*(tag as *const Tag as *const ElfSectionsTag)})
     }