Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 2440 → Rev 2441

/kernel/branches/Kolibri-acpi/boot/bootcode.inc
145,7 → 145,7
;
;=========================================================================
 
include 'bootvesa.inc' ;Include source for boot vesa
include 'bootvesa.inc' ;Include source for boot vesa
if defined extended_primary_loader
include 'parsers.inc'
end if
387,7 → 387,7
 
push 0
pop es
and word [es:0x9031], 0
and word [es:BOOT_IDE_BASE_ADDR], 0
; \begin{Mario79}
; find HDD IDE DMA PCI device
; check for PCI BIOS
424,7 → 424,7
int 0x1A
jc .nopci
and cx, 0xFFF0 ; clear address decode type
mov [es:0x9031], cx
mov [es:BOOT_IDE_BASE_ADDR], cx
.nopci:
; \end{Mario79}
 
456,15 → 456,15
loopnz @b
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; --------------- APM ---------------------
and word [es:0x9044], 0 ; ver = 0.0 (APM not found)
and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found)
mov ax, 0x5300
xor bx, bx
int 0x15
jc apm_end ; APM not found
jc apm_end ; APM not found
test cx, 2
jz apm_end ; APM 32-bit protected-mode interface not supported
mov [es:0x9044], ax ; Save APM Version
mov [es:0x9046], cx ; Save APM flags
jz apm_end ; APM 32-bit protected-mode interface not supported
mov [es:BOOT_APM_VERSION], ax ; Save APM Version
mov [es:BOOT_APM_FLAGS], cx ; Save APM flags
 
; Write APM ver ----
and ax, 0xf0f
483,10 → 483,10
xor bx, bx
int 0x15
 
mov [es:0x9040], ebx
mov [es:0x9050], ax
mov [es:0x9052], cx
mov [es:0x9054], dx
mov [es:BOOT_APM_ENTRY], ebx
mov [es:BOOT_APM_CODE_32], ax
mov [es:BOOT_APM_CODE_16], cx
mov [es:BOOT_APM_DATA_16], dx
 
apm_end:
_setcursor d80x25_top_num, 0
630,7 → 630,7
push dword [es:8*4]
pop dword [.oldtimer]
push dword [.timer]
pop dword [es:8*4]
pop dword [es:8*4]
; mov eax, [es:8*4]
; mov [.oldtimer], eax
; mov eax, [.timer]
716,7 → 716,7
cmp ah, 0x50;x,0x50E0 ; down
jne .pgup
cmp word[es:si+10], -1
je .loops
je .loops
add word [cursor_pos], size_of_step
jmp .loops
 
771,7 → 771,7
push word [es:bp+6]
pop word [number_vm]
mov word [preboot_graph], bp ;save choose
 
jmp .d
 
.change_b:
947,18 → 947,17
 
; GRAPHICS ACCELERATION
; force yes
mov [es:0x901C], byte 1
mov [es:BOOT_MTRR], byte 1
 
; DMA ACCESS TO HD
 
mov al, [preboot_dma]
mov [es:0x901F], al
mov [es:BOOT_DMA], al
 
;; VRR_M USE
;
; mov al,[preboot_vrrm]
; mov [es:0x9030], al
mov [es:0x901E], byte 1
 
; BOOT DEVICE
 
1005,7 → 1004,7
; TODO: !!!! read only first sector and set variables !!!!!
; ...
; TODO: !!! then read flippy image track by track
 
mov cx, 0x0001 ; startcyl,startsector
.a1:
push cx dx
1097,7 → 1096,7
; and copy them to extended memory
mov si, movedesc
mov [si+8*2+3], bh ; from
 
mov ax, word [BPB_BytsPerSec]
shr ax, 1 ; words per sector
mov cx, word [BPB_RsvdSecCnt]
1105,7 → 1104,7
mul cx
push ax ; save to stack count of words in boot+FAT
xchg ax, cx
 
