File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
crates/eonix_hal/src/arch/loongarch64 Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -42,16 +42,29 @@ struct PageTable([u64; 512]);
4242#[ unsafe( link_section = ".bootstrap.page_table.1" ) ]
4343static BOOT_PAGE_TABLE : PageTable = {
4444 let mut arr = [ 0 ; 512 ] ;
45- arr[ 0 ] = 0 | 0x11d3 ; // G | W | P | H | Cached | D | V
46- arr[ 510 ] = 0 | 0x11d3 ; // G | W | P | H | Cached | D | V
47- arr[ 511 ] = 0x8000_2000 | ( 1 << 60 ) ; // PT1, PT
45+ arr[ 0 ] = 0x8000_2000 | ( 1 << 60 ) ;
46+ arr[ 510 ] = 0x8000_2000 | ( 1 << 60 ) ;
47+ arr[ 511 ] = 0x8000_3000 | ( 1 << 60 ) ;
4848
4949 PageTable ( arr)
5050} ;
5151
5252#[ unsafe( link_section = ".bootstrap.page_table.2" ) ]
5353#[ used]
5454static PT1 : PageTable = {
55+ let mut arr: [ u64 ; 512 ] = [ 0 ; 512 ] ;
56+ let mut i: usize = 0 ;
57+ while i < 512 {
58+ arr[ i] = ( i as u64 * 0x4000_0000 ) | 0x11d3 ;
59+ i += 1 ;
60+ }
61+
62+ PageTable ( arr)
63+ } ;
64+
65+ #[ unsafe( link_section = ".bootstrap.page_table.3" ) ]
66+ #[ used]
67+ static PT2 : PageTable = {
5568 let mut arr = [ 0 ; 512 ] ;
5669 arr[ 510 ] = 0x8000_0000 | 0x11d3 ; // G | W | P | H | Cached | D | V
5770
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ SECTIONS {
99 . = ORIGIN (RAM) + 0x1000 ;
1010 KEEP (*(.bootstrap .page_table .1 ));
1111 KEEP (*(.bootstrap .page_table .2 ));
12+ KEEP (*(.bootstrap .page_table .3 ));
1213
1314 . = ALIGN (16 );
1415 KEEP (*(.bootstrap .stack ));
You can’t perform that action at this time.
0 commit comments