Skip to content

Commit 39c6bbb

Browse files
committed
Merge branch 'main' into uefi
2 parents 873351c + 7fac0b9 commit 39c6bbb

File tree

5 files changed

+43
-26
lines changed

5 files changed

+43
-26
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
name: Test
2727

2828
strategy:
29+
fail-fast: false
2930
matrix:
3031
os: [ubuntu-latest, macos-latest, windows-latest]
3132
runs-on: ${{ matrix.os }}

Changelog.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Unreleased
22

3+
# 0.9.16 – 2021-03-07
4+
5+
Replace all remaining `lea`s with `mov` + `offset` ([#140](https://github.com/rust-osdev/bootloader/pull/140))
6+
7+
# 0.9.15 – 2021-03-07
8+
9+
- Fix linker errors on latest nightlies ([#139](https://github.com/rust-osdev/bootloader/pull/139))
10+
11+
# 0.9.14 – 2021-02-24
12+
13+
- Fix "panic message is not a string literal" warning ([#138](https://github.com/rust-osdev/bootloader/pull/138))
14+
15+
# 0.9.13 – 2021-02-24
16+
17+
(accidental release)
18+
319
# 0.9.12 – 2021-02-02
420

521
- Fix build on latest nightly by updating x86_64 to v0.13.2 ([#135](https://github.com/rust-osdev/bootloader/pull/135))

src/asm/stage_1.s

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _start:
2222
# initialize stack
2323
mov sp, 0x7c00
2424

25-
lea si, boot_start_str
25+
mov si, offset boot_start_str
2626
call real_mode_println
2727

2828
enable_a20:
@@ -78,7 +78,7 @@ check_int13h_extensions:
7878
jc no_int13h_extensions
7979

8080
load_rest_of_bootloader_from_disk:
81-
lea eax, _rest_of_bootloader_start_addr
81+
mov eax, offset _rest_of_bootloader_start_addr
8282

8383
mov ecx, 0
8484

@@ -96,11 +96,11 @@ load_from_disk:
9696
sub eax, ebx
9797
mov [dap_buffer_addr], ax
9898

99-
lea eax, _rest_of_bootloader_start_addr
99+
mov eax, offset _rest_of_bootloader_start_addr
100100
add eax, ecx # add offset
101101

102102
# number of disk blocks to load
103-
lea ebx, _rest_of_bootloader_end_addr
103+
mov ebx, offset _rest_of_bootloader_end_addr
104104
sub ebx, eax # end - start
105105
jz load_from_disk_done
106106
shr ebx, 9 # divide by 512 (block size)
@@ -114,12 +114,12 @@ load_from_disk:
114114
add ecx, ebx
115115

116116
# number of start block
117-
lea ebx, _start
117+
mov ebx, offset _start
118118
sub eax, ebx
119119
shr eax, 9 # divide by 512 (block size)
120120
mov [dap_start_lba], eax
121121

122-
lea si, dap
122+
mov si, offset dap
123123
mov ah, 0x42
124124
int 0x13
125125
jc rest_of_bootloader_load_failed
@@ -131,7 +131,7 @@ load_from_disk_done:
131131
mov word ptr [dap_buffer_seg], 0
132132

133133
jump_to_second_stage:
134-
lea eax, [stage_2]
134+
mov eax, offset stage_2
135135
jmp eax
136136

137137
spin:
@@ -208,11 +208,11 @@ real_mode_error:
208208
jmp spin
209209

210210
no_int13h_extensions:
211-
lea si, no_int13h_extensions_str
211+
mov si, offset no_int13h_extensions_str
212212
jmp real_mode_error
213213

214214
rest_of_bootloader_load_failed:
215-
lea si, rest_of_bootloader_load_failed_str
215+
mov si, offset rest_of_bootloader_load_failed_str
216216
jmp real_mode_error
217217

218218
boot_start_str: .asciz "Booting (first stage)..."

src/asm/stage_2.s

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ second_stage_start_str: .asciz "Booting (second stage)..."
1010
kernel_load_failed_str: .asciz "Failed to load kernel from disk"
1111

1212
kernel_load_failed:
13-
lea si, [kernel_load_failed_str]
13+
mov si, offset kernel_load_failed_str
1414
call real_mode_println
1515
kernel_load_failed_spin:
1616
jmp kernel_load_failed_spin
1717

1818
stage_2:
19-
lea si, [second_stage_start_str]
19+
mov si, offset second_stage_start_str
2020
call real_mode_println
2121

2222
set_target_operating_mode:
@@ -33,15 +33,15 @@ set_target_operating_mode:
3333

3434
load_kernel_from_disk:
3535
# start of memory buffer
36-
lea eax, _kernel_buffer
36+
mov eax, offset _kernel_buffer
3737
mov [dap_buffer_addr], ax
3838

3939
# number of disk blocks to load
4040
mov word ptr [dap_blocks], 1
4141

4242
# number of start block
43-
lea eax, _kernel_start_addr
44-
lea ebx, _start
43+
mov eax, offset _kernel_start_addr
44+
mov ebx, offset _start
4545
sub eax, ebx
4646
shr eax, 9 # divide by 512 (block size)
4747
mov [dap_start_lba], eax
@@ -50,13 +50,13 @@ load_kernel_from_disk:
5050
mov edi, 0x400000
5151

5252
# block count
53-
lea ecx, _kernel_size
53+
mov ecx, offset _kernel_size
5454
add ecx, 511 # align up
5555
shr ecx, 9
5656

5757
load_next_kernel_block_from_disk:
5858
# load block from disk
59-
lea si, dap
59+
mov si, offset dap
6060
mov ah, 0x42
6161
int 0x13
6262
jc kernel_load_failed
@@ -97,7 +97,7 @@ enter_protected_mode_again:
9797
mov cr0, eax
9898

9999
push 0x8
100-
lea eax, [stage_3]
100+
mov eax, offset stage_3
101101
push eax
102102
retf
103103

src/asm/stage_3.s

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

1919
check_cpu:
@@ -28,19 +28,19 @@ check_cpu:
2828

2929
set_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
@@ -60,7 +60,7 @@ enable_paging:
6060
mfence
6161

6262
# load P4 to cr3 register (cpu uses this to access the P4 table)
63-
lea eax, [_p4]
63+
mov eax, offset _p4
6464
mov cr3, eax
6565

6666
# enable PAE-flag in cr4 (Physical Address Extension)
@@ -84,7 +84,7 @@ load_64bit_gdt:
8484

8585
jump_to_long_mode:
8686
push 0x8
87-
lea eax, [stage_4]
87+
mov eax, offset stage_4
8888
push eax
8989
retf # Load CS with 64 bit segment and flush the instruction cache
9090

@@ -124,7 +124,7 @@ check_cpuid:
124124
je no_cpuid
125125
ret
126126
no_cpuid:
127-
lea esi, no_cpuid_str
127+
mov esi, offset no_cpuid_str
128128
call vga_println
129129
no_cpuid_spin:
130130
hlt
@@ -144,7 +144,7 @@ check_long_mode:
144144
jz no_long_mode # If it's not set, there is no long mode
145145
ret
146146
no_long_mode:
147-
lea esi, no_long_mode_str
147+
mov esi, offset no_long_mode_str
148148
call vga_println
149149
no_long_mode_spin:
150150
hlt

0 commit comments

Comments
 (0)