Kernel: cleanup boot.S code and enable SSE
This commit is contained in:
parent
fdbc04f29d
commit
aac7595a47
|
@ -61,18 +61,53 @@ has_cpuid:
|
||||||
popl %eax
|
popl %eax
|
||||||
xorl (%esp), %eax
|
xorl (%esp), %eax
|
||||||
popfl
|
popfl
|
||||||
andl $0x00200000, %eax
|
testl $0x00200000, %eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
has_pae:
|
has_pae:
|
||||||
call has_cpuid
|
|
||||||
cmpl $0, %eax
|
|
||||||
jz .exit
|
|
||||||
movl $0, %eax
|
movl $0, %eax
|
||||||
cpuid
|
cpuid
|
||||||
movl %edx, %eax
|
testl $(1 << 6), %edx
|
||||||
andl $0x40, %eax # PAE is bit 6 in edx
|
ret
|
||||||
|
|
||||||
|
has_sse:
|
||||||
|
movl $1, %eax
|
||||||
|
cpuid
|
||||||
|
testl $(1 << 25), %edx
|
||||||
|
ret
|
||||||
|
|
||||||
|
check_requirements:
|
||||||
|
call has_cpuid
|
||||||
|
jz .exit
|
||||||
|
call has_pae
|
||||||
|
jz .exit
|
||||||
|
call has_sse
|
||||||
|
jz .exit
|
||||||
|
ret
|
||||||
.exit:
|
.exit:
|
||||||
|
jmp system_halt
|
||||||
|
|
||||||
|
copy_kernel_commandline:
|
||||||
|
pushl %esi
|
||||||
|
pushl %edi
|
||||||
|
movl g_multiboot_info, %esi
|
||||||
|
addl $16, %esi
|
||||||
|
movl (%esi), %esi
|
||||||
|
movl $1024, %ecx
|
||||||
|
movl $g_kernel_cmdline, %edi
|
||||||
|
rep movsl
|
||||||
|
popl %edi
|
||||||
|
popl %esi
|
||||||
|
ret
|
||||||
|
|
||||||
|
enable_sse:
|
||||||
|
movl %cr0, %eax
|
||||||
|
andw $0xFFFB, %ax
|
||||||
|
orw $0x0002, %ax
|
||||||
|
movl %eax, %cr0
|
||||||
|
movl %cr4, %eax
|
||||||
|
orw $0x0600, %ax
|
||||||
|
movl %eax, %cr4
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.global _start
|
.global _start
|
||||||
|
@ -84,16 +119,9 @@ _start:
|
||||||
movl %ebx, g_multiboot_info
|
movl %ebx, g_multiboot_info
|
||||||
|
|
||||||
# Copy kernel command line to known location
|
# Copy kernel command line to known location
|
||||||
movl %ebx, %esi
|
call copy_kernel_commandline
|
||||||
addl $16, %esi
|
call check_requirements
|
||||||
movl (%esi), %esi
|
call enable_sse
|
||||||
movl $1024, %ecx
|
|
||||||
movl $g_kernel_cmdline, %edi
|
|
||||||
rep movsl
|
|
||||||
|
|
||||||
call has_pae
|
|
||||||
cmpl $0, %eax
|
|
||||||
jz system_halt
|
|
||||||
|
|
||||||
# identity map first 4 MiB
|
# identity map first 4 MiB
|
||||||
movl $(0x00000000 + 0x83), boot_page_directory1 + 0
|
movl $(0x00000000 + 0x83), boot_page_directory1 + 0
|
||||||
|
|
Loading…
Reference in New Issue