not flat yet

git-svn-id: svn://kolibrios.org@388 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-03-05 20:56:42 +00:00
parent f591baba3e
commit 9140ef0cce
30 changed files with 1188 additions and 1452 deletions

View File

@ -9,7 +9,7 @@ uglobal
endg endg
fdc_init: ;start with clean tracks. fdc_init: ;start with clean tracks.
mov edi,0xD201 mov edi,OS_BASE+0xD201
mov al,0 mov al,0
mov ecx,160 mov ecx,160
rep stosb rep stosb
@ -22,7 +22,7 @@ fdc_filesave: ;ebx: cluster to be saved.
mov bl,18 mov bl,18
div bl div bl
mov ah,0 mov ah,0
add eax,0xD201 add eax,OS_BASE+0xD201
mov [eax],byte 1 ;This track is now dirty. mov [eax],byte 1 ;This track is now dirty.
popa popa
ret ret

View File

@ -25,7 +25,7 @@ hd_read:
push ecx esi edi ; scan cache push ecx esi edi ; scan cache
mov ecx,cache_max ; entries in cache mov ecx,cache_max ; entries in cache
mov esi,0x600000+8 mov esi,OS_BASE+0x600000+8
mov edi,1 mov edi,1
hdreadcache: hdreadcache:
@ -54,7 +54,7 @@ hd_read:
call hd_read_pio call hd_read_pio
@@: @@:
lea esi,[edi*8+0x600000] lea esi,[edi*8+OS_BASE+0x600000]
mov [esi],eax ; sector number mov [esi],eax ; sector number
mov dword [esi+4],1 ; hd read - mark as same as in hd mov dword [esi+4],1 ; hd read - mark as same as in hd
@ -62,7 +62,7 @@ hd_read:
mov esi,edi mov esi,edi
shl esi,9 shl esi,9
add esi,0x600000+65536 add esi,OS_BASE+0x600000+65536
mov edi,ebx mov edi,ebx
mov ecx,512/4 mov ecx,512/4
cld cld
@ -115,7 +115,7 @@ hd_read_pio:
cli cli
push edi push edi
shl edi,9 shl edi,9
add edi,0x600000+65536 add edi,OS_BASE+0x600000+65536
mov ecx,256 mov ecx,256
mov edx,[hdbase] mov edx,[hdbase]
cld cld
@ -153,7 +153,7 @@ hd_write:
; check if the cache already has the sector and overwrite it ; check if the cache already has the sector and overwrite it
mov ecx,cache_max mov ecx,cache_max
mov esi,0x600000+8 mov esi,OS_BASE+0x600000+8
mov edi,1 mov edi,1
hdwritecache: hdwritecache:
@ -178,7 +178,7 @@ hd_write:
cmp [hd_error],0 cmp [hd_error],0
jne hd_write_access_denied jne hd_write_access_denied
lea esi,[edi*8+0x600000] lea esi,[edi*8+OS_BASE+0x600000]
mov [esi],eax ; sector number mov [esi],eax ; sector number
yes_in_cache_write: yes_in_cache_write:
@ -186,7 +186,7 @@ hd_write:
mov dword [esi+4],2 ; write - differs from hd mov dword [esi+4],2 ; write - differs from hd
shl edi,9 shl edi,9
add edi,0x600000+65536 add edi,OS_BASE+0x600000+65536
mov esi,ebx mov esi,ebx
mov ecx,512/4 mov ecx,512/4
cld cld
@ -205,7 +205,7 @@ write_cache:
; write difference ( 2 ) from cache to hd ; write difference ( 2 ) from cache to hd
mov ecx,cache_max mov ecx,cache_max
mov esi,0x600000+8 mov esi,OS_BASE+0x600000+8
mov edi,1 mov edi,1
write_cache_more: write_cache_more:
@ -323,7 +323,7 @@ cache_write_pio:
; cli ; cli
mov esi,edi mov esi,edi
shl esi,9 shl esi,9
add esi,0x600000+65536 ; esi = from memory position add esi,OS_BASE+0x600000+65536 ; esi = from memory position
mov ecx,256 mov ecx,256
mov edx,[hdbase] mov edx,[hdbase]
cld cld
@ -357,7 +357,7 @@ find_empty_slot:
inside_cache: inside_cache:
cmp dword [edi*8+0x600000+4],2 ; get cache slot info cmp dword [edi*8+OS_BASE+0x600000+4],2 ; get cache slot info
jb found_slot ; it's empty or read jb found_slot ; it's empty or read
dec ecx dec ecx
jnz search_for_empty jnz search_for_empty
@ -378,7 +378,7 @@ align 4
clear_hd_cache: clear_hd_cache:
push eax ecx edi push eax ecx edi
mov edi,0x600000 mov edi,OS_BASE+0x600000
mov ecx,16384 mov ecx,16384
xor eax,eax xor eax,eax
cld cld
@ -574,7 +574,7 @@ iglobal
align 4 align 4
; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary ; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary
IDE_descriptor_table: IDE_descriptor_table:
dd 284000h dd OS_BASE+284000h
dw 2000h dw 2000h
dw 8000h dw 8000h
@ -607,16 +607,16 @@ hdd_irq14:
out dx, al out dx, al
call update_counters call update_counters
mov ebx, [dma_process] mov ebx, [dma_process]
cmp [0x3000], ebx cmp [CURRENT_TASK], ebx
jz .noswitch jz .noswitch
mov [dma_task_switched], 1 mov [dma_task_switched], 1
mov edi, [dma_slot_ptr] mov edi, [dma_slot_ptr]
mov eax, [0x3000] mov eax, [CURRENT_TASK]
mov [dma_process], eax mov [dma_process], eax
mov eax, [0x3010] mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax mov [dma_slot_ptr], eax
mov [0x3000], ebx mov [CURRENT_TASK], ebx
mov [0x3010], edi mov [TASK_BASE], edi
mov byte [0xFFFF], 1 mov byte [0xFFFF], 1
call do_change_task call do_change_task
.noswitch: .noswitch:
@ -638,16 +638,16 @@ hdd_irq15:
out dx, al out dx, al
call update_counters call update_counters
mov ebx, [dma_process] mov ebx, [dma_process]
cmp [0x3000], ebx cmp [CURRENT_TASK], ebx
jz .noswitch jz .noswitch
mov [dma_task_switched], 1 mov [dma_task_switched], 1
mov edi, [dma_slot_ptr] mov edi, [dma_slot_ptr]
mov eax, [0x3000] mov eax, [CURRENT_TASK]
mov [dma_process], eax mov [dma_process], eax
mov eax, [0x3010] mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax mov [dma_slot_ptr], eax
mov [0x3000], ebx mov [CURRENT_TASK], ebx
mov [0x3010], edi mov [TASK_BASE], edi
mov byte [0xFFFF], 1 mov byte [0xFFFF], 1
call do_change_task call do_change_task
.noswitch: .noswitch:
@ -668,11 +668,11 @@ hd_read_dma:
mov eax, [esp+4] mov eax, [esp+4]
sub eax, [dma_cur_sector] sub eax, [dma_cur_sector]
shl eax, 9 shl eax, 9
add eax, 0x284000 add eax, OS_BASE+0x284000
push ecx esi edi push ecx esi edi
mov esi, eax mov esi, eax
shl edi, 9 shl edi, 9
add edi, 0x610000 add edi, OS_BASE+0x610000
mov ecx, 512/4 mov ecx, 512/4
cld cld
rep movsd rep movsd
@ -681,9 +681,9 @@ hd_read_dma:
pop eax pop eax
ret ret
.notread: .notread:
mov eax, IDE_descriptor_table mov eax, IDE_descriptor_table-OS_BASE
mov dword [eax], 0x284000 mov dword [eax+OS_BASE], 0x284000
mov word [eax+4], 0x2000 mov word [eax+4+OS_BASE], 0x2000
mov dx, [IDEContrRegsBaseAddr] mov dx, [IDEContrRegsBaseAddr]
cmp [hdbase], 0x1F0 cmp [hdbase], 0x1F0
jz @f jz @f
@ -734,9 +734,9 @@ hd_read_dma:
@@: @@:
mov al, 9 mov al, 9
out dx, al out dx, al
mov eax, [0x3000] mov eax, [CURRENT_TASK]
mov [dma_process], eax mov [dma_process], eax
mov eax, [0x3010] mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax mov [dma_slot_ptr], eax
cmp [hdbase], 0x1F0 cmp [hdbase], 0x1F0
jnz .ide1 jnz .ide1
@ -766,7 +766,7 @@ write_cache_chain:
mov eax, IDE_descriptor_table mov eax, IDE_descriptor_table
mov edx, [cache_chain_pos] mov edx, [cache_chain_pos]
shl edx, 9 shl edx, 9
add edx, 0x610000 add edx, OS_BASE+0x610000
mov [eax], edx mov [eax], edx
movzx edx, [cache_chain_size] movzx edx, [cache_chain_size]
shl edx, 9 shl edx, 9
@ -777,7 +777,7 @@ write_cache_sector:
mov eax, IDE_descriptor_table mov eax, IDE_descriptor_table
mov edx, edi mov edx, edi
shl edx, 9 shl edx, 9
add edx, 0x610000 add edx, OS_BASE+0x610000
mov [eax], edx mov [eax], edx
mov word [eax+4], 0x200 mov word [eax+4], 0x200
do_write_dma: do_write_dma:
@ -832,9 +832,9 @@ do_write_dma:
@@: @@:
mov al, 1 mov al, 1
out dx, al out dx, al
mov eax, [0x3000] mov eax, [CURRENT_TASK]
mov [dma_process], eax mov [dma_process], eax
mov eax, [0x3010] mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax mov [dma_slot_ptr], eax
cmp [hdbase], 0x1F0 cmp [hdbase], 0x1F0
jnz .ide1 jnz .ide1

File diff suppressed because it is too large Load Diff

View File

@ -112,7 +112,7 @@ mode1 db "640x480",0
mode2 db "800x600",0 mode2 db "800x600",0
mode3 db "1024x768",0 mode3 db "1024x768",0
mode4 db "1280x1024",0 mode4 db "1280x1024",0
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000 modes_msg dw mode4,mode1,mode2,mode3
modevesa20 db " á LFB",0 modevesa20 db " á LFB",0
modevesa12 db ", VESA 1.2 Bnk",0 modevesa12 db ", VESA 1.2 Bnk",0
mode9 db "320x200, EGA/CGA 256 梥⮢",0 mode9 db "320x200, EGA/CGA 256 梥⮢",0
@ -124,7 +124,7 @@ on_msg db "
off_msg db " ¢ëª«",13,10,0 off_msg db " ¢ëª«",13,10,0
vrrm_msg db " [c] ˆá¯®«ì§®¢ ­¨¥ VRR:",0 vrrm_msg db " [c] ˆá¯®«ì§®¢ ­¨¥ VRR:",0
preboot_device_msg db " [d] Ž¡à § ¤¨áª¥âë: ",0 preboot_device_msg db " [d] Ž¡à § ¤¨áª¥âë: ",0
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000 preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "­ áâ®ïé ï ¤¨áª¥â ",13,10,0 pdm1 db "­ áâ®ïé ï ¤¨áª¥â ",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0 pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §",13,10,0 pdm3 db "¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §",13,10,0

View File

