Remove last dangerous macro

This commit is contained in:
Baptiste Wicht 2013-10-14 16:36:48 +02:00
parent d973962312
commit 4f78ae19eb

View File

@ -23,17 +23,6 @@ jmp _start
%define STYLE(f,b) ((f << 4) + b) %define STYLE(f,b) ((f << 4) + b)
%macro PRINT_NORMAL 2
call set_current_position
mov rbx, %1
mov dl, STYLE(BLACK_F, WHITE_B)
call print_string
mov rax, [current_column]
add rax, %2
mov [current_column], rax
%endmacro
_start: _start:
; Reset data segments because the bootloader set it to ; Reset data segments because the bootloader set it to
; a value incompatible with the kernel ; a value incompatible with the kernel
@ -208,7 +197,9 @@ lm_start:
jmp .start jmp .start
.command_not_found: .command_not_found:
PRINT_NORMAL unknown_command_str_1, unknown_command_str_1_length mov r8, unknown_command_str_1
mov r9, unknown_command_str_1_length
call print_normal
call set_current_position call set_current_position
@ -221,7 +212,9 @@ lm_start:
add rax, rbx add rax, rbx
mov [current_column], rax mov [current_column], rax
PRINT_NORMAL unknown_command_str_2, unknown_command_str_2_length mov r8, unknown_command_str_2
mov r9, unknown_command_str_2_length
call print_normal
.end: .end:
mov qword [current_input_length], 0 mov qword [current_input_length], 0
@ -229,7 +222,9 @@ lm_start:
call goto_next_line call goto_next_line
;Display the command line ;Display the command line
PRINT_NORMAL command_line, command_line_length mov r8, command_line
mov r9, command_line_length
call print_normal
jmp .start_waiting jmp .start_waiting
@ -239,6 +234,7 @@ lm_start:
set_current_position: set_current_position:
push rax push rax
push rbx push rbx
push rdx
; Line offset ; Line offset
mov rax, [current_line] mov rax, [current_line]
@ -251,6 +247,7 @@ set_current_position:
lea rdi, [rax + rbx + TRAM] lea rdi, [rax + rbx + TRAM]
pop rdx
pop rbx pop rbx
pop rax pop rax
@ -314,7 +311,35 @@ clear_screen:
mov qword [current_line], 1 mov qword [current_line], 1
;Display the command line ;Display the command line
PRINT_NORMAL command_line, command_line_length mov r8, command_line
mov r9, command_line_length
call print_normal
ret
; Print the given string at the current position and update
; the current position for later print
; r8 = string to print
; r9 = length of the string to print
print_normal:
push rax
push rbx
push rdx
push rdi
call set_current_position
mov rbx, r8
mov dl, STYLE(BLACK_F, WHITE_B)
call print_string
mov rax, [current_column]
add rax, r9
mov [current_column], rax
pop rdi
pop rdx
pop rbx
pop rax
ret ret
@ -443,7 +468,9 @@ sysinfo_command:
push rcx push rcx
push rdx push rdx
PRINT_NORMAL sysinfo_vendor_id, sysinfo_vendor_id_length mov r8, sysinfo_vendor_id
mov r9, sysinfo_vendor_id_length
call print_normal
xor eax, eax xor eax, eax
cpuid cpuid
@ -458,7 +485,9 @@ sysinfo_command:
call print_string call print_string
call goto_next_line call goto_next_line
PRINT_NORMAL sysinfo_stepping, sysinfo_stepping_length mov r8, sysinfo_stepping
mov r9, sysinfo_stepping_length
call print_normal
mov eax, 1 mov eax, 1
cpuid cpuid
@ -473,7 +502,9 @@ sysinfo_command:
call print_int call print_int
call goto_next_line call goto_next_line
PRINT_NORMAL sysinfo_model, sysinfo_model_length mov r8, sysinfo_model
mov r9, sysinfo_model_length
call print_normal
; model id ; model id
mov r14, r15 mov r14, r15
@ -499,7 +530,9 @@ sysinfo_command:
call print_int call print_int
call goto_next_line call goto_next_line
PRINT_NORMAL sysinfo_family, sysinfo_family_length mov r8, sysinfo_family
mov r9, sysinfo_family_length
call print_normal
mov r8, r13 mov r8, r13
add r8, r11 add r8, r11
@ -508,7 +541,9 @@ sysinfo_command:
call print_int call print_int
call goto_next_line call goto_next_line
PRINT_NORMAL sysinfo_features, sysinfo_features_length mov r8, sysinfo_features
mov r9, sysinfo_features_length
call print_normal
mov eax, 1 mov eax, 1
cpuid cpuid
@ -520,7 +555,9 @@ sysinfo_command:
cmp r15, 0 cmp r15, 0
je .sse je .sse
PRINT_NORMAL sysinfo_mmx, sysinfo_mmx_length mov r8, sysinfo_mmx
mov r9, sysinfo_mmx_length
call print_normal
.sse: .sse:
@ -529,7 +566,9 @@ sysinfo_command:
cmp r15, 0 cmp r15, 0
je .sse2 je .sse2
PRINT_NORMAL sysinfo_sse, sysinfo_sse_length mov r8, sysinfo_sse
mov r9, sysinfo_sse_length
call print_normal
.sse2: .sse2:
@ -538,7 +577,9 @@ sysinfo_command:
cmp r15, 0 cmp r15, 0
je .ht je .ht
PRINT_NORMAL sysinfo_sse2, sysinfo_sse2_length mov r8, sysinfo_sse2
mov r9, sysinfo_sse2_length
call print_normal
.ht: .ht:
@ -547,7 +588,9 @@ sysinfo_command:
cmp r15, 0 cmp r15, 0
je .sse3 je .sse3
PRINT_NORMAL sysinfo_ht, sysinfo_ht_length mov r8, sysinfo_ht
mov r9, sysinfo_ht_length
call print_normal
.sse3: .sse3:
@ -556,7 +599,9 @@ sysinfo_command:
cmp r15, 0 cmp r15, 0
je .sse4_1 je .sse4_1
PRINT_NORMAL sysinfo_sse3, sysinfo_sse3_length mov r8, sysinfo_sse3
mov r9, sysinfo_sse3_length
call print_normal
.sse4_1: .sse4_1:
@ -565,7 +610,9 @@ sysinfo_command:
cmp r15, 0 cmp r15, 0
je .sse4_2 je .sse4_2
PRINT_NORMAL sysinfo_sse4_1, sysinfo_sse4_1_length mov r8, sysinfo_sse4_1
mov r9, sysinfo_sse4_1_length
call print_normal
.sse4_2: .sse4_2:
@ -574,7 +621,9 @@ sysinfo_command:
cmp r15, 0 cmp r15, 0
je .last je .last
PRINT_NORMAL sysinfo_sse4_2, sysinfo_sse4_2_length mov r8, sysinfo_sse4_2
mov r9, sysinfo_sse4_2_length
call print_normal
.last: .last: