Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1682 → Rev 1683

/kernel/branches/Kolibri-A/trunk/kernel.asm
130,6 → 130,8
include "bus/pci/pci16.inc"
include "detect/biosdisk.inc"
 
diff16 "end of code16 ",0,$
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SWITCH TO 32 BIT PROTECTED MODE ;;
192,13 → 194,18
dw 11011111b *256 +10010010b
db 0x00
 
diff16 "end of tmp_gdt ",0,$
 
include "data16.inc"
 
diff16 "end of data16 ",0,$
 
use32
org $+0x10000
 
align 4
B32:
diff16 "32-bit code start ",0,$
mov ax,os_stack ; Selector for os
mov ds,ax
mov es,ax
205,42 → 212,22
mov fs,ax
mov gs,ax
mov ss,ax
mov esp,0x3ec00 ; Set stack
mov esp,0x4ec00 ; Set stack
 
; CLEAR 0x280000 - HEAP_BASE
;-------------------------------------------------------------------------------
call preinit_mem ; (init.inc)
 
xor eax,eax
mov edi,0x280000
mov ecx,(HEAP_BASE-OS_BASE-0x280000) / 4
cld
rep stosd
call test_cpu ; (init.inc - to be moved to bus/CPU.inc)
bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc
 
mov edi,0x40000
mov ecx,(0x90000-0x40000)/4
rep stosd
call init_BIOS32 ; (init.inc - to be removed later)
 
; CLEAR KERNEL UNDEFINED GLOBALS
mov edi, endofcode-OS_BASE
mov ecx, (uglobals_size/4)+4
rep stosd
; PCIe extended config space access
call rs7xx_pcie_init ; (bus/HT.inc)
 
; SAVE & CLEAR 0-0xffff
 
xor esi, esi
mov edi,0x2F0000
mov ecx,0x10000 / 4
rep movsd
mov edi,0x1000
mov ecx,0xf000 / 4
rep stosd
 
call test_cpu
bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc
 
call init_BIOS32
; MEMORY MODEL
call init_mem
call init_page_map
call init_mem ; (init.inc)
call init_page_map ; (init.inc)
 
; ENABLE PAGING
 
378,6 → 365,7
mov edi, BiosDisksData
rep movsd
 
 
; GRAPHICS ADDRESSES
 
and byte [BOOT_VAR+0x901e],0x0
384,7 → 372,6
mov eax,[BOOT_VAR+0x9018]
mov [LFBAddress],eax
 
;==
cmp [SCR_MODE],word 0100000000000000b
jge setvesa20
mov eax, 0xDEADBEEF
391,37 → 378,13
hlt
; === EGA, VGA & Vesa 1.2 modes not supported ===
setvesa20:
; mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0 24bpp modes
; mov [GETPIXEL],dword Vesa20_getpixel24
; cmp [ScreenBPP],byte 24
; jz v20ga24
v20ga32:
mov [PUTPIXEL],dword Vesa20_putpixel32
mov [GETPIXEL],dword Vesa20_getpixel32
 
; -------- Fast System Call init ----------
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
; bt [cpu_caps], CAPS_SEP
; jnc .SEnP ; SysEnter not Present
; xor edx, edx
; mov ecx, MSR_SYSENTER_CS
; mov eax, os_code
; wrmsr
; mov ecx, MSR_SYSENTER_ESP
;; mov eax, sysenter_stack ; Check it
; xor eax, eax
; wrmsr
; mov ecx, MSR_SYSENTER_EIP
; mov eax, sysenter_entry
; wrmsr
.SEnP:
; AMD SYSCALL/SYSRET
; cmp byte[cpu_vendor], 'A'
; jne .noSYSCALL
; mov eax, 0x80000001
; cpuid
; test edx, 0x800 ; bit_11 - SYSCALL/SYSRET support
; jz .noSYSCALL
mov ecx, MSR_AMD_EFER
rdmsr
or eax, 1 ; bit_0 - System Call Extension (SCE)
428,9 → 391,9
wrmsr
 
; Bits of EDX :
; Bit 31–16 During the SYSRET instruction, this field is copied into the CS register
; Bit 31..16 During the SYSRET instruction, this field is copied into the CS register
; and the contents of this field, plus 8, are copied into the SS register.
; Bit 15–0 During the SYSCALL instruction, this field is copied into the CS register
; Bit 15..0 During the SYSCALL instruction, this field is copied into the CS register
; and the contents of this field, plus 8, are copied into the SS register.
 
mov edx, 0x1B000B ; RING3 task stack will be used for fast syscalls!
487,7 → 450,7
call init_LFB
call init_fpu
call init_malloc
 
;-
stdcall alloc_kernel_space, 0x51000
mov [default_io_map], eax
 
743,9 → 706,7
mov [CPU_FREQ],eax ; save tsc / sec
; mov ebx, 1000000
; div ebx
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥áâ¥
; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥©
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“...
; faster division possible:
mov edx, 2251799814
mul edx
shr edx, 19
783,22 → 744,7
call stack_init
call fdc_init
 
; PALETTE FOR 320x200 and 640x480 16 col
 
; cmp [SCR_MODE],word 0x12
; jne no_pal_vga
; mov esi,boot_pal_vga
; call boot_log
; call paletteVGA
; no_pal_vga:
 
; cmp [SCR_MODE],word 0x13
; jne no_pal_ega
; mov esi,boot_pal_ega
; call boot_log
; call palette320x200
; no_pal_ega:
 
; LOAD DEFAULT SKIN
 
call load_default_skin
824,9 → 770,6
call init_userDMA ; <<<<<<<<< ============== core/memory.inc =================
mov esi, boot_uDMA_ok
call boot_log
; call pci_ext_config ; <<<<<<<<< bus/pci/pcie.inc
;-------------------------------------------------------------------------------
call rs7xx_pcie_init ; <<<<<<<<< bus/ht.inc
 
; LOAD FIRST APPLICATION
cli
4901,9 → 4844,12
ret
end if
 
diff16 "End of 32-code ",0,$
 
include "data32.inc"
 
__REV__ = __REV
 
uglobals_size = $ - endofcode
diff16 "end of kernel code",0,$
diff16 "Zero-filled blk",0,endofcode
diff16 "End of kernel ",0,$