@ -16,7 +16,7 @@ preboot_device db 0 ; boot device
;!!!! 0 - autodetect !!!! ;!!!! 0 - autodetect !!!!
preboot_blogesc db 1 ; start immediately after bootlog preboot_blogesc db 1 ; start immediately after bootlog
if $>10200h if $>0x200
ERROR: prebooting parameters must fit in first sector!!! ERROR: prebooting parameters must fit in first sector!!!
end if end if
hdsysimage db 'KOLIBRI IMG' ; load from hdsysimage db 'KOLIBRI IMG' ; load from

View File

@ -1,9 +1,9 @@
; READ RAMDISK IMAGE FROM HD ; READ RAMDISK IMAGE FROM HD
cmp [boot_dev],1 cmp [boot_dev+OS_BASE+0x10000],1
jne no_sys_on_hd jne no_sys_on_hd
test [0x40001],byte 0x40 test [DRIVE_DATA+1],byte 0x40
jz position_2 jz position_2
mov [hdbase],0x1f0 mov [hdbase],0x1f0
mov [hdid],0x0 mov [hdid],0x0
@ -14,11 +14,11 @@
call search_and_read_image call search_and_read_image
cmp [image_retrieved],1 cmp [image_retrieved],1
je yes_sys_on_hd je yes_sys_on_hd
movzx eax,byte [0x40002] movzx eax,byte [DRIVE_DATA+2]
cmp [fat32part],eax cmp [fat32part],eax
jle position_1_1 jle position_1_1
position_2: position_2:
test [0x40001],byte 0x10 test [DRIVE_DATA+1],byte 0x10
jz position_3 jz position_3
mov [hdbase],0x1f0 mov [hdbase],0x1f0
mov [hdid],0x10 mov [hdid],0x10
@ -29,11 +29,11 @@
call search_and_read_image call search_and_read_image
cmp [image_retrieved],1 cmp [image_retrieved],1
je yes_sys_on_hd je yes_sys_on_hd
movzx eax,byte [0x40003] movzx eax,byte [DRIVE_DATA+3]
cmp eax,[fat32part] cmp eax,[fat32part]
jle position_2_1 jle position_2_1
position_3: position_3:
test [0x40001],byte 0x4 test [DRIVE_DATA+1],byte 0x4
jz position_4 jz position_4
mov [hdbase],0x170 mov [hdbase],0x170
mov [hdid],0x0 mov [hdid],0x0
@ -44,11 +44,11 @@
call search_and_read_image call search_and_read_image
cmp [image_retrieved],1 cmp [image_retrieved],1
je yes_sys_on_hd je yes_sys_on_hd
movzx eax,byte [0x40004] movzx eax,byte [DRIVE_DATA+4]
cmp eax,[fat32part] cmp eax,[fat32part]
jle position_3_1 jle position_3_1
position_4: position_4:
test [0x40001],byte 0x1 test [DRIVE_DATA+1],byte 0x1
jz no_sys_on_hd jz no_sys_on_hd
mov [hdbase],0x170 mov [hdbase],0x170
mov [hdid],0x10 mov [hdid],0x10
@ -59,7 +59,7 @@
call search_and_read_image call search_and_read_image
cmp [image_retrieved],1 cmp [image_retrieved],1
je yes_sys_on_hd je yes_sys_on_hd
movzx eax,byte [0x40005] movzx eax,byte [DRIVE_DATA+5]
cmp eax,[fat32part] cmp eax,[fat32part]
jle position_4_1 jle position_4_1
jmp yes_sys_on_hd jmp yes_sys_on_hd
@ -80,7 +80,7 @@
ret ret
read_image: read_image:
mov eax, hdsysimage mov eax, hdsysimage+OS_BASE+0x10000
mov ebx, 1474560/512 mov ebx, 1474560/512
mov ecx, RAMDISK mov ecx, RAMDISK
mov esi, 0 mov esi, 0

View File

@ -16,15 +16,15 @@ system_shutdown: ; shut down the system
call sys_cd_audio call sys_cd_audio
cld cld
mov al,[0x2f0000+0x9030] mov al,[BOOT_VAR+0x9030]
cmp al,1 cmp al,1
jl no_shutdown_parameter jl no_shutdown_parameter
cmp al,4 cmp al,4
jle yes_shutdown_param jle yes_shutdown_param
no_shutdown_parameter: no_shutdown_parameter:
; movzx ecx,word [0x2f0000+0x900A] ; movzx ecx,word [BOOT_VAR+0x900A]
; movzx esi,word [0x2f0000+0x900C] ; movzx esi,word [BOOT_VAR+0x900C]
; imul ecx,esi ;[0xfe04] ; imul ecx,esi ;[0xfe04]
;; mov ecx,0x500000/4 ;3fff00/4 ; darken screen ;; mov ecx,0x500000/4 ;3fff00/4 ; darken screen
; push ecx ; push ecx
@ -378,7 +378,7 @@ restart_kernel_4000:
; bootloader interface ; bootloader interface
push 0x1000 push 0x1000
pop ds pop ds
mov si, kernel_restart_bootblock-0x10000 mov si, kernel_restart_bootblock
mov ax, 'KL' mov ax, 'KL'
jmp 0x1000:0000 jmp 0x1000:0000

View File

@ -134,9 +134,9 @@ SSE_FZ equ 0x8000
SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM) SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM)
OS_BASE equ 0 OS_BASE equ 0x01000000
window_data equ (OS_BASE+0x0000000) window_data equ OS_BASE
CURRENT_TASK equ (OS_BASE+0x0003000) CURRENT_TASK equ (OS_BASE+0x0003000)
TASK_COUNT equ (OS_BASE+0x0003004) TASK_COUNT equ (OS_BASE+0x0003004)
@ -196,7 +196,6 @@ MOUSE_BUFF_COUNT equ (OS_BASE+0x000FCFF)
LFBAddress equ (OS_BASE+0x000FE80) LFBAddress equ (OS_BASE+0x000FE80)
MEM_AMOUNT equ (OS_BASE+0x000FE8C) MEM_AMOUNT equ (OS_BASE+0x000FE8C)
;LFBSize equ (OS_BASE+0x02f9050)
ScreenWidth equ (OS_BASE+0x000FE00) ScreenWidth equ (OS_BASE+0x000FE00)
ScreenHeight equ (OS_BASE+0x000FE04) ScreenHeight equ (OS_BASE+0x000FE04)
@ -235,7 +234,7 @@ SB16_Status equ (OS_BASE+0x02B0000)
BUTTON_INFO equ (OS_BASE+0x02C0000) BUTTON_INFO equ (OS_BASE+0x02C0000)
RESERVED_PORTS equ (OS_BASE+0x02D0000) RESERVED_PORTS equ (OS_BASE+0x02D0000)
IRQ_SAVE equ (OS_BASE+0x02E0000) IRQ_SAVE equ (OS_BASE+0x02E0000)
SYS_VAR equ (OS_BASE+0x02f0000) BOOT_VAR equ (OS_BASE+0x02f0000)
IMG_BACKGROUND equ (OS_BASE+0x0300000) IMG_BACKGROUND equ (OS_BASE+0x0300000)
WinMapAddress equ (OS_BASE+0x0460000) WinMapAddress equ (OS_BASE+0x0460000)
display_data equ (OS_BASE+0x0460000) display_data equ (OS_BASE+0x0460000)
@ -256,7 +255,7 @@ skin_data equ (OS_BASE+0x0778000)
tss_data equ (OS_BASE+0x780000) tss_data equ (OS_BASE+0x780000)
draw_data equ (OS_BASE+0x988000) draw_data equ (OS_BASE+0x988000)
HEAP_BASE equ (OS_BASE+0x98B000) HEAP_BASE equ (OS_BASE+0x01000000)
LFB_BASE equ 0x7DC00000 LFB_BASE equ 0x7DC00000
@ -264,10 +263,8 @@ page_tabs equ 0x7FC00000
master_tab equ 0x7FDFF000 master_tab equ 0x7FDFF000
app_page_tabs equ 0x7FE00000 app_page_tabs equ 0x7FE00000
sys_pgdir equ OS_BASE+0x00050000 sys_pgdir equ (OS_BASE+0x00050000)
sys_master_tab equ OS_BASE+0x00051000 sys_pgmap equ (OS_BASE+0x00052000)
sys_pgmap equ OS_BASE+0x00052000
new_app_base equ 0x80000000 new_app_base equ 0x80000000
@ -330,10 +327,6 @@ struc SYS_VARS
.vesa_mode dd ? .vesa_mode dd ?
.x_res dd ? .x_res dd ?
.y_res dd ? .y_res dd ?
.cpu_caps dd ?
dd ?
dd ?
dd ?
} }
struc APPOBJ ;common object header struc APPOBJ ;common object header

View File

@ -1038,21 +1038,3 @@ destroy_kernel_object:
ret ret
;szSound db 'SOUND',0
;szInfinity db 'INFINITY',0
szHwMouse db 'ATI2D',0
szSTART db 'START',0
szEXPORTS db 'EXPORTS',0
szIMPORTS db 'IMPORTS',0
msg_unresolved db 'unresolved ',0
msg_module db 'in module ',0
msg_version db 'incompatible driver version',13,10,0
msg_www db 'please visit www.kolibrios.org',13,10,0
msg_CR db 13,10,0
align 4
create_cursor dd 0
set_hw_cursor dd 0
hw_restore dd 0

View File