push es
push ds
pop es
1131,7 → 1130,7
; TODO: BPB_NumFATs !!!!!
add bx, word [BPB_BytsPerSec] ; !!! TODO: may be need multiply by BPB_RsvdSecCnt !!!
mov byte [si+8*2+3], bh ; bx - begin of FAT
 
mov ax, word [BPB_BytsPerSec]
shr ax, 1 ; words per sector
mov cx, word [BPB_FATSz16]
1146,12 → 1145,12
pop es
test ah, ah
jnz sayerr_floppy
 
mov ax, cx
shl ax, 1
and eax, 0ffffh ; ax - count of bytes in FAT
add dword [si+8*3+2], eax
 
; reading RootDir
; TODO: BPB_NumFATs
add bx, ax
1176,7 → 1175,7
pop bx
push bx
add word [FirstDataSector], bx ; Begin of data region of floppy
 
; read RootDir
call conv_abs_to_THS
pop ax
1337,7 → 1336,7
xor ax, ax
mov es, ax
 
mov ax, [es:0x9008] ; vga & 320x200
mov ax, [es:BOOT_VESA_MODE] ; vga & 320x200
mov bx, ax
cmp ax, 0x13
je setgr
/kernel/branches/Kolibri-acpi/boot/bootvesa.inc
193,7 → 193,7
mov word [es:bx], 640
mov word [es:bx+2], 480
mov word [es:bx+6], 0x13
 
mov word [es:bx+10], 640
mov word [es:bx+12], 480
mov word [es:bx+16], 0x12
251,7 → 251,7
mov [es:bx+6], cx ; +6 : mode number
movzx ax, byte [es:mi.BitsPerPixel]
mov word [es:bx+8], ax ; +8 : bits per pixel
add bx, size_of_step ; size of record
add bx, size_of_step ; size of record
 
@@:
add si, 2
278,11 → 278,11
; je .exit
; add bx,word [es:bp+2]
; add bx,word [es:bp+8]
;
;
; cmp ax,bx
; ja .loops
; jmp .again
;.loops:
;.loops:
; push dword [es:si]
; push dword [es:si+4]
; push dword [es:si+8]
353,7 → 353,7
mov si, mode9
.print:
call printplain
ret
ret
;-----------------------------------------------------------------------------
check_first_parm:
if defined extended_primary_loader
493,7 → 493,7
;-----------------------------------------------------------------------------
 
;default_vmode:
 
;-----------------------------------------------------------------------------
draw_vmodes_table:
_setcursor 9, 2
515,10 → 515,10
 
 
add cx, size_of_step*long_v_table
 
cmp ax, cx
jb .ok
 
sub cx, size_of_step*long_v_table
add cx, size_of_step
cmp cx, word[end_cursor]
624,9 → 624,9
;draw cursor
mov word[ds:_rs+21], '>>'
mov word[ds:_rs+46], '<<'
 
 
 
.next:
push si
mov si, _rs
707,7 → 707,7
mov cx, 70
add di, 20
dec bp
jns .loop_start
jns .loop_start
pop es
popa
ret
720,15 → 720,15
 
mov si, word [preboot_graph] ;[preboot_graph]
mov cx, word [es:si+6] ; number of mode
 
 
mov ax, word [es:si+0] ; resolution X
mov bx, word [es:si+2] ; resolution Y
 
 
mov word [es:0x900A], ax ; resolution X
mov word [es:0x900C], bx ; resolution Y
mov word [es:0x9008], cx ; number of mode
mov word [es:BOOT_X_RES], ax ; resolution X
mov word [es:BOOT_Y_RES], bx ; resolution Y
mov word [es:BOOT_VESA_MODE], cx ; number of mode
 
cmp cx, 0x12
je .mode0x12_0x13
747,11 → 747,11
int 0x10
; LFB
mov eax, [es:mi.PhysBasePtr];di+0x28]
mov [es:0x9018], eax
mov [es:BOOT_LFB], eax
; ---- vbe voodoo
BytesPerLine equ 0x10
mov ax, [es:di+BytesPerLine]
mov [es:0x9001], ax
mov [es:BOOT_PITCH], ax
; BPP
cmp [es:mi.BitsPerPixel], 16
jne .l0
760,12 → 760,12
mov [es:mi.BitsPerPixel], 15
.l0:
mov al, byte [es:di+0x19]
mov [es:0x9000], al
mov [es:BOOT_BPP], al
jmp .exit
 
.mode0x12_0x13:
mov byte [es:0x9000], 32
or dword [es:0x9018], 0xFFFFFFFF; 0x800000
mov byte [es:BOOT_BPP], 32
or dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000
 
 
; VESA 1.2 PM BANK SWITCH ADDRESS
788,10 → 788,6
.exit:
ret
 
 
; mov dword[es:0x9018],0x000A0000
; ret
 
;=============================================================================
;=============================================================================
;=============================================================================
/kernel/branches/Kolibri-acpi/const.inc
363,22 → 363,30
 
;;;;;;;;;;;boot time variables
 
;BOOT_BPP equ 0x9000 ;byte bits per pixel
BOOT_SCANLINE equ 0x9001 ;word scanline length
BOOT_BPP equ 0x9000 ;byte bits per pixel
BOOT_PITCH equ 0x9001 ;word scanline length
BOOT_VESA_MODE equ 0x9008 ;word vesa video mode
;;BOOT_X_RES equ 0x900A ;word X res
;;BOOT_Y_RES equ 0x900C ;word Y res
BOOT_X_RES equ 0x900A ;word X res
BOOT_Y_RES equ 0x900C ;word Y res
;;BOOT_MOUSE_PORT equ 0x9010 ;byte mouse port - not used
BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch
BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address
BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration
BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display)
BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled
;BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled
BOOT_DMA equ 0x901F ;
BOOT_PCI_DATA equ 0x9020 ;8bytes pci data
BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no
BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr
BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr
BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount
 
BOOT_APM_ENTRY equ 0x9040
BOOT_APM_VERSION equ 0x9044
BOOT_APM_FLAGS equ 0x9046 ;unused
BOOT_APM_CODE_32 equ 0x9050
BOOT_APM_CODE_16 equ 0x9052
BOOT_APM_DATA_16 equ 0x9054
 
TMP_FILE_NAME equ 0
TMP_CMD_LINE equ 1024
TMP_ICON_OFFS equ 1280
/kernel/branches/Kolibri-acpi/core/apic.inc
70,7 → 70,7
call IRQ_mask_all
 
; IOAPIC init
stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW
stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW+PG_NOCACHE
mov [IOAPIC_base], eax
 
mov eax, IOAPIC_VER
134,7 → 134,7
cmp [LAPIC_BASE], 0
jne .done
 
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW+PG_NOCACHE
mov [LAPIC_BASE], eax
mov esi, eax
 
/kernel/branches/Kolibri-acpi/core/memory.inc
358,7 → 358,7
 
cmp dword [LFBAddress], -1
jne @f
mov [BOOT_VAR+0x901c], byte 2
mov [BOOT_VAR+BOOT_MTRR], byte 2
; max VGA=640*480*4=1228800 bytes
; + 32*640*4=81920 bytes for mouse pointer
stdcall alloc_pages, ((1228800+81920)/4096)
378,7 → 378,7
@@:
test [SCR_MODE], word 0100000000000000b
jnz @f
mov [BOOT_VAR+0x901c], byte 2
mov [BOOT_VAR+BOOT_MTRR], byte 2
ret
@@:
call init_mtrr
1364,7 → 1364,7
align 4
proc init_mtrr
 
cmp [BOOT_VAR+0x901c], byte 2
cmp [BOOT_VAR+BOOT_MTRR], byte 2
je .exit
 
