2
2
.intel_syntax noprefix
3
3
.code32
4
4
5
- no_long_mode_str: .asciz "No long mode support"
6
-
7
5
stage_3:
8
6
mov bx , 0x10
9
7
mov ds , bx # set data segment
10
8
mov es , bx # set extra segment
11
9
mov ss , bx # set stack segment
12
10
11
+ # print "3rd stage" to the top right
12
+ mov eax , 0x0f720f33 # "3r"
13
+ mov [ 0xb808c ], eax
14
+ mov eax , 0x0f200f64 # "d "
15
+ mov [ 0xb808c + 4 ], eax
16
+ mov eax , 0x0f740f73 # "st"
17
+ mov [ 0xb808c + 8 ], eax
18
+ mov eax , 0x0f670f61 # "ag"
19
+ mov [ 0xb808c + 12 ], eax
20
+ mov eax , 0x0f200f65 # "e "
21
+ mov [ 0xb808c + 16 ], eax
22
+
13
23
check_ cpu :
14
24
call check_cpuid
15
25
call check_long_mode
@@ -143,8 +153,18 @@ check_cpuid:
143
153
je no_cpuid
144
154
ret
145
155
no_cpuid:
146
- lea si , no_cpuid_str
147
- jmp no_cpuid
156
+ # print "no cpuid" to the top right
157
+ mov eax , 0x4f6f4f6e # "no"
158
+ mov [ 0xb8130 ], eax
159
+ mov eax , 0x4f634f20 # " c"
160
+ mov [ 0xb8130 + 4 ], eax
161
+ mov eax , 0x4f754f70 # "pu"
162
+ mov [ 0xb8130 + 8 ], eax
163
+ mov eax , 0x4f644f69 # "id"
164
+ mov [ 0xb8130 + 12 ], eax
165
+ no_cpuid_spin:
166
+ hlt
167
+ jmp no_cpuid_spin
148
168
149
169
check_long_mode:
150
170
# test if extended processor info in available
@@ -160,8 +180,22 @@ check_long_mode:
160
180
jz no_long_mode # If it's not set , there is no long mode
161
181
ret
162
182
no_long_mode:
163
- lea si , no_long_mode_str
164
- jmp no_long_mode
183
+ # print "no long mode" to the top right
184
+ mov eax , 0x4f6f4f6e # "no"
185
+ mov [ 0xb8128 ], eax
186
+ mov eax , 0x4f6c4f20 # " l"
187
+ mov [ 0xb8128 + 4 ], eax
188
+ mov eax , 0x4f6e4f6f # "on"
189
+ mov [ 0xb8128 + 8 ], eax
190
+ mov eax , 0x4f204f67 # "g "
191
+ mov [ 0xb8128 + 12 ], eax
192
+ mov eax , 0x4f6f4f6d # "mo"
193
+ mov [ 0xb8128 + 16 ], eax
194
+ mov eax , 0x4f654f64 # "de"
195
+ mov [ 0xb8128 + 20 ], eax
196
+ no_long_mode_spin:
197
+ hlt
198
+ jmp no_long_mode_spin
165
199
166
200
167
201
. align 4
0 commit comments