@ -1,160 +1,4 @@
tmp_page_tab equ HEAP_BASE
align 4
proc mem_test
mov eax, cr0
and eax, not (CR0_CD+CR0_NW)
or eax, CR0_CD ;disable caching
mov cr0, eax
wbinvd ;invalidate cache
xor edi, edi
mov ebx, 'TEST'
@@:
add edi, 0x400000
xchg ebx, dword [edi]
cmp dword [edi], 'TEST'
xchg ebx, dword [edi]
je @b
mov [MEM_AMOUNT], edi
and eax, not (CR0_CD+CR0_NW) ;enable caching
mov cr0, eax
mov eax, edi
mov [LFBSize], 0x00800000
ret
endp
align 4
proc init_mem
mov eax, [MEM_AMOUNT]
mov [pg_data.mem_amount], eax
mov [pg_data.kernel_max], eax
shr eax, 12
mov edx, eax
mov [pg_data.pages_count], eax
mov [pg_data.kernel_pages], eax
shr eax, 3
mov [pg_data.pagemap_size], eax
shr edx, 10
cmp edx, 3
ja @f
inc edx ;at least 4Mb for kernel heap
@@:
mov [pg_data.kernel_tables], edx
xor eax, eax
mov edi, sys_pgdir
mov ecx, 2048
cld
rep stosd
mov edx, sys_pgdir
bt [cpu_caps], CAPS_PSE
jnc .no_PSE
mov ebx, cr4
or ebx, CR4_PSE
mov eax, PG_LARGE+PG_SW
bt [cpu_caps], CAPS_PGE
jnc @F
or eax, PG_GLOBAL
or ebx, CR4_PGE
@@:
mov cr4, ebx
sub [pg_data.kernel_tables], 2
mov [edx], eax
add eax, 0x00400000
mov [edx+4], eax
add edx, 8
mov eax, 0x800000+PG_SW
mov ecx, (HEAP_BASE-0x800000)/4096
jmp .map_low
.no_PSE:
mov eax, PG_SW
mov ecx, HEAP_BASE/4096
.map_low:
mov edi, tmp_page_tab
@@: ;
stosd
add eax, 0x1000
dec ecx
jnz @B
mov ecx, [pg_data.kernel_tables]
shl ecx, 10
xor eax, eax
rep stosd
mov ecx, [pg_data.kernel_tables]
mov eax, tmp_page_tab+PG_SW
mov edi, edx
.map_kernel_tabs:
stosd
add eax, 0x1000
dec ecx
jnz .map_kernel_tabs
mov dword [sys_pgdir+(page_tabs shr 20)], sys_pgdir+PG_SW
ret
endp
align 4
proc init_page_map
mov edi, sys_pgmap
mov ecx, (HEAP_BASE/4096)/32 ;384/4
mov ebx, ecx
xor eax,eax
cld
rep stosd
not eax
mov ecx, [pg_data.pagemap_size]
sub ecx, ebx
shr ecx, 2
rep stosd
lea edi, [sys_pgmap+ebx*4] ;+384
mov edx, [pg_data.pages_count]
mov ecx, [pg_data.kernel_tables]
add ecx, (HEAP_BASE/4096) and 31
sub edx, HEAP_BASE/4096
sub edx, ecx
mov [pg_data.pages_free], edx
xor eax, eax
mov ebx, ecx
shr ecx, 5
rep stosd
not eax
mov ecx, ebx
and ecx, 31
shl eax, cl
mov [page_start], edi; sys_pgmap+384
stosd
mov ebx, sys_pgmap
add ebx, [pg_data.pagemap_size]
mov [page_end], ebx
mov [pg_data.pg_mutex], 0
ret
endp
align 4 align 4
proc alloc_page proc alloc_page
@ -382,21 +226,29 @@ proc init_LFB
cmp dword [LFBAddress], -1 cmp dword [LFBAddress], -1
jne @f jne @f
mov [0x2f0000+0x901c],byte 2 mov [BOOT_VAR+0x901c],byte 2
stdcall kernel_alloc, 0x280000 stdcall kernel_alloc, 0x280000
mov [LFBAddress], eax mov [LFBAddress], eax
ret ret
@@: @@:
test [SCR_MODE],word 0100000000000000b test [SCR_MODE],word 0100000000000000b
jnz @f jnz @f
mov [0x2f0000+0x901c],byte 2 mov [BOOT_VAR+0x901c],byte 2
ret ret
@@: @@:
mov edx, LFB_BASE mov edx, LFB_BASE
mov esi, [LFBAddress] mov esi, [LFBAddress]
mov edi, [LFBSize] mov edi, 0x00800000
mov dword [exp_lfb+4], edx mov dword [exp_lfb+4], edx
push eax
push edx
mov edx, 0x400 ;bocsh
mov al,0xff ;bocsh
out dx, al ;bocsh
pop edx
pop eax
shr edi, 12 shr edi, 12
mov [pg_count], edi mov [pg_count], edi
shr edi, 10 shr edi, 10
@ -427,7 +279,7 @@ proc init_LFB
@@: @@:
call alloc_page call alloc_page
stdcall map_page_table, edx, eax stdcall map_page_table, edx, eax
add esi, 0x00400000 add edx, 0x00400000
dec edi dec edi
jnz @B jnz @B
@ -436,7 +288,11 @@ proc init_LFB
or eax, PG_UW or eax, PG_UW
mov ecx, [pg_count] mov ecx, [pg_count]
cld cld
rep stosd @@:
stosd
add eax, 0x1000
dec ecx
jnz @B
mov dword [LFBAddress], LFB_BASE mov dword [LFBAddress], LFB_BASE
mov eax, cr3 ;flush TLB mov eax, cr3 ;flush TLB
@ -605,6 +461,14 @@ align 4
proc page_fault_handler proc page_fault_handler
pushad pushad
push eax
push edx
mov edx, 0x400 ;bocsh
mov al,0xff ;bocsh
out dx, al ;bocsh
pop edx
pop eax
mov ebp, esp mov ebp, esp
mov eax, cr2 mov eax, cr2
push eax push eax
@ -670,6 +534,7 @@ proc page_fault_handler
mov esp, ebp mov esp, ebp
popad popad
add esp, 4 add esp, 4
iretd
save_ring3_context ;debugger support save_ring3_context ;debugger support
@ -1085,148 +950,10 @@ new_services:
mov [esp+36], eax mov [esp+36], eax
ret ret
align 4
proc strncmp stdcall, str1:dword, str2:dword, count:dword
mov ecx,[count]
jecxz .end
mov ebx,ecx
mov edi,[str1]
mov esi,edi
xor eax,eax
repne scasb
neg ecx ; cx = count - strlen
add ecx,ebx ; strlen + count - strlen
.okay:
mov edi,esi
mov esi,[str2]
repe cmpsb
mov al,[esi-1]
xor ecx,ecx
cmp al,[edi-1]
ja .str2_big
je .end
.str1_big:
sub ecx,2
.str2_big:
not ecx
.end:
mov eax,ecx
ret
endp
align 4
proc test_cpu
locals
cpu_type dd ?
cpu_id dd ?
cpu_Intel dd ?
cpu_AMD dd ?
endl
mov [cpu_type], 0
xor eax, eax
mov [cpu_caps], eax
mov [cpu_caps+4], eax
pushfd
pop eax
mov ecx, eax
xor eax, 0x40000
push eax
popfd
pushfd
pop eax
xor eax, ecx
mov [cpu_type], CPU_386
jz .end_cpuid
push ecx
popfd
mov [cpu_type], CPU_486
mov eax, ecx
xor eax, 0x200000
push eax
popfd
pushfd
pop eax
xor eax, ecx
je .end_cpuid
mov [cpu_id], 1
xor eax, eax
cpuid
mov [cpu_vendor], ebx
mov [cpu_vendor+4], edx
mov [cpu_vendor+8], ecx
cmp ebx, dword [intel_str]
jne .check_AMD
cmp edx, dword [intel_str+4]
jne .check_AMD
cmp ecx, dword [intel_str+8]
jne .check_AMD
mov [cpu_Intel], 1
cmp eax, 1
jl .end_cpuid
mov eax, 1
cpuid
mov [cpu_sign], eax
mov [cpu_info], ebx
mov [cpu_caps], edx
mov [cpu_caps+4],ecx
shr eax, 8
and eax, 0x0f
ret
.end_cpuid:
mov eax, [cpu_type]
ret
.check_AMD:
cmp ebx, dword [AMD_str]
jne .unknown
cmp edx, dword [AMD_str+4]
jne .unknown
cmp ecx, dword [AMD_str+8]
jne .unknown
mov [cpu_AMD], 1
cmp eax, 1
jl .unknown
mov eax, 1
cpuid
mov [cpu_sign], eax
mov [cpu_info], ebx
mov [cpu_caps], edx
mov [cpu_caps+4],ecx
shr eax, 8
and eax, 0x0f
ret
.unknown:
mov eax, 1
cpuid
mov [cpu_sign], eax
mov [cpu_info], ebx
mov [cpu_caps], edx
mov [cpu_caps+4],ecx
shr eax, 8
and eax, 0x0f
ret
endp
MEM_WB equ 6 ;write-back memory
MEM_WC equ 1 ;write combined memory
MEM_UC equ 0 ;uncached memory
align 4 align 4
proc init_mtrr proc init_mtrr
cmp [0x2f0000+0x901c],byte 2 cmp [BOOT_VAR+0x901c],byte 2
je .exit je .exit
bt [cpu_caps], CAPS_MTRR bt [cpu_caps], CAPS_MTRR
@ -1297,6 +1024,43 @@ proc set_mtrr stdcall, reg:dword,base:dword,size:dword,mem_type:dword
ret ret
endp endp
align 4
proc strncmp stdcall, str1:dword, str2:dword, count:dword
mov ecx,[count]
jecxz .end
mov ebx,ecx
mov edi,[str1]
mov esi,edi
xor eax,eax
repne scasb
neg ecx ; cx = count - strlen
add ecx,ebx ; strlen + count - strlen
.okay:
mov edi,esi
mov esi,[str2]
repe cmpsb
mov al,[esi-1]
xor ecx,ecx
cmp al,[edi-1]
ja .str2_big
je .end
.str1_big:
sub ecx,2
.str2_big:
not ecx
.end:
mov eax,ecx
ret
endp
align 4 align 4
proc stall stdcall, delay:dword proc stall stdcall, delay:dword
push ecx push ecx
@ -1324,106 +1088,6 @@ proc stall stdcall, delay:dword
ret ret
endp endp
iglobal
align 4
intel_str db "GenuineIntel",0
AMD_str db "AuthenticAMD",0
endg
uglobal
align 16
irq_tab rd 16
MEM_FreeSpace rd 1
ipc_tmp rd 1
ipc_pdir rd 1
ipc_ptab rd 1
proc_mem_map rd 1
proc_mem_pdir rd 1
proc_mem_tab rd 1
tmp_task_pdir rd 1
tmp_task_ptab rd 1
fdd_buff rd 1
LFBSize rd 1
stall_mcs rd 1
;;CPUID information
cpu_vendor rd 3
cpu_sign rd 1
cpu_info rd 1
;;;;; cursors data
align 16
cur_saved_data rb 4096
def_cursor rd 1
hw_cursor rd 1
scr_width rd 1
scr_height rd 1
cur_def_interl rd 1
cur_saved_base rd 1
cur_saved_interl rd 1
cur_saved_w rd 1
cur_saved_h rd 1
endg
uglobal
align 16
fpu_data:
rb 512
mst MEM_STATE
mem_block_map rb 512
event_map rb 64
mem_block_list rd 64
mem_block_mask rd 2
srv.fd rd 1
srv.bk rd 1
mem_used.fd rd 1
mem_used.bk rd 1
mem_block_arr rd 1
mem_block_start rd 1
mem_block_end rd 1
heap_mutex rd 1
heap_size rd 1
heap_free rd 1
heap_blocks rd 1
free_blocks rd 1
page_start rd 1
page_end rd 1
events rd 1
event_start rd 1
event_end rd 1
event_uid rd 1
sys_page_map rd 1
os_stack rd 1
endg
if 0
push eax
push edx
mov edx, 0x400 ;bocsh
mov al,0xff ;bocsh
out dx, al ;bocsh
pop edx
pop eax
end if
align 4 align 4
k_strrchr: k_strrchr:
push eax push eax
@ -1643,3 +1307,15 @@ k_strlen:
ret ret
end if end if
if 0
push eax
push edx
mov edx, 0x400 ;bocsh
mov al,0xff ;bocsh
out dx, al ;bocsh
pop edx
pop eax
end if

View File

@ -7,6 +7,7 @@
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 4
idtreg: idtreg:
dw 8*0x41-1 dw 8*0x41-1
dd idts+8 dd idts+8

View File

@ -1119,13 +1119,5 @@ proc set_app_params stdcall,slot:dword, params:dword,\
ret ret
endp endp
include "debug.inc" include "debug.inc"
iglobal
new_process_loading db 'K : New Process - loading',13,10,0
new_process_running db 'K : New Process - done',13,10,0
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
endg

View File

@ -0,0 +1,41 @@
preboot_lfb db 0
preboot_bootlog db 0
old_ints_h:
dw 0x400
dd 0
dw 0
kernel_restart_bootblock:
db 1 ; version
dw 1 ; floppy image is in memory
dd 0 ; cannot save parameters
align 4
; videomodes table
gr_table:
dw 0x112+0100000000000000b , 640 , 480 ; 1
dw 0x115+0100000000000000b , 800 , 600 ; 2
dw 0x118+0100000000000000b , 1024 , 768 ; 3
dw 0x11B+0100000000000000b , 1280 , 1024 ; 4
dw 0x112 , 640 , 480 ; 5
dw 0x115 , 800 , 600 ; 6
dw 0x118 , 1024 , 768 ; 7
dw 0x11B , 1280 ,1024 ; 8
dw 0x13, 640, 480 ; 9
dw 0x12, 640, 480 ; 0
; table for move to extended memory (int 15h, ah=87h)
align 8
movedesc:
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0

View File

@ -0,0 +1,329 @@
keymap:
db '6',27
db '1234567890-=',8,9
db 'qwertyuiop[]',13
db '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
keymap_shift:
db '6',27
db '!@#$%^&*()_+',8,9
db 'QWERTYUIOP{}',13
db '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
keymap_alt:
db ' ',27
db ' @ $ {[]}\ ',8,9
db ' ',13
db ' ',0,' ',0,'4',0,' '
db ' ',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
boot_memdetect db 'Determining amount of memory',0
boot_fonts db 'Fonts loaded',0
boot_tss db 'Setting TSSs',0
boot_cpuid db 'Reading CPUIDs',0
boot_devices db 'Detecting devices',0
boot_timer db 'Setting timer',0
boot_irqs db 'Reprogramming IRQs',0
boot_setmouse db 'Setting mouse',0
boot_windefs db 'Setting window defaults',0
boot_bgr db 'Calculating background',0
boot_resirqports db 'Reserving IRQs & ports',0
boot_setrports db 'Setting addresses for IRQs',0
boot_setostask db 'Setting OS task',0
boot_allirqs db 'Unmasking all IRQs',0
boot_tsc db 'Reading TSC',0
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_mtrr db 'Setting MTRR',0
boot_tasking db 'All set - press ESC to start',0
new_process_loading db 'K : New Process - loading',13,10,0
new_process_running db 'K : New Process - done',13,10,0
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
msg_unresolved db 'unresolved ',0
msg_module db 'in module ',0
msg_version db 'incompatible driver version',13,10,0
msg_www db 'please visit www.kolibrios.org',13,10,0
msg_CR db 13,10,0
intel_str db "GenuineIntel",0
AMD_str db "AuthenticAMD",0
;szSound db 'SOUND',0
;szInfinity db 'INFINITY',0
szHwMouse db 'ATI2D',0
szSTART db 'START',0
szEXPORTS db 'EXPORTS',0
szIMPORTS db 'IMPORTS',0
firstapp db '/rd/1/LAUNCHER',0
char db 'FONTS/CHAR.MT',0
char2 db 'FONTS/CHAR2.MT',0
bootpath db '/KOLIBRI '
bootpath2 db 0
vmode db 'drivers/VMODE.MDR',0
vrr_m db '/rd/1/VRR_M',0
; mike.dld {
db 0
dd servetable-0x10000
draw_line dd __sys_draw_line
disable_mouse dd __sys_disable_mouse
draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar
drawbar dd __sys_drawbar.forced
;//mike.dld, 2006-08-02 ]
putpixel dd __sys_putpixel
; } mike.dld
align 4
keyboard dd 1
sound_dma dd 1
syslang dd 1
boot_y dd 10
if __DEBUG__ eq 1
include_debug_strings
end if
IncludeIGlobals
align 16
gdts:
dw gdte-$-1
dd gdts
dw 0
; Attention! The order first four selectors not to change, is used in Fast System Call
; must be : os_code, os_data, app_code, app_data, ....
int_code_l:
os_code_l:
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10011010b
db 0x00
int_data_l:
os_data_l:
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10010010b
db 0x00
app_code_l:
dw 0xFFFF
dw 0
db 0
db cpl3
dw G32+D32+0x8000+0x7;
app_data_l:
dw 0xFFFF
dw 0
db 0
db drw3
dw G32+D32+0x8000+0x7;
; --------------- APM ---------------------
apm_code_32:
dw 0x0f ; limit 64kb
db 0, 0, 0
dw 11010000b *256 +10011010b
db 0x00
apm_code_16:
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10011010b
db 0x00
apm_data_16:
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10010010b
db 0x00
; -----------------------------------------
graph_data_l:
dw 0x7ff
dw 0x0000
db 0x00
dw 11010000b *256 +11110010b
db 0x00
endofcode:
tss0_l:
rq (max_processes+10)
gdte:
align 16
cur_saved_data rb 4096
fpu_data: rb 512
; device irq owners
irq_owner rd 16 ; process id
; on irq read ports
irq00read rd 16
irq01read rd 16
irq02read rd 16
irq03read rd 16
irq04read rd 16
irq05read rd 16
irq06read rd 16
irq07read rd 16
irq08read rd 16
irq09read rd 16
irq10read rd 16
irq11read rd 16
irq12read rd 16
irq13read rd 16
irq14read rd 16
irq15read rd 16
irq_tab rd 16
mem_block_map rb 512
event_map rb 64
mem_block_list rd 64
mem_block_mask rd 2
mem_used.fd rd 1
mem_used.bk rd 1
mem_block_arr rd 1
mem_block_start rd 1
mem_block_end rd 1
heap_mutex rd 1
heap_size rd 1
heap_free rd 1
heap_blocks rd 1
free_blocks rd 1
mst MEM_STATE
page_start rd 1
page_end rd 1
events rd 1
event_start rd 1
event_end rd 1
event_uid rd 1
sys_page_map rd 1
os_stack rd 1
srv.fd rd 1
srv.bk rd 1
scr_width rd 1
scr_height rd 1
create_cursor rd 1
set_hw_cursor rd 1
hw_restore rd 1
def_cursor rd 1
hw_cursor rd 1
cur_def_interl rd 1
cur_saved_base rd 1
cur_saved_interl rd 1
cur_saved_w rd 1
cur_saved_h rd 1
ipc_tmp rd 1
ipc_pdir rd 1
ipc_ptab rd 1
proc_mem_map rd 1
proc_mem_pdir rd 1
proc_mem_tab rd 1
tmp_task_pdir rd 1
tmp_task_ptab rd 1
LFBSize rd 1
stall_mcs rd 1
; status
hd1_status rd 1 ; 0 - free : other - pid
application_table_status rd 1 ; 0 - free : other - pid
; device addresses
mididp rd 1
midisp rd 1
cdbase rd 1
cdid rd 1
hdbase rd 1 ; for boot 0x1f0
hdid rd 1
hdpos rd 1 ; for boot 0x1
fat32part rd 1 ; for boot 0x1
sb16 rd 1
;CPUID information
cpu_vendor rd 3
cpu_sign rd 1
cpu_info rd 1
cpu_caps rd 4
pg_data PG_DATA
heap_test rd 1
buttontype rd 1
windowtypechanged rd 1
hd_entries rd 1 ;unused ? 0xfe10
;* start code - Mario79
mouse_pause rd 1
MouseTickCounter rd 1
ps2_mouse_detected rb 1
com1_mouse_detected rb 1
com2_mouse_detected rb 1
;* end code - Mario79
wraw_bacground_select rb 1
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled
pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled
IncludeUGlobals

View File

@ -17,7 +17,7 @@ Detect_COM_Mouse:
mov eax,4 mov eax,4
shl eax,2 shl eax,2
mov [irq_owner+eax],byte 1 mov [irq_owner+eax], 1
inc dword [RESERVED_PORTS] inc dword [RESERVED_PORTS]
mov edi,[RESERVED_PORTS] mov edi,[RESERVED_PORTS]
@ -39,7 +39,7 @@ Detect_COM_Mouse:
mov eax,3 mov eax,3
shl eax,2 shl eax,2
mov [irq_owner+eax],byte 1 mov [irq_owner+eax], 1
inc dword [RESERVED_PORTS] inc dword [RESERVED_PORTS]
mov edi,[RESERVED_PORTS] mov edi,[RESERVED_PORTS]

View File

@ -12,24 +12,24 @@ FindHDD:
mov [DiskNumber],0 mov [DiskNumber],0
call FindHDD_3 call FindHDD_3
; mov ax,[Sector512+176] ; mov ax,[Sector512+176]
; mov [0x40006],ax ; mov [DRIVE_DATA+6],ax
; mov ax,[Sector512+126] ; mov ax,[Sector512+126]
; mov [0x40008],ax ; mov [DRIVE_DATA+8],ax
; mov ax,[Sector512+128] ; mov ax,[Sector512+128]
; mov [0x40008],ax ; mov [DRIVE_DATA+8],ax
mov [DiskNumber],1 mov [DiskNumber],1
call FindHDD_3 call FindHDD_3
; mov al,[Sector512+176] ; mov al,[Sector512+176]
; mov [0x40007],al ; mov [DRIVE_DATA+7],al
inc [ChannelNumber] inc [ChannelNumber]
mov [DiskNumber],0 mov [DiskNumber],0
call FindHDD_3 call FindHDD_3
; mov al,[Sector512+176] ; mov al,[Sector512+176]
; mov [0x40008],al ; mov [DRIVE_DATA+8],al
mov [DiskNumber],1 mov [DiskNumber],1
call FindHDD_1 call FindHDD_1
; mov al,[Sector512+176] ; mov al,[Sector512+176]
; mov [0x40009],al ; mov [DRIVE_DATA+9],al
jmp EndFindHDD jmp EndFindHDD
@ -41,7 +41,7 @@ FindHDD_1:
ja FindHDD_2 ja FindHDD_2
cmp [Sector512+12],word 255 cmp [Sector512+12],word 255
ja FindHDD_2 ja FindHDD_2
inc byte [0x40001] inc byte [DRIVE_DATA+1]
jmp FindHDD_2_2 jmp FindHDD_2_2
FindHDD_2: FindHDD_2:
call DeviceReset call DeviceReset
@ -50,14 +50,14 @@ FindHDD_1:
call ReadCD_ID call ReadCD_ID
cmp [DevErrorCode],0 cmp [DevErrorCode],0
jne FindHDD_2_2 jne FindHDD_2_2
inc byte [0x40001] inc byte [DRIVE_DATA+1]
inc byte [0x40001] inc byte [DRIVE_DATA+1]
FindHDD_2_2: FindHDD_2_2:
ret ret
FindHDD_3: FindHDD_3:
call FindHDD_1 call FindHDD_1
shl byte [0x40001],2 shl byte [DRIVE_DATA+1],2
ret ret
@ -84,7 +84,7 @@ ReadHDD_ID:
cmp [DevErrorCode],0 ;ïðîâåðèòü êîä îøèáêè cmp [DevErrorCode],0 ;ïðîâåðèòü êîä îøèáêè
jne @@End ;çàêîí÷èòü, ñîõðàíèâ êîä îøèáêè jne @@End ;çàêîí÷èòü, ñîõðàíèâ êîä îøèáêè
mov DX,[ATABasePortAddr] mov DX,[ATABasePortAddr]
add DX,7 ;адрес регистра состояния add DX,7 ;àäðåñ ðåãèñòðà ñîñòîÿíè
mov ecx,0xffff mov ecx,0xffff
@@WaitCompleet: @@WaitCompleet:
; Ïðîâåðèòü âðåìÿ âûïîëíåíèÿ êîìàíäû ; Ïðîâåðèòü âðåìÿ âûïîëíåíèÿ êîìàíäû
@ -191,7 +191,7 @@ SendCommandToHDD:
; mov eax,[timer_ticks] ; mov eax,[timer_ticks]
; mov [TickCounter_1],eax ; mov [TickCounter_1],eax
@@WaitHDReady: @@WaitHDReady:
; Проверить время ожидания ; Ïðîâåðèòü âðåìÿ îæèäàíè
dec ecx dec ecx
cmp ecx,0 cmp ecx,0
je @@Err1 je @@Err1
@ -199,7 +199,7 @@ SendCommandToHDD:
; sub eax,[TickCounter_1] ; sub eax,[TickCounter_1]
; cmp eax,300 ;îæèäàòü 300 òèêîâ ; cmp eax,300 ;îæèäàòü 300 òèêîâ
; ja @@Err1 ;îøèáêà òàéì-àóòà ; ja @@Err1 ;îøèáêà òàéì-àóòà
; Прочитать регистр состояния ; Ïðî÷èòàòü ðåãèñòð ñîñòîÿíè
in AL,DX in AL,DX
; Ïðîâåðèòü ñîñòîÿíèå ñèãíàëà BSY ; Ïðîâåðèòü ñîñòîÿíèå ñèãíàëà BSY
test AL,80h test AL,80h
@ -285,7 +285,7 @@ ReadCD_ID:
add DX,7 ;ïîðò 1õ7h add DX,7 ;ïîðò 1õ7h
mov ecx,0xffff mov ecx,0xffff
@@WaitCompleet_1: @@WaitCompleet_1:
; Проверить время ; Ïðîâåðèòü âðåì
dec ecx dec ecx
cmp ecx,0 cmp ecx,0
je @@Error1_1 ;îøèáêà òàéì-àóòà je @@Error1_1 ;îøèáêà òàéì-àóòà
@ -348,11 +348,11 @@ DeviceReset:
out DX,AL out DX,AL
mov ecx,0x80000 mov ecx,0x80000
@@WaitHDReady_1: @@WaitHDReady_1:
; Проверить время ожидания ; Ïðîâåðèòü âðåìÿ îæèäàíè
dec ecx dec ecx
cmp ecx,0 cmp ecx,0
je @@Err1_2 ;îøèáêà òàéì-àóòà je @@Err1_2 ;îøèáêà òàéì-àóòà
; Прочитать регистр состояния ; Ïðî÷èòàòü ðåãèñòð ñîñòîÿíè
in AL,DX in AL,DX
; Ïðîâåðèòü ñîñòîÿíèå ñèãíàëà BSY ; Ïðîâåðèòü ñîñòîÿíèå ñèãíàëà BSY
test AL,80h test AL,80h

View File

@ -3,9 +3,9 @@
; è çàíåñåíèå äàííûõ â îáëàñòü òàáëèöû ; è çàíåñåíèå äàííûõ â îáëàñòü òàáëèöû
; àâòîð Mario79 ; àâòîð Mario79
;**************************************************** ;****************************************************
mov [transfer_adress],0x4000a mov [transfer_adress],DRIVE_DATA+0xa
search_partitions_ide0: search_partitions_ide0:
test [0x40001],byte 0x40 test [DRIVE_DATA+1],byte 0x40
jz search_partitions_ide1 jz search_partitions_ide1
mov [hdbase],0x1f0 mov [hdbase],0x1f0
mov [hdid],0x0 mov [hdid],0x0
@ -15,14 +15,14 @@
call set_FAT32_variables call set_FAT32_variables
cmp [problem_partition],0 cmp [problem_partition],0
jne search_partitions_ide1 jne search_partitions_ide1
inc byte [0x40002] inc byte [DRIVE_DATA+2]
call partition_data_transfer call partition_data_transfer
add [transfer_adress],100 add [transfer_adress],100
inc [fat32part] inc [fat32part]
jmp search_partitions_ide0_1 jmp search_partitions_ide0_1
search_partitions_ide1: search_partitions_ide1:
test [0x40001],byte 0x10 test [DRIVE_DATA+1],byte 0x10
jz search_partitions_ide2 jz search_partitions_ide2
mov [hdbase],0x1f0 mov [hdbase],0x1f0
mov [hdid],0x10 mov [hdid],0x10
@ -32,14 +32,14 @@
call set_FAT32_variables call set_FAT32_variables
cmp [problem_partition],0 cmp [problem_partition],0
jne search_partitions_ide2 jne search_partitions_ide2
inc byte [0x40003] inc byte [DRIVE_DATA+3]
call partition_data_transfer call partition_data_transfer
add [transfer_adress],100 add [transfer_adress],100
inc [fat32part] inc [fat32part]
jmp search_partitions_ide1_1 jmp search_partitions_ide1_1
search_partitions_ide2: search_partitions_ide2:
test [0x40001],byte 0x4 test [DRIVE_DATA+1],byte 0x4
jz search_partitions_ide3 jz search_partitions_ide3
mov [hdbase],0x170 mov [hdbase],0x170
mov [hdid],0x0 mov [hdid],0x0
@ -49,14 +49,14 @@
call set_FAT32_variables call set_FAT32_variables
cmp [problem_partition],0 cmp [problem_partition],0
jne search_partitions_ide3 jne search_partitions_ide3
inc byte [0x40004] inc byte [DRIVE_DATA+4]
call partition_data_transfer call partition_data_transfer
add [transfer_adress],100 add [transfer_adress],100
inc [fat32part] inc [fat32part]
jmp search_partitions_ide2_1 jmp search_partitions_ide2_1
search_partitions_ide3: search_partitions_ide3:
test [0x40001],byte 0x1 test [DRIVE_DATA+1],byte 0x1
jz end_search_partitions_ide jz end_search_partitions_ide
mov [hdbase],0x170 mov [hdbase],0x170
mov [hdid],0x10 mov [hdid],0x10
@ -66,7 +66,7 @@
call set_FAT32_variables call set_FAT32_variables
cmp [problem_partition],0 cmp [problem_partition],0
jne end_search_partitions_ide jne end_search_partitions_ide
inc byte [0x40005] inc byte [DRIVE_DATA+5]
call partition_data_transfer call partition_data_transfer
add [transfer_adress],100 add [transfer_adress],100
inc [fat32part] inc [fat32part]

View File

@ -389,8 +389,8 @@ choice_necessity_partition:
choice_necessity_partition_1: choice_necessity_partition_1:
mov ecx,[hdpos] mov ecx,[hdpos]
xor eax,eax xor eax,eax
mov [0xfe10], eax ; entries in hd cache mov [hd_entries], eax ; entries in hd cache
mov edx,0x40002 mov edx,DRIVE_DATA+2
search_partition_array: search_partition_array:
mov bl,[edx] mov bl,[edx]
movzx ebx,bl movzx ebx,bl
@ -402,7 +402,7 @@ choice_necessity_partition_1:
dec eax dec eax
xor edx,edx xor edx,edx
imul eax,100 imul eax,100
add eax,0x4000a add eax,DRIVE_DATA+0xa
mov [transfer_adress],eax mov [transfer_adress],eax
call partition_data_transfer_1 call partition_data_transfer_1
ret ret

View File

@ -427,7 +427,7 @@ fs_OnHd:
mov [hdpos], eax mov [hdpos], eax
cmp ecx, 0x100 cmp ecx, 0x100
jae .nf jae .nf
cmp cl, [0x40001+eax] cmp cl, [DRIVE_DATA+eax]
jbe @f jbe @f
.nf: .nf:
call free_hd_channel call free_hd_channel
@ -503,7 +503,7 @@ fs_OnCd:
jae .nf jae .nf
push ecx ebx push ecx ebx
mov cl,al mov cl,al
mov bl,[0x40001] mov bl,[DRIVE_DATA+1]
shr bl,cl shr bl,cl
test bl,2 test bl,2
pop ebx ecx pop ebx ecx

View File

@ -10,8 +10,8 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
; edi 1 force ; edi 1 force
pushad pushad
call [disable_mouse]
call [disable_mouse]
mov ebp, ecx ; ebp=pointer to text mov ebp, ecx ; ebp=pointer to text
mov ecx, ebx ; ecx=color mov ecx, ebx ; ecx=color
movsx ebx, ax ; ebx=y movsx ebx, ax ; ebx=y

View File

@ -516,7 +516,7 @@ display_settings:
repos_windows: repos_windows:
mov ecx,[TASK_COUNT] mov ecx,[TASK_COUNT]
mov edi,0x20*2 mov edi, OS_BASE+0x20*2
mov byte[REDRAW_BACKGROUND],1 mov byte[REDRAW_BACKGROUND],1
dec ecx dec ecx
jge @f jge @f
@ -537,6 +537,7 @@ repos_windows:
neg eax neg eax
mov [edi+WDATA.box.height],eax mov [edi+WDATA.box.height],eax
.lp1: .lp1:
call set_window_clientbox call set_window_clientbox
add edi,0x20 add edi,0x20
loop @b loop @b

View File

@ -100,6 +100,7 @@ save_draw_mouse:
mov ecx, [ScreenWidth] mov ecx, [ScreenWidth]
inc ecx inc ecx
mul ecx mul ecx
movzx edx, byte [display_data+ebx+eax] movzx edx, byte [display_data+ebx+eax]
shl edx, 8 shl edx, 8
mov ecx, [edx+SLOT_BASE+APPDATA.cursor] mov ecx, [edx+SLOT_BASE+APPDATA.cursor]
@ -320,9 +321,10 @@ yes_mouse_disable:
disable_m: disable_m:
cmp dword [MOUSE_VISIBLE],dword 0 cmp dword [MOUSE_VISIBLE],dword 0
jne no_mouse_disable jne no_mouse_disable
pushf
cli cli
call draw_mouse_under call draw_mouse_under
sti popf
mov [MOUSE_VISIBLE],dword 1 mov [MOUSE_VISIBLE],dword 1
no_mouse_disable: no_mouse_disable:
popad popad
@ -350,9 +352,10 @@ __sys_draw_pointer:
mov [MOUSE_VISIBLE], dword 0 mov [MOUSE_VISIBLE], dword 0
movzx ebx,word [MOUSE_Y] movzx ebx,word [MOUSE_Y]
movzx eax,word [MOUSE_X] movzx eax,word [MOUSE_X]
pushfd
cli cli
call save_draw_mouse call save_draw_mouse
sti popfd
nodmu2: nodmu2:
popad popad
ret ret
@ -367,10 +370,11 @@ chms00:
jne redrawmouse jne redrawmouse
jmp nodmp jmp nodmp
redrawmouse: redrawmouse:
pushfd
cli cli
call draw_mouse_under call draw_mouse_under
call save_draw_mouse call save_draw_mouse
sti popfd
nodmp: nodmp:
popad popad
ret ret

View File

@ -0,0 +1,271 @@
MEM_WB equ 6 ;write-back memory
MEM_WC equ 1 ;write combined memory
MEM_UC equ 0 ;uncached memory
tmp_page_tab equ 0x1000000 ; HEAP_BASE
align 4
proc mem_test
mov eax, cr0
and eax, not (CR0_CD+CR0_NW)
or eax, CR0_CD ;disable caching
mov cr0, eax
wbinvd ;invalidate cache
xor edi, edi
mov ebx, 'TEST'
@@:
add edi, 0x400000
xchg ebx, dword [edi]
cmp dword [edi], 'TEST'
xchg ebx, dword [edi]
je @b
mov [MEM_AMOUNT-OS_BASE], edi
and eax, not (CR0_CD+CR0_NW) ;enable caching
mov cr0, eax
mov eax, edi
ret
endp
align 4
proc init_mem
mov eax, [MEM_AMOUNT-OS_BASE]
mov [pg_data.mem_amount-OS_BASE], eax
mov [pg_data.kernel_max-OS_BASE], eax
shr eax, 12
mov edx, eax
mov [pg_data.pages_count-OS_BASE], eax
mov [pg_data.kernel_pages-OS_BASE], eax
shr eax, 3
mov [pg_data.pagemap_size-OS_BASE], eax
shr edx, 10
cmp edx, 3
ja @f
inc edx ;at least 4Mb for kernel heap
@@:
mov [pg_data.kernel_tables-OS_BASE], edx
xor eax, eax
mov edi, sys_pgdir-OS_BASE
mov ecx, 2048
cld
rep stosd
mov edx, sys_pgdir-OS_BASE
; bt [cpu_caps], CAPS_PSE
; jnc .no_PSE
mov ebx, cr4
or ebx, CR4_PSE
mov eax, PG_LARGE+PG_SW
bt [cpu_caps-OS_BASE], CAPS_PGE
jnc @F
or eax, PG_GLOBAL
or ebx, CR4_PGE
@@:
mov cr4, ebx
sub [pg_data.kernel_tables-OS_BASE], 2
mov [edx], eax
mov [edx+16], eax
add eax, 0x00400000
mov [edx+4], eax
mov [edx+20], eax
add eax, 0x00400000
mov [edx+8], eax
mov [edx+24], eax
add eax, 0x00400000
mov [edx+12], eax
mov [edx+28], eax
add edx, 32
add eax, 0x00400000
; mov eax, 0x800000+PG_SW
; mov ecx, (HEAP_BASE-0x800000)/4096
; jmp .map_low
;.no_PSE:
; mov eax, PG_SW
; mov ecx, HEAP_BASE/4096
;.map_low:
mov edi, tmp_page_tab
;@@: ;
; stosd
; add eax, 0x1000
; dec ecx
; jnz @B
mov ecx, [pg_data.kernel_tables-OS_BASE]
shl ecx, 10
xor eax, eax
rep stosd
mov ecx, [pg_data.kernel_tables-OS_BASE]
mov eax, tmp_page_tab+PG_SW
mov edi, edx
.map_kernel_tabs:
stosd
add eax, 0x1000
dec ecx
jnz .map_kernel_tabs
mov dword [sys_pgdir-OS_BASE+(page_tabs shr 20)], sys_pgdir+PG_SW-OS_BASE
ret
endp
align 4
proc init_page_map
mov edi, sys_pgmap-OS_BASE
mov ecx, (HEAP_BASE/4096)/32 ;384/4
mov ebx, ecx
xor eax,eax
cld
rep stosd
not eax
mov ecx, [pg_data.pagemap_size-OS_BASE]
sub ecx, ebx
shr ecx, 2
rep stosd
lea edi, [sys_pgmap-OS_BASE+ebx*4] ;+384
mov edx, [pg_data.pages_count-OS_BASE]
mov ecx, [pg_data.kernel_tables-OS_BASE]
add ecx, (HEAP_BASE/4096) and 31
sub edx, HEAP_BASE/4096
sub edx, ecx
mov [pg_data.pages_free-OS_BASE], edx
xor eax, eax
mov ebx, ecx
shr ecx, 5
rep stosd
not eax
mov ecx, ebx
and ecx, 31
shl eax, cl
add edi, OS_BASE
mov [page_start-OS_BASE], edi; sys_pgmap+384
stosd
mov ebx, sys_pgmap
add ebx, [pg_data.pagemap_size-OS_BASE]
mov [page_end-OS_BASE], ebx
mov [pg_data.pg_mutex-OS_BASE], 0
ret
endp
align 4
proc test_cpu
locals
cpu_type dd ?
cpu_id dd ?
cpu_Intel dd ?
cpu_AMD dd ?
endl
mov [cpu_type], 0
xor eax, eax
mov [cpu_caps-OS_BASE], eax
mov [cpu_caps+4-OS_BASE], eax
pushfd
pop eax
mov ecx, eax
xor eax, 0x40000
push eax
popfd
pushfd
pop eax
xor eax, ecx
mov [cpu_type], CPU_386
jz .end_cpuid
push ecx
popfd
mov [cpu_type], CPU_486
mov eax, ecx
xor eax, 0x200000
push eax
popfd
pushfd
pop eax
xor eax, ecx
je .end_cpuid
mov [cpu_id], 1
xor eax, eax
cpuid
mov [cpu_vendor-OS_BASE], ebx
mov [cpu_vendor+4-OS_BASE], edx
mov [cpu_vendor+8-OS_BASE], ecx
cmp ebx, dword [intel_str-OS_BASE]
jne .check_AMD
cmp edx, dword [intel_str+4-OS_BASE]
jne .check_AMD
cmp ecx, dword [intel_str+8-OS_BASE]
jne .check_AMD
mov [cpu_Intel], 1
cmp eax, 1
jl .end_cpuid
mov eax, 1
cpuid
mov [cpu_sign-OS_BASE], eax
mov [cpu_info-OS_BASE], ebx
mov [cpu_caps-OS_BASE], edx
mov [cpu_caps+4-OS_BASE],ecx
shr eax, 8
and eax, 0x0f
ret
.end_cpuid:
mov eax, [cpu_type]
ret
.check_AMD:
cmp ebx, dword [AMD_str-OS_BASE]
jne .unknown
cmp edx, dword [AMD_str+4-OS_BASE]
jne .unknown
cmp ecx, dword [AMD_str+8-OS_BASE]
jne .unknown
mov [cpu_AMD], 1
cmp eax, 1
jl .unknown
mov eax, 1
cpuid
mov [cpu_sign-OS_BASE], eax
mov [cpu_info-OS_BASE], ebx
mov [cpu_caps-OS_BASE], edx
mov [cpu_caps+4-OS_BASE],ecx
shr eax, 8
and eax, 0x0f
ret
.unknown:
mov eax, 1
cpuid
mov [cpu_sign-OS_BASE], eax
mov [cpu_info-OS_BASE], ebx
mov [cpu_caps-OS_BASE], edx
mov [cpu_caps+4-OS_BASE],ecx
shr eax, 8
and eax, 0x0f
ret
endp

View File

