File tree 1 file changed +19
-5
lines changed
src/structures/paging/mapper
1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -85,11 +85,25 @@ pub enum MappedFrame {
85
85
}
86
86
87
87
impl MappedFrame {
88
- fn start_address ( & self ) -> PhysAddr {
89
- match self {
90
- MappedFrame :: Size4KiB ( frame) => frame. start_address ( ) ,
91
- MappedFrame :: Size2MiB ( frame) => frame. start_address ( ) ,
92
- MappedFrame :: Size1GiB ( frame) => frame. start_address ( ) ,
88
+ const_fn ! {
89
+ /// Returns the start address of the frame.
90
+ pub fn start_address( & self ) -> PhysAddr {
91
+ match self {
92
+ MappedFrame :: Size4KiB ( frame) => frame. start_address( ) ,
93
+ MappedFrame :: Size2MiB ( frame) => frame. start_address( ) ,
94
+ MappedFrame :: Size1GiB ( frame) => frame. start_address( ) ,
95
+ }
96
+ }
97
+ }
98
+
99
+ const_fn ! {
100
+ /// Returns the size the frame (4KB, 2MB or 1GB).
101
+ pub fn size( & self ) -> u64 {
102
+ match self {
103
+ MappedFrame :: Size4KiB ( frame) => frame. size( ) ,
104
+ MappedFrame :: Size2MiB ( frame) => frame. size( ) ,
105
+ MappedFrame :: Size1GiB ( frame) => frame. size( ) ,
106
+ }
93
107
}
94
108
}
95
109
}
You can’t perform that action at this time.
0 commit comments