bt [cpu_caps], CAPS_MTRR
/kernel/branches/Kolibri-acpi/init.inc
522,15 → 522,6
ret
 
align 4
madt_find:
 
 
 
 
 
ret
 
align 4
check_acpi:
 
call acpi_locate
544,7 → 535,7
test eax, eax
jz .done
 
xchg bx, bx
; xchg bx, bx
 
mov [acpi_madt_base-OS_BASE], eax
mov ecx, [eax+36]
555,7 → 546,7
shr ebx, 24 ; read APIC ID
 
mov [edi], ebx ; bootstrap always first
inc [cpu_count]
inc [cpu_count-OS_BASE]
add edi, 4
 
lea edx, [eax+44]
/kernel/branches/Kolibri-acpi/kernel.asm
328,8 → 328,10
tmp_page_tabs dd ?
 
 
__DEBUG__ fix 1
__DEBUG__ fix 1
__DEBUG_LEVEL__ fix 1
include 'fdo.inc'
 
include 'init.inc'
 
org OS_BASE+$
401,17 → 403,17
call mutex_init
 
; SAVE REAL MODE VARIABLES
mov ax, [BOOT_VAR + 0x9031]
mov ax, [BOOT_VAR + BOOT_IDE_BASE_ADDR]
mov [IDEContrRegsBaseAddr], ax
; --------------- APM ---------------------
 
; init selectors
mov ebx, [BOOT_VAR+0x9040] ; offset of APM entry point
movzx eax, word [BOOT_VAR+0x9050]; real-mode segment base address of
; protected-mode 32-bit code segment
movzx ecx, word [BOOT_VAR+0x9052]; real-mode segment base address of
; protected-mode 16-bit code segment
movzx edx, word [BOOT_VAR+0x9054]; real-mode segment base address of
mov ebx, [BOOT_VAR+BOOT_APM_ENTRY] ; offset of APM entry point
movzx eax, word [BOOT_VAR+BOOT_APM_CODE_32] ; real-mode segment base address of
; protected-mode 32-bit code segment
movzx ecx, word [BOOT_VAR+BOOT_APM_CODE_16]; real-mode segment base address of
; protected-mode 16-bit code segment
movzx edx, word [BOOT_VAR+BOOT_APM_DATA_16]; real-mode segment base address of
; protected-mode 16-bit data segment
 
shl eax, 4
432,30 → 434,28
mov dword[apm_entry], ebx
mov word [apm_entry + 4], apm_code_32 - gdts
 
mov eax, [BOOT_VAR + 0x9044]; version & flags
mov eax, [BOOT_VAR + BOOT_APM_VERSION] ; version & flags
mov [apm_vf], eax
; -----------------------------------------
; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port
; mov [0xF604],byte 1 ;al
mov al, [BOOT_VAR+0x901F] ; DMA access
mov al, [BOOT_VAR+BOOT_DMA] ; DMA access
mov [allow_dma_access], al
movzx eax, byte [BOOT_VAR+0x9000] ; bpp
movzx eax, byte [BOOT_VAR+BOOT_BPP] ; bpp
mov [ScreenBPP], al
 
mov [_display.bpp], eax
mov [_display.vrefresh], 60
 
movzx eax, word [BOOT_VAR+0x900A]; X max
movzx eax, word [BOOT_VAR+BOOT_X_RES]; X max
mov [_display.width], eax
dec eax
mov [Screen_Max_X], eax
mov [screen_workarea.right], eax
movzx eax, word [BOOT_VAR+0x900C]; Y max
movzx eax, word [BOOT_VAR+BOOT_Y_RES]; Y max
mov [_display.height], eax
dec eax
mov [Screen_Max_Y], eax
mov [screen_workarea.bottom], eax
movzx eax, word [BOOT_VAR+0x9008]; screen mode
movzx eax, word [BOOT_VAR+BOOT_VESA_MODE]; screen mode
mov [SCR_MODE], eax
; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
; mov [BANK_SWITCH], eax
464,7 → 464,7
je @f
cmp [SCR_MODE], word 0x12 ; VGA 640x480
je @f
movzx eax, word[BOOT_VAR+0x9001] ; for other modes
movzx eax, word[BOOT_VAR+BOOT_PITCH] ; for other modes
mov [BytesPerScanLine], ax
mov [_display.pitch], eax
@@:
482,8 → 482,7
 