@ -15,19 +15,17 @@ include "kglobals.inc"
include "lang.inc" include "lang.inc"
include "const.inc" include "const.inc"
max_processes equ 255
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
;WinMapAddress equ 0x460000
;display_data = 0x460000
max_processes equ 255 os_data equ os_data_l-gdts ; GDTs
os_code equ os_code_l-gdts
graph_data equ 3+graph_data_l-gdts
tss0 equ tss0_l-gdts
app_code equ 3+app_code_l-gdts
app_data equ 3+app_data_l-gdts
;window_data equ 0x0000
;tss_data equ 0xD20000
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
;draw_data equ 0xC00000
;sysint_stack_data equ 0xC03000
;twdw equ (0x3000-window_data)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
@ -63,39 +61,24 @@ use16
org 0x0 org 0x0
jmp start_of_code jmp start_of_code
; mike.dld { version db 'Kolibri OS version 0.6.5.0 ',13,10,13,10,0
org $+0x10000
db 0
dd servetable-0x10000
draw_line dd __sys_draw_line
disable_mouse dd __sys_disable_mouse
draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar
drawbar dd __sys_drawbar.forced
;//mike.dld, 2006-08-02 ]
putpixel dd __sys_putpixel
; } mike.dld
version db 'Kolibri OS version 0.6.5.0 ',13,10,13,10,0
;dd endofcode-0x10000
;db 'Boot02'
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
include "boot/preboot.inc" include "boot/preboot.inc"
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
preboot_lfb db 0 if lang eq en
preboot_bootlog db 0 include "boot/booteng.inc" ; english system boot messages
else if lang eq ru
include "boot/bootru.inc" ; russian system boot messages
include "boot/ru.inc" ; Russian font
else if lang eq et
include "boot/bootet.inc" ; estonian system boot messages
include "boot/et.inc" ; Estonian font
else
include "boot/bootge.inc" ; german system boot messages
end if
include "boot/bootcode.inc" ; 16 bit system boot code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; include "bus/pci/pci16.inc"
;; ;;
;; 16 BIT INCLUDED FILES ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include "kernel16.inc"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
@ -103,17 +86,6 @@ include "kernel16.inc"
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
os_data = os_data_l-gdts ; GDTs
os_code = os_code_l-gdts
int_code equ int_code_l-gdts
int_data equ int_data_l-gdts
tss0sys equ tss0sys_l-gdts
graph_data equ 3+graph_data_l-gdts
tss0 equ tss0_l-gdts
app_code equ 3+app_code_l-gdts
app_data equ 3+app_data_l-gdts
; CR0 Flags - Protected mode and Paging ; CR0 Flags - Protected mode and Paging
@ -121,7 +93,7 @@ app_data equ 3+app_data_l-gdts
; Enabling 32 bit protected mode ; Enabling 32 bit protected mode
sidt [cs:old_ints_h-0x10000] ; sidt [cs:old_ints_h-0x10000]
cli ; disable all irqs cli ; disable all irqs
cld cld
@ -143,195 +115,162 @@ app_data equ 3+app_data_l-gdts
jnz l.7 jnz l.7
mov al, 0xFF mov al, 0xFF
out 0x64, al out 0x64, al
lgdt [cs:gdts-0x10000] ; Load GDT
mov eax, cr0 ; Turn on paging // protected mode lgdt [cs:tmp_gdt] ; Load GDT
mov eax, cr0 ; protected mode
or eax, ecx or eax, ecx
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled and eax, 10011111b *65536*256 + 0xffffff ; caching enabled
mov cr0, eax mov cr0, eax
jmp $+2
org $+0x10000
mov ax,os_data ; Selector for os
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
mov esp,0x3ec00 ; Set stack
jmp pword os_code:B32 ; jmp to enable 32 bit mode jmp pword os_code:B32 ; jmp to enable 32 bit mode
if gdte >= $ align 8
error 'GDT overlaps with used code!' tmp_gdt:
end if
dw 23
dd tmp_gdt+0x10000
dw 0
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10011010b
db 0x00
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10010010b
db 0x00
include "data16.inc"
use32 use32
org $+0x10000
include 'unpacker.inc' align 4
B32:
mov ax,os_data ; Selector for os
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
mov esp,0x3ec00 ; Set stack
; CLEAR 0x280000 - HEAP_BASE
xor eax,eax
mov edi,0x280000
mov ecx,(HEAP_BASE-0x280000) / 4
cld
rep stosd
mov edi,0x40000
mov ecx,(0x90000-0x40000)/4
rep stosd
; CLEAR KERNEL UNDEFINED GLOBALS
mov edi, endofcode-OS_BASE
mov ecx, (uglobals_size/4)+4
rep stosd
; SAVE & CLEAR 0-0xffff
xor esi, esi
mov edi,0x2F0000
mov ecx,0x10000 / 4
rep movsd
xor edi, edi
mov ecx,0x10000 / 4
rep stosd
call test_cpu
bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc
; MEMORY MODEL
call mem_test
call init_mem
call init_page_map
; ENABLE PAGING
mov eax, sys_pgdir-OS_BASE
mov cr3, eax
mov eax,cr0
or eax,CR0_PG
mov cr0,eax
lgdt [gdts]
jmp pword os_code:high_code
__DEBUG__ fix 1 __DEBUG__ fix 1
__DEBUG_LEVEL__ fix 1 __DEBUG_LEVEL__ fix 1
include 'fdo.inc' include 'fdo.inc'
include 'init.inc'
iglobal include "boot/shutdown.inc" ; shutdown or restart
boot_memdetect db 'Determining amount of memory',0
boot_fonts db 'Fonts loaded',0
boot_tss db 'Setting TSSs',0
boot_cpuid db 'Reading CPUIDs',0
boot_devices db 'Detecting devices',0
boot_timer db 'Setting timer',0
boot_irqs db 'Reprogramming IRQs',0
boot_setmouse db 'Setting mouse',0
boot_windefs db 'Setting window defaults',0
boot_bgr db 'Calculating background',0
boot_resirqports db 'Reserving IRQs & ports',0
boot_setrports db 'Setting addresses for IRQs',0
boot_setostask db 'Setting OS task',0
boot_allirqs db 'Unmasking all IRQs',0
boot_tsc db 'Reading TSC',0
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_mtrr db 'Setting MTRR',0
boot_tasking db 'All set - press ESC to start',0
endg
iglobal
boot_y dd 10
endg
boot_log:
pushad
mov eax,10*65536
mov ax,word [boot_y]
add [boot_y],dword 10
mov ebx,0x80ffffff ; ASCIIZ string with white color
mov ecx,esi
mov edi,1
call dtext
mov [novesachecksum],1000
call checkVga_N13
cmp [preboot_blogesc],byte 1
je .bll2
cmp esi,boot_tasking
jne .bll2
; begin ealex 04.08.05
; in al,0x61
; and al,01111111b
; out 0x61,al
; end ealex 04.08.05
.bll1: in al,0x60 ; wait for ESC key press
cmp al,129
jne .bll1
.bll2: popad
ret
iglobal
firstapp db '/rd/1/LAUNCHER',0
char db 'FONTS/CHAR.MT',0
char2 db 'FONTS/CHAR2.MT',0
bootpath db '/KOLIBRI '
bootpath2 db 0
vmode db 'drivers/VMODE.MDR',0
vrr_m db '/rd/1/VRR_M',0
endg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; org OS_BASE+$
;; ;;
;; 32 BIT ENTRY ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 4 align 4
high_code:
mov ax,os_data
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
add esp, OS_BASE
B32: mov dword [sys_pgdir], 0
; CLEAR 0x280000-0xF00000 mov dword [sys_pgdir+4], 0
mov dword [sys_pgdir+8], 0
mov dword [sys_pgdir+12], 0
xor eax,eax mov eax, sys_pgdir-OS_BASE
mov edi,0x280000 mov cr3, eax
mov ecx,(0x100000*0xF-0x280000) / 4
cld
rep stosd
; CLEAR 0x80000-0x90000
; xor eax,eax
mov edi,0x80000
mov ecx,(0x90000-0x80000)/4
; cld
rep stosd
; CLEAR KERNEL UNDEFINED GLOBALS
mov edi, endofcode
mov ecx, (uglobals_size/4)+4
rep stosd
; SAVE & CLEAR 0-0xffff
mov esi,0x0000
mov edi,0x2F0000
mov ecx,0x10000 / 4
cld
rep movsd
xor eax,eax
mov edi,0
mov ecx,0x10000 / 4
cld
rep stosd
; SAVE REAL MODE VARIABLES ; SAVE REAL MODE VARIABLES
mov ax, [0x2f0000 + 0x9031] mov ax, [BOOT_VAR + 0x9031]
mov [IDEContrRegsBaseAddr], ax mov [IDEContrRegsBaseAddr], ax
; --------------- APM --------------------- ; --------------- APM ---------------------
mov eax, [0x2f0000 + 0x9040] ; entry point ; mov eax, [BOOT_VAR + 0x9040] ; entry point
mov dword[apm_entry], eax ; mov dword[apm_entry], eax
mov word [apm_entry + 4], apm_code_32 - gdts ; mov word [apm_entry + 4], apm_code_32 - gdts
mov eax, [0x2f0000 + 0x9044] ; version & flags mov eax, [BOOT_VAR + 0x9044] ; version & flags
mov [apm_vf], eax mov [apm_vf], eax
; ----------------------------------------- ; -----------------------------------------
; movzx eax,byte [0x2f0000+0x9010] ; mouse port ; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port
; mov [0xF604],byte 1 ;al ; mov [0xF604],byte 1 ;al
mov al, [0x2F0000+0x901F] ; DMA writing mov al, [BOOT_VAR+0x901F] ; DMA writing
mov [allow_dma_write], al mov [allow_dma_write], al
mov al,[0x2f0000+0x9000] ; bpp mov al,[BOOT_VAR+0x9000] ; bpp
mov [ScreenBPP],al mov [ScreenBPP],al
movzx eax,word [0x2f0000+0x900A] ; X max movzx eax,word [BOOT_VAR+0x900A] ; X max
dec eax dec eax
mov [ScreenWidth],eax mov [ScreenWidth],eax
mov [screen_workarea.right],eax mov [screen_workarea.right],eax
movzx eax,word [0x2f0000+0x900C] ; Y max movzx eax,word [BOOT_VAR+0x900C] ; Y max
dec eax dec eax
mov [ScreenHeight],eax mov [ScreenHeight],eax
mov [screen_workarea.bottom],eax mov [screen_workarea.bottom],eax
movzx eax,word [0x2f0000+0x9008] ; screen mode movzx eax,word [BOOT_VAR+0x9008] ; screen mode
mov [SCR_MODE],eax mov [SCR_MODE],eax
mov eax,[0x2f0000+0x9014] ; Vesa 1.2 bnk sw add mov eax,[BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
mov [BANK_SWITCH],eax mov [BANK_SWITCH],eax
mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine
cmp [SCR_MODE],word 0x13 ; 320x200 cmp [SCR_MODE],word 0x13 ; 320x200
je @f je @f
cmp [SCR_MODE],word 0x12 ; VGA 640x480 cmp [SCR_MODE],word 0x12 ; VGA 640x480
je @f je @f
mov ax,[0x2f0000+0x9001] ; for other modes mov ax,[BOOT_VAR+0x9001] ; for other modes
mov [BytesPerScanLine],ax mov [BytesPerScanLine],ax
@@: @@:
; GRAPHICS ADDRESSES ; GRAPHICS ADDRESSES
;mov eax,0x100000*8 ; LFB address mov byte [BOOT_VAR+0x901e],0x0
;cmp [0xfe0c],word 0x13 mov eax,[BOOT_VAR+0x9018]
;je no_d_lfb
;cmp [0xfe0c],word 0x12
;je no_d_lfb
;cmp [0x2f0000+0x901e],byte 1
;jne no_d_lfb
mov byte [0x2f0000+0x901e],0x0
mov eax,[0x2f0000+0x9018]
;no_d_lfb:
mov [LFBAddress],eax mov [LFBAddress],eax
cmp [SCR_MODE],word 0100000000000000b cmp [SCR_MODE],word 0100000000000000b
@ -339,39 +278,28 @@ B32:
cmp [SCR_MODE],word 0x13 cmp [SCR_MODE],word 0x13
je v20ga32 je v20ga32
mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2 mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2
mov [0xe024],dword Vesa12_getpixel24 mov [GETPIXEL],dword Vesa12_getpixel24
cmp [ScreenBPP],byte 24 cmp [ScreenBPP],byte 24
jz ga24 jz ga24
mov [PUTPIXEL],dword Vesa12_putpixel32 mov [PUTPIXEL],dword Vesa12_putpixel32
mov [0xe024],dword Vesa12_getpixel32 mov [GETPIXEL],dword Vesa12_getpixel32
ga24: ga24:
jmp v20ga24 jmp v20ga24
setvesa20: setvesa20:
mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0 mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0
mov [0xe024],dword Vesa20_getpixel24 mov [GETPIXEL],dword Vesa20_getpixel24
cmp [ScreenBPP],byte 24 cmp [ScreenBPP],byte 24
jz v20ga24 jz v20ga24
v20ga32: v20ga32:
mov [PUTPIXEL],dword Vesa20_putpixel32 mov [PUTPIXEL],dword Vesa20_putpixel32
mov [0xe024],dword Vesa20_getpixel32 mov [GETPIXEL],dword Vesa20_getpixel32
v20ga24: v20ga24:
cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480 cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480
jne no_mode_0x12 jne no_mode_0x12
mov [PUTPIXEL],dword VGA_putpixel mov [PUTPIXEL],dword VGA_putpixel
mov [0xe024],dword Vesa20_getpixel32 mov [GETPIXEL],dword Vesa20_getpixel32
no_mode_0x12: no_mode_0x12:
call test_cpu
; btr [cpu_caps], CAPS_SSE ;test: dont't use sse code
; btr [cpu_caps], CAPS_SSE2 ;test: don't use sse2
; btr [cpu_caps], CAPS_FXSR ;test: disable sse support
;all sse commands rise #UD exption
; btr [cpu_caps], CAPS_PSE ;test: don't use large pages
; btr [cpu_caps], CAPS_PGE ;test: don't use global pages
; btr [cpu_caps], CAPS_MTRR ;test: don't use MTRR
bts [cpu_caps], CAPS_TSC ;force use rdtsc
; -------- Fast System Call init ---------- ; -------- Fast System Call init ----------
; Intel SYSENTER/SYSEXIT (AMD CPU support it too) ; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
bt [cpu_caps], CAPS_SEP bt [cpu_caps], CAPS_SEP
@ -415,26 +343,13 @@ B32:
.noSYSCALL: .noSYSCALL:
; ----------------------------------------- ; -----------------------------------------
; MEMORY MODEL
call mem_test
call init_mtrr
call init_mem
call init_page_map
; ENABLE PAGING
mov eax, sys_pgdir
mov cr3, eax
mov eax,cr0
or eax,CR0_PG
mov cr0,eax
call init_kernel_heap call init_kernel_heap
stdcall kernel_alloc, 0x2000 stdcall kernel_alloc, 0x2000
mov [os_stack], eax mov [os_stack], eax
mov [LFBSize], 0x800000
call init_mtrr
call init_LFB call init_LFB
call init_fpu call init_fpu
@ -511,7 +426,7 @@ include 'vmodeld.inc'
mov esi,char mov esi,char
xor ebx,ebx xor ebx,ebx
mov ecx,2560;26000 mov ecx,2560
mov edx,FONT_I mov edx,FONT_I
call fs_RamdiskRead call fs_RamdiskRead
@ -552,14 +467,13 @@ include 'vmodeld.inc'
call build_scheduler ; sys32.inc call build_scheduler ; sys32.inc
; LOAD IDT ; LOAD IDT
lidt [cs:idtreg] lidt [idtreg]
cli
mov esi,boot_devices mov esi,boot_devices
call boot_log call boot_log
call detect_devices call detect_devices
; TIMER SET TO 1/100 S ; TIMER SET TO 1/100 S
mov esi,boot_timer mov esi,boot_timer
call boot_log call boot_log
@ -628,8 +542,6 @@ include 'vmodeld.inc'
mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0 mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0
mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0 mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0
mov ebx, [def_cursor]
mov dword [SLOT_BASE+256+APPDATA.cursor], ebx mov dword [SLOT_BASE+256+APPDATA.cursor], ebx
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
@ -637,6 +549,8 @@ include 'vmodeld.inc'
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
; task list ; task list
mov [CURRENT_TASK],dword 1
mov [TASK_COUNT],dword 1
mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
mov [TASK_DATA+TASKDATA.pid], 1 ; process id number mov [TASK_DATA+TASKDATA.pid], 1 ; process id number
mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address
@ -667,9 +581,11 @@ include 'vmodeld.inc'
ltr ax ltr ax
call init_cursors call init_cursors
mov eax, [def_cursor]
mov [SLOT_BASE+APPDATA.cursor],eax
mov [SLOT_BASE+APPDATA.cursor+256],eax
; READ TSC / SECOND
; READ TSC / SECOND
mov esi,boot_tsc mov esi,boot_tsc
call boot_log call boot_log
@ -720,10 +636,8 @@ include 'vmodeld.inc'
call load_skin call load_skin
; LOAD FIRST APPLICATION ; LOAD FIRST APPLICATION
mov [CURRENT_TASK],dword 1
mov [TASK_COUNT],dword 1
cli cli
cmp byte [0x2f0000+0x9030],1 cmp byte [BOOT_VAR+0x9030],1
jne no_load_vrr_m jne no_load_vrr_m
mov ebp, vrr_m mov ebp, vrr_m
@ -748,7 +662,6 @@ first_app_found:
;mov [TASK_COUNT],dword 2 ;mov [TASK_COUNT],dword 2
mov [CURRENT_TASK],dword 1 ; set OS task fisrt mov [CURRENT_TASK],dword 1 ; set OS task fisrt
; SET KEYBOARD PARAMETERS ; SET KEYBOARD PARAMETERS
mov al, 0xf6 ; reset keyboard, scan enabled mov al, 0xf6 ; reset keyboard, scan enabled
call kb_write call kb_write
@ -815,6 +728,43 @@ first_app_found:
; Fly :) ; Fly :)
include 'unpacker.inc'
align 4
boot_log:
pushad
mov eax,10*65536
mov ax,word [boot_y]
add [boot_y],dword 10
mov ebx,0x80ffffff ; ASCIIZ string with white color
mov ecx,esi
mov edi,1
call dtext
mov [novesachecksum],1000
call checkVga_N13
cmp [preboot_blogesc+OS_BASE+0x10000],byte 1
je .bll2
cmp esi,boot_tasking
jne .bll2
; begin ealex 04.08.05
; in al,0x61
; and al,01111111b
; out 0x61,al
; end ealex 04.08.05
.bll1: in al,0x60 ; wait for ESC key press
cmp al,129
jne .bll1
.bll2: popad
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ; ; ;
; MAIN OS LOOP START ; ; MAIN OS LOOP START ;
@ -918,13 +868,14 @@ reserve_irqs_ports:
pushad pushad
mov [irq_owner+4*0],byte 1 ; timer mov [irq_owner+4*0], 1 ; timer
mov [irq_owner+4*1],byte 1 ; keyboard mov [irq_owner+4*1], 1 ; keyboard
mov [irq_owner+4*5],byte 1 ; sound blaster mov [irq_owner+4*5], 1 ; sound blaster
mov [irq_owner+4*6],byte 1 ; floppy diskette mov [irq_owner+4*6], 1 ; floppy diskette
mov [irq_owner+4*13],byte 1 ; math co-pros mov [irq_owner+4*13], 1 ; math co-pros
mov [irq_owner+4*14],byte 1 ; ide I mov [irq_owner+4*14], 1 ; ide I
mov [irq_owner+4*15],byte 1 ; ide II mov [irq_owner+4*15], 1 ; ide II
; movzx eax,byte [0xf604] ; mouse irq ; movzx eax,byte [0xf604] ; mouse irq
; dec eax ; dec eax
; add eax,mouseirqtable ; add eax,mouseirqtable
@ -1017,10 +968,10 @@ set_variables:
; mov [MOUSE_X],dword 100*65536+100 ; mouse x/y ; mov [MOUSE_X],dword 100*65536+100 ; mouse x/y
push eax push eax
mov ax,[0x2f0000+0x900c] mov ax,[BOOT_VAR+0x900c]
shr ax,1 shr ax,1
shl eax,16 shl eax,16
mov ax,[0x2f0000+0x900A] mov ax,[BOOT_VAR+0x900A]
shr ax,1 shr ax,1
mov [MOUSE_X],eax mov [MOUSE_X],eax
pop eax pop eax
@ -1031,7 +982,7 @@ set_variables:
;!! IP 04.02.2005: ;!! IP 04.02.2005:
mov [next_usage_update], 100 mov [next_usage_update], 100
mov byte [0xFFFF], 0 ; change task if possible mov byte [DONT_SWITCH], 0 ; change task if possible
ret ret
@ -1929,7 +1880,7 @@ sys_system:
ret ret
sysfn_shutdown: ; 18.1 = BOOT sysfn_shutdown: ; 18.1 = BOOT
mov [0x2f0000+0x9030],byte 0 mov [BOOT_VAR+0x9030],byte 0
for_shutdown_parameter: for_shutdown_parameter:
mov eax,[TASK_COUNT] mov eax,[TASK_COUNT]
@ -2053,7 +2004,7 @@ sysfn_shutdown_param: ; 18.9 = system shutdown with param
jl exit_for_anyone jl exit_for_anyone
cmp ebx,4 cmp ebx,4
jg exit_for_anyone jg exit_for_anyone
mov [0x2f0000+0x9030],bl mov [BOOT_VAR+0x9030],bl
jmp for_shutdown_parameter jmp for_shutdown_parameter
sysfn_minimize: ; 18.10 = minimize window sysfn_minimize: ; 18.10 = minimize window
@ -2798,7 +2749,7 @@ draw_window_caption:
mov ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption] mov ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption]
or ecx,ecx or ecx,ecx
jz @f jz @f
add ecx,[edi+twdw+TASKDATA.mem_start] add ecx,[edi+CURRENT_TASK+TASKDATA.mem_start]
movzx eax,[edi+window_data+WDATA.fl_wstyle] movzx eax,[edi+window_data+WDATA.fl_wstyle]
and al,0x0F and al,0x0F
@ -4755,7 +4706,7 @@ syscall_getpixel: ; GetPixel
div ecx div ecx
mov ebx,edx mov ebx,edx
xchg eax,ebx xchg eax,ebx
call dword [0xe024] call dword [GETPIXEL]
mov [esp+36],ecx mov [esp+36],ecx
ret ret
@ -4920,162 +4871,8 @@ undefined_syscall: ; Undefined system call
mov [esp+36],dword -1 mov [esp+36],dword -1
ret ret
include "data32.inc"
;clear_busy_flag_at_caller:
; push edi
; mov edi,[CURRENT_TASK] ; restore processes tss pointer in gdt, busyfl?
; imul edi,8
; mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
; pop edi
; ret
keymap:
db '6',27
db '1234567890-=',8,9
db 'qwertyuiop[]',13
db '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
keymap_shift:
db '6',27
db '!@#$%^&*()_+',8,9
db 'QWERTYUIOP{}',13
db '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 '
db '@234567890123',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
keymap_alt:
db ' ',27
db ' @ $ {[]}\ ',8,9
db ' ',13
db ' ',0,' ',0,'4',0,' '
db ' ',180,178,184,'6',176,'7'
db 179,'8',181,177,183,185,182
db 'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
; device irq owners
uglobal
irq_owner: ; process id
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
dd 0x0
endg
; on irq read ports
uglobal
irq00read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq01read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq02read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq03read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq04read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq05read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq06read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq07read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq08read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq09read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq10read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq11read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq12read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq13read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq14read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
irq15read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
endg
; status
uglobal
hd1_status dd 0x0 ; 0 - free : other - pid
application_table_status dd 0x0 ; 0 - free : other - pid
endg
; device addresses
uglobal
mididp dd 0x0
midisp dd 0x0
cdbase dd 0x0
cdid dd 0x0
hdbase dd 0x0 ; for boot 0x1f0
hdid dd 0x0
hdpos dd 0x0 ; for boot 0x1
fat32part dd 0x0 ; for boot 0x1
;part2_ld dd 0x0
;* start code - Mario79
mouse_pause dd 0
MouseTickCounter dd 0
ps2_mouse_detected db 0
com1_mouse_detected db 0
com2_mouse_detected db 0
;* end code - Mario79
wraw_bacground_select db 0
lba_read_enabled dd 0x0 ; 0 = disabled , 1 = enabled
pci_access_enabled dd 0x0 ; 0 = disabled , 1 = enabled
sb16 dd 0x0
buttontype dd 0x0
windowtypechanged dd 0x0
align 4
cpu_caps dd 4 dup(0)
pg_data PG_DATA
heap_test dd ?
endg
iglobal
keyboard dd 0x1
sound_dma dd 0x1
syslang dd 0x1
endg
if __DEBUG__ eq 1
include_debug_strings
end if
IncludeIGlobals
endofcode:
IncludeUGlobals
uglobals_size = $ - endofcode uglobals_size = $ - endofcode
diff16 "end of kernel code",0,$ diff16 "end of kernel code",0,$

