@@ -13,7 +13,7 @@ stage_3:
1313 mov es , bx # set extra segment
1414 mov ss , bx # set stack segment
1515
16- lea si , boot_third_stage_str
16+ mov si , offset boot_third_stage_str
1717 call vga_println
1818
1919check_ cpu :
@@ -28,28 +28,28 @@ check_cpu:
2828
2929set_up_page_tables:
3030 # zero out buffer for page tables
31- lea edi , [ __page_table_start ]
32- lea ecx , [ __page_table_end ]
31+ mov edi , offset __page_table_start
32+ mov ecx , offset __page_table_end
3333 sub ecx , edi
3434 shr ecx , 2 # one stosd zeros 4 bytes - > divide by 4
3535 xor eax , eax
3636 rep stosd
3737
3838 # p4
39- lea eax , [ _p3 ]
39+ mov eax , offset _p3
4040 or eax , ( 1 | 2 )
4141 mov [ _p4 ], eax
4242 # p3
43- lea eax , [ _p2 ]
43+ mov eax , offset _p2
4444 or eax , ( 1 | 2 )
4545 mov [ _p3 ], eax
4646 # p2
47- lea eax , [ _p1 ]
47+ mov eax , offset _p1
4848 or eax , ( 1 | 2 )
4949 mov [ _p2 ], eax
5050 mov eax , ( 0x400000 | 1 | 2 | ( 1 << 7 ))
5151 mov ecx , 2
52- lea edx , _kernel_size
52+ mov edx , offset _kernel_size
5353 add edx , 0x400000 # start address
5454 add edx , 0x200000 - 1 # align up
5555 shr edx , 12 + 9 # end huge page number
@@ -62,12 +62,12 @@ set_up_page_tables:
6262 # p1
6363 # start mapping from __page_table_start , as we need to be able to access
6464 # the p4 table from rust. stop mapping at __bootloader_end
65- lea eax , __page_table_start
65+ mov eax , offset __page_table_start
6666 and eax , 0xfffff000
6767 or eax , ( 1 | 2 )
68- lea ecx , __page_table_start
68+ mov ecx , offset __page_table_start
6969 shr ecx , 12 # start page number
70- lea edx , __bootloader_end
70+ mov edx , offset __bootloader_end
7171 add edx , 4096 - 1 # align up
7272 shr edx , 12 # end page number
7373 map_p1_table:
@@ -86,7 +86,7 @@ enable_paging:
8686 mfence
8787
8888 # load P4 to cr3 register ( cpu uses this to access the P4 table)
89- lea eax , [ _p4 ]
89+ mov eax , offset _p4
9090 mov cr3 , eax
9191
9292 # enable PAE - flag in cr4 (Physical Address Extension)
@@ -110,7 +110,7 @@ load_64bit_gdt:
110110
111111jump_to_long_mode:
112112 push 0x8
113- lea eax , [ stage_4 ]
113+ mov eax , offset stage_4
114114 push eax
115115 retf # Load CS with 64 bit segment and flush the instruction cache
116116
@@ -150,7 +150,7 @@ check_cpuid:
150150 je no_cpuid
151151 ret
152152no_cpuid:
153- lea esi , no_cpuid_str
153+ mov esi , offset no_cpuid_str
154154 call vga_println
155155no_cpuid_spin:
156156 hlt
@@ -170,7 +170,7 @@ check_long_mode:
170170 jz no_long_mode # If it's not set , there is no long mode
171171 ret
172172no_long_mode:
173- lea esi , no_long_mode_str
173+ mov esi , offset no_long_mode_str
174174 call vga_println
175175no_long_mode_spin:
176176 hlt
0 commit comments