; GRAPHICS ADDRESSES
 
and byte [BOOT_VAR+0x901e], 0x0
mov eax, [BOOT_VAR+0x9018]
mov eax, [BOOT_VAR+BOOT_LFB]
mov [LFBAddress], eax
 
cmp [SCR_MODE], word 0100000000000000b
1054,6 → 1053,12
 
 
end if
mov eax, [cpu_count]
test eax, eax
jnz @F
mov al, 1 ; at least one CPU
@@:
DEBUGF 1, "K : %d CPU detected\n", eax
 
; START MULTITASKING
 
1080,7 → 1085,6
; Fly :)
 
include 'unpacker.inc'
include 'fdo.inc'
 
align 4
boot_log:
1214,10 → 1218,10
loop .fl60
push eax
 
mov ax, [BOOT_VAR+0x900c]
mov ax, [BOOT_VAR+BOOT_Y_RES]
shr ax, 1
shl eax, 16
mov ax, [BOOT_VAR+0x900A]
mov ax, [BOOT_VAR+BOOT_X_RES]
shr ax, 1
mov [MOUSE_X], eax
 
/kernel/branches/Kolibri-acpi/sec_loader/trunk/kolibri_ldm/bootvesa.inc
192,7 → 192,7
mov word [es:bx], 640
mov word [es:bx+2], 480
mov word [es:bx+6], 0x13
 
mov word [es:bx+10], 640
mov word [es:bx+12], 480
mov word [es:bx+16], 0x12
249,7 → 249,7
mov [es:bx+6], cx ; +6 : mode number
movzx ax, byte [es:mi.BitsPerPixel]
mov word [es:bx+8], ax ; +8 : bits per pixel
add bx, size_of_step ; size of record
add bx, size_of_step ; size of record
 
@@:
add si, 2
276,11 → 276,11
; je .exit
; add bx,word [es:bp+2]
; add bx,word [es:bp+8]
;
;
; cmp ax,bx
; ja .loops
; jmp .again
;.loops:
;.loops:
; push dword [es:si]
; push dword [es:si+4]
; push dword [es:si+8]
455,7 → 455,7
;-----------------------------------------------------------------------------
 
;default_vmode:
 
;-----------------------------------------------------------------------------
draw_vmodes_table:
_setcursor 9, 2
477,10 → 477,10
 
 
add cx, size_of_step*long_v_table
 
cmp ax, cx
jb .ok
 
sub cx, size_of_step*long_v_table
add cx, size_of_step
cmp cx, word[end_cursor]
586,9 → 586,9
;draw cursor
mov word[ds:_rs+21], '>>'
mov word[ds:_rs+46], '<<'
 
 
 
.next:
push si
mov si, _rs
682,15 → 682,15
 
mov si, word [preboot_graph] ;[preboot_graph]
mov cx, word [es:si+6] ; number of mode
 
 
mov ax, word [es:si+0] ; resolution X
mov bx, word [es:si+2] ; resolution Y
 
 
mov word [es:0x900A], ax ; resolution X
mov word [es:0x900C], bx ; resolution Y
mov word [es:0x9008], cx ; number of mode
mov word [es:BOOT_X_RES], ax ; resolution X
mov word [es:BOOT_Y_RES], bx ; resolution Y
mov word [es:BOOT_VESA_MODE], cx ; number of mode
 