View File

@ -238,8 +238,6 @@ include "gui/button.inc"
; shutdown ; shutdown
include "boot/shutdown.inc" ; shutdown or restart
; file system ; file system
include "fs/fs.inc" ; syscall include "fs/fs.inc" ; syscall

View File

@ -72,10 +72,10 @@ SOCKET_INTERFACE equ 53
; 128KB allocated for the stack and network driver buffers and other ; 128KB allocated for the stack and network driver buffers and other
; data requirements ; data requirements
stack_data_start equ 0x700000 ;stack_data_start equ 0x700000
eth_data_start equ 0x700000 ;eth_data_start equ 0x700000
stack_data equ 0x704000 ;stack_data equ 0x704000
stack_data_end equ 0x71ffff ;stack_data_end equ 0x71ffff
; 32 bit word ; 32 bit word
stack_config equ stack_data stack_config equ stack_data
@ -123,7 +123,7 @@ last_1hsTick equ queueList + ( 2 * NUMQUEUEENTRIES )
resendQ equ 0x770000 ;resendQ equ 0x770000
resendBuffer equ resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP resendBuffer equ resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP

View File

@ -18,7 +18,7 @@ SB16_play_music equ 0xc0000001
DMAPage equ 0x2A DMAPage equ 0x2A
Rate equ 44100 Rate equ 44100
SB16Buffer equ 0x2A0000 SB16Buffer equ 0x2A0000
SB16_Status equ SB16Buffer+65536 ;SB16_Status equ SB16Buffer+65536
iglobal iglobal
sound_data_format dd 0x1 sound_data_format dd 0x1

View File

@ -444,6 +444,7 @@ proc init_cursors
stdcall load_driver, szHwMouse stdcall load_driver, szHwMouse
mov [hw_cursor], eax mov [hw_cursor], eax
test eax, eax test eax, eax
jz .sw_mouse jz .sw_mouse

View File

@ -38,7 +38,7 @@
getpixel: getpixel:
push eax ebx edx edi push eax ebx edx edi
call dword [0xe024] call dword [GETPIXEL]
pop edi edx ebx eax pop edi edx ebx eax
ret ret

View File

@ -13,11 +13,11 @@
; LOAD VIDEOMODE DRIVER ; LOAD VIDEOMODE DRIVER
; If vmode.mdr file not found ; If vmode.mdr file not found
or eax,-1 ; Driver ID = -1 (not present in system) or eax,-1 ; Driver ID = -1 (not present in system)
mov [0x760000],eax ; mov [OS_BASE+0x760000],eax ;
mov [0x760100],byte 0xC3 ; Instruction RETN - driver loop mov [OS_BASE+0x760100],byte 0xC3 ; Instruction RETN - driver loop
mov esi, vmode mov esi, vmode
xor ebx, ebx xor ebx, ebx
mov ecx, 0x8000 ; size of memory area for driver mov ecx, 0x8000 ; size of memory area for driver
mov edx, 0x760000 ; Memory position of driver mov edx, OS_BASE+0x760000 ; Memory position of driver
call fs_RamdiskRead call fs_RamdiskRead