cmp cx, 0x12
je .mode0x12_0x13
709,11 → 709,11
int 0x10
; LFB
mov eax, [es:mi.PhysBasePtr];di+0x28]
mov [es:0x9018], eax
mov [es:BOOT_LFB], eax
; ---- vbe voodoo
BytesPerLine equ 0x10
mov ax, [es:di+BytesPerLine]
mov [es:0x9001], ax
mov [es:BOOT_PITCH], ax
; BPP
cmp [es:mi.BitsPerPixel], 16
jne .l0
722,12 → 722,12
mov [es:mi.BitsPerPixel], 15
.l0:
mov al, byte [es:di+0x19]
mov [es:0x9000], al
mov [es:BOOT_BPP], al
jmp .exit
 
.mode0x12_0x13:
mov byte [es:0x9000], 32
or dword [es:0x9018], 0xFFFFFFFF; 0x800000
mov byte [es:BOOT_BPP], 32
or dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000
 
 
; VESA 1.2 PM BANK SWITCH ADDRESS
753,9 → 753,6
ret
 
 
; mov dword[es:0x9018],0x000A0000
; ret
 
;=============================================================================
;=============================================================================
;=============================================================================
/kernel/branches/Kolibri-acpi/sec_loader/trunk/kolibri_ldm/kolibri_ldm.asm
157,7 → 157,7
 
push 0
pop es
and word [es:0x9031], 0
and word [es:BOOT_IDE_BASE_ADDR], 0
; \begin{Mario79}
; find HDD IDE DMA PCI device
; check for PCI BIOS
194,7 → 194,7
int 0x1A
jc .nopci
and cx, 0xFFF0 ; clear address decode type
mov [es:0x9031], cx
mov [es:BOOT_IDE_BASE_ADDR], cx
.nopci:
; \end{Mario79}
 
226,7 → 226,7
loopnz @b
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; --------------- APM ---------------------
and word [es:0x9044], 0 ; ver = 0.0 (APM not found)
and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found)
mov ax, 0x5300
xor bx, bx
int 0x15
233,8 → 233,8
jc apm_end ; APM not found
test cx, 2
jz apm_end ; APM 32-bit protected-mode interface not supported
mov [es:0x9044], ax ; Save APM Version
mov [es:0x9046], cx ; Save APM flags
mov [es:BOOT_APM_VERSION], ax ; Save APM Version
mov [es:BOOT_APM_FLAGS], cx ; Save APM flags
 
; Write APM ver ----
and ax, 0xf0f
253,10 → 253,10
xor bx, bx
int 0x15
 
mov [es:0x9040], ebx
mov [es:0x9050], ax
mov [es:0x9052], cx
mov [es:0x9054], dx
mov [es:BOOT_APM_ENTRY], ebx
mov [es:BOOT_APM_CODE_32], ax
mov [es:BOOT_APM_CODE_16], cx
mov [es:BOOT_APM_DATA_16], dx
 
apm_end:
_setcursor d80x25_top_num, 0
514,7 → 514,7
push word [es:bp+6]
pop word [number_vm]
mov word [preboot_graph], bp ;save choose
 
jmp .d
 
.change_b:
670,18 → 670,17
 
; GRAPHICS ACCELERATION
; force yes
mov [es:0x901C], byte 1
mov [es:BOOT_MTRR], byte 1
 
; DMA ACCESS TO HD
 
mov al, [preboot_dma]
mov [es:0x901F], al
mov [es:BOOT_DMA], al
 
; VRR_M USE
 
mov al, [preboot_vrrm]
mov [es:0x9030], al
mov [es:0x901E], byte 1
; mov al, [preboot_vrrm]
; mov [es:0x9030], al
 
; BOOT DEVICE
 
698,7 → 697,7
xor ax, ax
mov es, ax
 
mov ax, [es:0x9008] ; vga & 320x200
mov ax, [es:BOOT_VESA_MODE] ; vga & 320x200
mov bx, ax
cmp ax, 0x13
je setgr