From 9140ef0cce8cb0e977894e3174cbc768007d4774 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Mon, 5 Mar 2007 20:56:42 +0000 Subject: [PATCH] not flat yet git-svn-id: svn://kolibrios.org@388 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/flat_kernel/blkdev/fdc.inc | 4 +- kernel/branches/flat_kernel/blkdev/hd_drv.inc | 72 +- kernel/branches/flat_kernel/boot/bootcode.inc | 638 ++++-------------- kernel/branches/flat_kernel/boot/bootru.inc | 4 +- kernel/branches/flat_kernel/boot/preboot.inc | 2 +- kernel/branches/flat_kernel/boot/rdload.inc | 20 +- kernel/branches/flat_kernel/boot/shutdown.inc | 8 +- kernel/branches/flat_kernel/const.inc | 19 +- kernel/branches/flat_kernel/core/dll.inc | 18 - kernel/branches/flat_kernel/core/memory.inc | 476 +++---------- kernel/branches/flat_kernel/core/sys32.inc | 1 + kernel/branches/flat_kernel/core/taskman.inc | 8 - kernel/branches/flat_kernel/data16.inc | 41 ++ kernel/branches/flat_kernel/data32.inc | 329 +++++++++ .../branches/flat_kernel/detect/commouse.inc | 4 +- .../branches/flat_kernel/detect/dev_hdcd.inc | 38 +- .../branches/flat_kernel/detect/sear_par.inc | 22 +- kernel/branches/flat_kernel/fs/fs.inc | 6 +- kernel/branches/flat_kernel/fs/fs_lfn.inc | 4 +- kernel/branches/flat_kernel/gui/font.inc | 2 +- kernel/branches/flat_kernel/gui/window.inc | 3 +- kernel/branches/flat_kernel/hid/mousedrv.inc | 10 +- kernel/branches/flat_kernel/init.inc | 271 ++++++++ kernel/branches/flat_kernel/kernel.asm | 613 ++++++----------- kernel/branches/flat_kernel/kernel32.inc | 2 - kernel/branches/flat_kernel/network/stack.inc | 10 +- kernel/branches/flat_kernel/sound/sb16.inc | 2 +- kernel/branches/flat_kernel/video/cursors.inc | 1 + kernel/branches/flat_kernel/video/vesa20.inc | 2 +- kernel/branches/flat_kernel/vmodeld.inc | 10 +- 30 files changed, 1188 insertions(+), 1452 deletions(-) create mode 100644 kernel/branches/flat_kernel/data16.inc create mode 100644 kernel/branches/flat_kernel/data32.inc create mode 100644 kernel/branches/flat_kernel/init.inc diff --git a/kernel/branches/flat_kernel/blkdev/fdc.inc b/kernel/branches/flat_kernel/blkdev/fdc.inc index 1a1efd6e67..b2263d96d7 100644 --- a/kernel/branches/flat_kernel/blkdev/fdc.inc +++ b/kernel/branches/flat_kernel/blkdev/fdc.inc @@ -9,7 +9,7 @@ uglobal endg fdc_init: ;start with clean tracks. - mov edi,0xD201 + mov edi,OS_BASE+0xD201 mov al,0 mov ecx,160 rep stosb @@ -22,7 +22,7 @@ fdc_filesave: ;ebx: cluster to be saved. mov bl,18 div bl mov ah,0 - add eax,0xD201 + add eax,OS_BASE+0xD201 mov [eax],byte 1 ;This track is now dirty. popa ret diff --git a/kernel/branches/flat_kernel/blkdev/hd_drv.inc b/kernel/branches/flat_kernel/blkdev/hd_drv.inc index 46a3551fde..e1e6881db7 100755 --- a/kernel/branches/flat_kernel/blkdev/hd_drv.inc +++ b/kernel/branches/flat_kernel/blkdev/hd_drv.inc @@ -25,7 +25,7 @@ hd_read: push ecx esi edi ; scan cache mov ecx,cache_max ; entries in cache - mov esi,0x600000+8 + mov esi,OS_BASE+0x600000+8 mov edi,1 hdreadcache: @@ -54,7 +54,7 @@ hd_read: call hd_read_pio @@: - lea esi,[edi*8+0x600000] + lea esi,[edi*8+OS_BASE+0x600000] mov [esi],eax ; sector number mov dword [esi+4],1 ; hd read - mark as same as in hd @@ -62,7 +62,7 @@ hd_read: mov esi,edi shl esi,9 - add esi,0x600000+65536 + add esi,OS_BASE+0x600000+65536 mov edi,ebx mov ecx,512/4 cld @@ -77,7 +77,7 @@ hd_read_pio: call wait_for_hd_idle cmp [hd_error],0 - jne hd_read_error + jne hd_read_error cli xor eax,eax @@ -115,7 +115,7 @@ hd_read_pio: cli push edi shl edi,9 - add edi,0x600000+65536 + add edi,OS_BASE+0x600000+65536 mov ecx,256 mov edx,[hdbase] cld @@ -126,7 +126,7 @@ hd_read_pio: pop edx eax ret -disable_ide_int: +disable_ide_int: ; mov edx,[hdbase] ; add edx,0x206 ; mov al,2 @@ -153,7 +153,7 @@ hd_write: ; check if the cache already has the sector and overwrite it mov ecx,cache_max - mov esi,0x600000+8 + mov esi,OS_BASE+0x600000+8 mov edi,1 hdwritecache: @@ -178,7 +178,7 @@ hd_write: cmp [hd_error],0 jne hd_write_access_denied - lea esi,[edi*8+0x600000] + lea esi,[edi*8+OS_BASE+0x600000] mov [esi],eax ; sector number yes_in_cache_write: @@ -186,7 +186,7 @@ hd_write: mov dword [esi+4],2 ; write - differs from hd shl edi,9 - add edi,0x600000+65536 + add edi,OS_BASE+0x600000+65536 mov esi,ebx mov ecx,512/4 cld @@ -205,7 +205,7 @@ write_cache: ; write difference ( 2 ) from cache to hd mov ecx,cache_max - mov esi,0x600000+8 + mov esi,OS_BASE+0x600000+8 mov edi,1 write_cache_more: @@ -323,7 +323,7 @@ cache_write_pio: ; cli mov esi,edi 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 edx,[hdbase] cld @@ -357,7 +357,7 @@ find_empty_slot: 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 dec ecx jnz search_for_empty @@ -378,7 +378,7 @@ align 4 clear_hd_cache: push eax ecx edi - mov edi,0x600000 + mov edi,OS_BASE+0x600000 mov ecx,16384 xor eax,eax cld @@ -484,7 +484,7 @@ wait_for_hd_idle: in al,dx test al,128 jnz wfhil1 - + @@: pop edx eax @@ -574,7 +574,7 @@ iglobal align 4 ; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary IDE_descriptor_table: - dd 284000h + dd OS_BASE+284000h dw 2000h dw 8000h @@ -607,16 +607,16 @@ hdd_irq14: out dx, al call update_counters mov ebx, [dma_process] - cmp [0x3000], ebx + cmp [CURRENT_TASK], ebx jz .noswitch mov [dma_task_switched], 1 mov edi, [dma_slot_ptr] - mov eax, [0x3000] + mov eax, [CURRENT_TASK] mov [dma_process], eax - mov eax, [0x3010] + mov eax, [TASK_BASE] mov [dma_slot_ptr], eax - mov [0x3000], ebx - mov [0x3010], edi + mov [CURRENT_TASK], ebx + mov [TASK_BASE], edi mov byte [0xFFFF], 1 call do_change_task .noswitch: @@ -638,16 +638,16 @@ hdd_irq15: out dx, al call update_counters mov ebx, [dma_process] - cmp [0x3000], ebx + cmp [CURRENT_TASK], ebx jz .noswitch mov [dma_task_switched], 1 mov edi, [dma_slot_ptr] - mov eax, [0x3000] + mov eax, [CURRENT_TASK] mov [dma_process], eax - mov eax, [0x3010] + mov eax, [TASK_BASE] mov [dma_slot_ptr], eax - mov [0x3000], ebx - mov [0x3010], edi + mov [CURRENT_TASK], ebx + mov [TASK_BASE], edi mov byte [0xFFFF], 1 call do_change_task .noswitch: @@ -668,11 +668,11 @@ hd_read_dma: mov eax, [esp+4] sub eax, [dma_cur_sector] shl eax, 9 - add eax, 0x284000 + add eax, OS_BASE+0x284000 push ecx esi edi mov esi, eax shl edi, 9 - add edi, 0x610000 + add edi, OS_BASE+0x610000 mov ecx, 512/4 cld rep movsd @@ -681,9 +681,9 @@ hd_read_dma: pop eax ret .notread: - mov eax, IDE_descriptor_table - mov dword [eax], 0x284000 - mov word [eax+4], 0x2000 + mov eax, IDE_descriptor_table-OS_BASE + mov dword [eax+OS_BASE], 0x284000 + mov word [eax+4+OS_BASE], 0x2000 mov dx, [IDEContrRegsBaseAddr] cmp [hdbase], 0x1F0 jz @f @@ -734,9 +734,9 @@ hd_read_dma: @@: mov al, 9 out dx, al - mov eax, [0x3000] + mov eax, [CURRENT_TASK] mov [dma_process], eax - mov eax, [0x3010] + mov eax, [TASK_BASE] mov [dma_slot_ptr], eax cmp [hdbase], 0x1F0 jnz .ide1 @@ -766,7 +766,7 @@ write_cache_chain: mov eax, IDE_descriptor_table mov edx, [cache_chain_pos] shl edx, 9 - add edx, 0x610000 + add edx, OS_BASE+0x610000 mov [eax], edx movzx edx, [cache_chain_size] shl edx, 9 @@ -777,7 +777,7 @@ write_cache_sector: mov eax, IDE_descriptor_table mov edx, edi shl edx, 9 - add edx, 0x610000 + add edx, OS_BASE+0x610000 mov [eax], edx mov word [eax+4], 0x200 do_write_dma: @@ -832,9 +832,9 @@ do_write_dma: @@: mov al, 1 out dx, al - mov eax, [0x3000] + mov eax, [CURRENT_TASK] mov [dma_process], eax - mov eax, [0x3010] + mov eax, [TASK_BASE] mov [dma_slot_ptr], eax cmp [hdbase], 0x1F0 jnz .ide1 diff --git a/kernel/branches/flat_kernel/boot/bootcode.inc b/kernel/branches/flat_kernel/boot/bootcode.inc index 6684bcd9b1..6cfb6ed43c 100644 --- a/kernel/branches/flat_kernel/boot/bootcode.inc +++ b/kernel/branches/flat_kernel/boot/bootcode.inc @@ -7,127 +7,12 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - ;========================================================================== ; ; 16 BIT FUNCTIONS ; ;========================================================================== -; 16-bit data - org $+0x10000 - -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 32 - -; GDT TABLE - -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 - -tss0_l: -; times (max_processes+10) dd 0,0 -gdte = $ + (max_processes+10)*8 - -; 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) - 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 - org $-0x10000 putchar: ; in: al=character @@ -155,72 +40,6 @@ printplain: popa ret -; Now int 16 is used for keyboard support. -; This is shorter, simpler and more reliable. -if 0 -getkey: push ecx - push edx - add ebx,0x0101 - xor eax,eax - - gk1: - in al,0x60 - mov cl,al - gk0: - in al,0x60 - cmp al,cl - je gk0 - cmp ax,11 - jg gk0 - gk0_1: - mov cl,al - -; add al,47 -; mov [ds:keyinbs-0x10000],al -; mov si,keyinbs-0x10000 -; call printplain - - gk12: - in al,0x60 - cmp al,cl - je gk12 - cmp ax,240 - jne gk13 - mov al,cl - jmp gk14 - gk13: - add cl,128 - cmp al,cl - jne gk1 - sub al,128 - gk14: - - movzx edx,bl - cmp eax,edx - jb gk1 - movzx edx,bh - cmp eax,edx - jg gk1 - test ebx,0x010000 - jnz gk3 - mov cx,0x1000 - mov dx,cx - add eax,47 - mov cx,ax - cmp cx,58 - jb gk_nozero - sub cx,10 - gk_nozero: - mov [ds:keyin-0x10000],cl - mov si,keyin-0x10000 - call printplain - gk3: - sub eax,48 - pop edx - pop ecx - ret -end if - getkey: ; get number in range [bl,bh] (bl,bh in ['0'..'9']) ; in: bx=range @@ -253,17 +72,6 @@ macro _setcursor row,column call setcursor } -;pagetable_set: -;eax - physical address -;es:di - page table -;ecx - number of pages to map -; or al, 7 -;@@: -; stosd -; add eax, 1000h -; loop @b -; ret - boot_read_floppy: push si xor si, si @@ -276,7 +84,7 @@ boot_read_floppy: inc si cmp si, 10 jb @b - mov si, badsect-0x10000 + mov si, badsect sayerr_plain: call printplain jmp $ @@ -296,8 +104,8 @@ start_of_code: ; \begin{diamond}[02.12.2005] cmp ax, 'KL' jnz @f - mov word [cs:cfgmanager.loader_block-0x10000], si - mov word [cs:cfgmanager.loader_block+2-0x10000], ds + mov word [cs:cfgmanager.loader_block], si + mov word [cs:cfgmanager.loader_block+2], ds @@: ; \end{diamond}[02.12.2005] @@ -317,14 +125,14 @@ start_of_code: if lang eq ru ; Load & set russian VGA font (RU.INC) - mov bp,RU_FNT1-10000h ; RU_FNT1 - First part - mov bx,1000h ; 768 bytes - mov cx,30h ; 48 symbols - mov dx,80h ; 128 - position of first symbol + mov bp, RU_FNT1 ; RU_FNT1 - First part + mov bx,1000h ; 768 bytes + mov cx,30h ; 48 symbols + mov dx,80h ; 128 - position of first symbol mov ax,1100h - int 10h + int 10h - mov bp,RU_FNT2-10000h ; RU_FNT2 -Second part + mov bp,RU_FNT2 ; RU_FNT2 -Second part mov bx,1000h ; 512 bytes mov cx,20h ; 32 symbols mov dx,0E0h ; 224 - position of first symbol @@ -332,7 +140,7 @@ if lang eq ru int 10h ; End set VGA russian font else if lang eq et - mov bp,ET_FNT-10000h ; ET_FNT1 + mov bp,ET_FNT ; ET_FNT1 mov bx,1000h ; mov cx,255 ; 256 symbols mov dx,0h ; 0 - position of first symbol @@ -344,23 +152,17 @@ end if push 0xb800 pop es xor di, di -; mov si,d80x25-0x10000 -; mov cx,80*25 -; mov ah,1*16+15 -; dfl1: -; lodsb -; stosw -; loop dfl1 mov ah, 1*16+15 + ; draw top - mov si, d80x25_top - 0x10000 + mov si, d80x25_top mov cx, d80x25_top_num * 80 @@: lodsb stosw loop @b ; draw spaces - mov si, space_msg - 0x10000 + mov si, space_msg mov cx, 25 - d80x25_top_num - d80x25_bottom_num dfl1: push cx @@ -374,14 +176,14 @@ dfl1: pop cx loop dfl1 ; draw bottom - mov si, d80x25_bottom - 0x10000 + mov si, d80x25_bottom mov cx, d80x25_bottom_num * 80 @@: lodsb stosw loop @b - mov byte [space_msg-0x10000+80], 0 ; now space_msg is null terminated + mov byte [space_msg+80], 0 ; now space_msg is null terminated _setcursor d80x25_top_num,0 @@ -401,73 +203,24 @@ dfl1: and dx,bx cmp ax,dx jnz cpugood - mov si,not386-0x10000 + mov si,not386 sayerr: call print jmp $ cpugood: + ; set up esp movzx esp, sp -; FLUSH 8042 KEYBOARD CONTROLLER - -;// mike.dld [ - ; mov al,0xED - ; out 0x60,al - ; or cx,-1 - ; @@: - ; in al,0x64 - ; test al,2 - ; jz @f - ; loop @b - ; @@: - ; mov al,0 - ; out 0x60,al - ; or cx,-1 - ; @@: - ; in al,0x64 - ; test al,2 - ; jz @f - ; loop @b - ; @@: -;// mike.dld ] - -; mov ecx,10000 -; fl1: -; in al,0x64 -; loop fl1 -; test al,1 -; jz fl2 -; in al,0x60 -; jmp fl1 -; fl2: - -;**************************************************************** -; The function is modified Mario79 -;***************************************************************** -; wait_kbd: ; variant 1 -; mov cx,2500h ;задержка порядка 10 мсек -; test_kbd: -; in al,64h ;читаем состояние клавиатуры -; test al,2 ;проверка бита готовности -; loopnz test_kbd - push 0 pop es and word [es:0x9031], 0 -; \begin{Mario79} -; find HDD IDE DMA PCI device -; check for PCI BIOS mov ax, 0xB101 int 0x1A jc .nopci cmp edx, 'PCI ' jnz .nopci -; find PCI class code -; class 1 = mass storage -; subclass 1 = IDE controller -; a) class 1, subclass 1, programming interface 0x80 mov ax, 0xB103 mov ecx, 1*10000h + 1*100h + 0x80 mov si, 0 ; device index = 0 @@ -522,10 +275,11 @@ wait_loop: ; variant 2 ; Write APM ver ---- and ax, 0xf0f add ax, '00' - mov si, msg_apm - 0x10000 + mov si, msg_apm mov [si + 5], ah mov [si + 7], al _setcursor 0, 3 + call printplain _setcursor d80x25_top_num,0 ; ------------------ @@ -536,26 +290,36 @@ wait_loop: ; variant 2 mov ax, 0x5303 ; Connect 32 bit mode interface xor bx, bx int 0x15 + + push 0 + pop es + + mov [es:0x9050], ax + mov [es:0x9052], cx + mov [es:0x9040], dx + + ; init selectors - movzx eax, ax ; real-mode segment base address of protected-mode 32-bit code segment - shl eax, 4 - mov [apm_code_32 - 0x10000 + 2], ax - shr eax, 16 - mov [apm_code_32 - 0x10000 + 4], al - movzx ecx, cx ; real-mode segment base address of protected-mode 16-bit code segment - shl ecx, 4 - mov [apm_code_16 - 0x10000 + 2], cx - shr ecx, 16 - mov [apm_code_16 - 0x10000 + 4], cl - movzx edx, dx ; real-mode segment base address of protected-mode 16-bit data segment - shl edx, 4 - mov [apm_data_16 - 0x10000 + 2], dx - shr edx, 16 - mov [apm_data_16 - 0x10000 + 4], dl - mov [es : 0x9040], ebx ; offset of APM entry point +; movzx eax, ax ; real-mode segment base address of protected-mode 32-bit code segment +; shl eax, 4 +; mov [dword apm_code_32 + 2], ax +; shr eax, 16 +; mov [dword apm_code_32 + 4], al +; movzx ecx, cx ; real-mode segment base address of protected-mode 16-bit code segment +; shl ecx, 4 +; mov [dword apm_code_16 + 2], cx +; shr ecx, 16 +; mov [dword apm_code_16 + 4], cl +; movzx edx, dx ; real-mode segment base address of protected-mode 16-bit data segment +; shl edx, 4 +; mov [dword apm_data_16 + 2], dx +; shr edx, 16 +; mov [dword apm_data_16 + 4], dl +; mov [es : 0x9040], ebx ; offset of APM entry point apm_end: ; ----------------------------------------- + ; DISPLAY VESA INFORMATION push 0 @@ -564,14 +328,14 @@ apm_end: mov di,0xa000 int 0x10 cmp ax,0x004f - mov si, novesa-0x10000 + mov si, novesa jnz @f mov bx, word [es:di+0x12] shl ebx,16 mov [es:0x9050], ebx mov ax,[es:di+4] add ax,'0'*256+'0' - mov si,vervesa-0x10000 + mov si,vervesa mov [si+vervesa_off], ah mov [si+vervesa_off+2], al @@: call print @@ -584,13 +348,13 @@ cfgmanager: ; b) preboot_dma_write = use DMA write? ; c) preboot_vrrm = use VRR? ; d) preboot_device = from what boot? - mov di, preboot_graph-0x10000 + mov di, preboot_graph ; check bootloader block - cmp [.loader_block-0x10000], -1 + cmp [.loader_block], -1 jz .noloaderblock - les bx, [.loader_block-0x10000] + les bx, [.loader_block] cmp byte [es:bx], 1 - mov si, loader_block_error-0x10000 + mov si, loader_block_error jnz sayerr test byte [es:bx+1], 1 jz @f @@ -601,11 +365,11 @@ cfgmanager: @@: .noloaderblock: ; determine default settings - mov [.bSettingsChanged-0x10000], 0 + mov [.bSettingsChanged], 0 cmp byte [di], 0 jnz .preboot_gr_end mov [di+preboot_gprobe-preboot_graph], 0 - mov al, [vervesa+vervesa_off-0x10000] + mov al, [vervesa+vervesa_off] cmp al, 'x' jz .novesa cmp al, '1' @@ -628,66 +392,66 @@ cfgmanager: cmp [di+preboot_device-preboot_graph], 1 adc [di+preboot_device-preboot_graph], 0 ; notify user - mov si, linef-0x10000 + mov si, linef call print - mov si, start_msg-0x10000 + mov si, start_msg call print - mov si, time_msg-0x10000 + mov si, time_msg call print ; get start time call .gettime - mov [.starttime-0x10000], eax - mov word [.timer-0x10000], .newtimer - mov word [.timer-0x10000+2], cs + mov [.starttime], eax + mov word [.timer], .newtimer + mov word [.timer+2], cs .printcfg: _setcursor 9,0 - mov si, current_cfg_msg-0x10000 + mov si, current_cfg_msg call print - mov si, curvideo_msg-0x10000 + mov si, curvideo_msg call print - mov al, [preboot_graph-0x10000] + mov al, [preboot_graph] cmp al, 8 ja .pnovesa mov dl, al and eax, 3 - mov si, [modes_msg-0x10000+eax*2] + mov si, [modes_msg+eax*2] call printplain - mov si, modevesa20-0x10000 + mov si, modevesa20 cmp dl, 4 jbe @f - mov si, modevesa12-0x10000 + mov si, modevesa12 @@: call printplain cmp dl, 4 ja .x - mov si, probeno_msg-0x10000 - cmp [preboot_gprobe-0x10000], 2 + mov si, probeno_msg + cmp [preboot_gprobe], 2 jnz @f - mov si, probeok_msg-0x10000 + mov si, probeok_msg @@: call printplain .x: jmp .c .pnovesa: cmp al, 9 - mov si, mode9-0x10000 + mov si, mode9 jz @b - mov si, mode10-0x10000 + mov si, mode10 jmp @b .c: - mov si, linef-0x10000 + mov si, linef call printplain - mov si, dma_msg-0x10000 - cmp [preboot_dma_write-0x10000], 1 + mov si, dma_msg + cmp [preboot_dma_write], 1 call .say_on_off - mov si, vrrm_msg-0x10000 - cmp [preboot_vrrm-0x10000], 1 + mov si, vrrm_msg + cmp [preboot_vrrm], 1 call .say_on_off - mov si, preboot_device_msg-0x10000 + mov si, preboot_device_msg call print - mov al, [preboot_device-0x10000] + mov al, [preboot_device] and eax, 3 - mov si, [preboot_device_msgs-0x10000+eax*2] + mov si, [preboot_device_msgs+eax*2] call printplain .wait: _setcursor 25,0 ; out of screen @@ -696,8 +460,8 @@ cfgmanager: push 0 pop es mov eax, [es:8*4] - mov [.oldtimer-0x10000], eax - mov eax, [.timer-0x10000] + mov [.oldtimer], eax + mov eax, [.timer] mov [es:8*4], eax sti ; wait for keypressed @@ -707,11 +471,11 @@ cfgmanager: ; restore timer interrupt push 0 pop es - mov eax, [.oldtimer-0x10000] + mov eax, [.oldtimer] mov [es:8*4], eax - mov [.timer-0x10000], eax + mov [.timer], eax _setcursor 7,0 - mov si, space_msg-0x10000 + mov si, space_msg call printplain pop ax ; switch on key @@ -727,15 +491,15 @@ cfgmanager: cmp al, 'd' jnz .wait _setcursor 15,0 - mov si,bdev-0x10000 + mov si,bdev call print mov bx,'13' call getkey - mov [preboot_device-0x10000], al + mov [preboot_device], al _setcursor 13,0 .d: - mov [.bSettingsChanged-0x10000], 1 - mov si, space_msg-0x10000 + mov [.bSettingsChanged], 1 + mov si, space_msg call printplain _setcursor 15,0 mov cx, 6 @@ -745,46 +509,46 @@ cfgmanager: jmp .printcfg .change_a: _setcursor 15,0 - mov si, gr_mode-0x10000 + mov si, gr_mode call printplain mov bx, '09' call getkey - mov [preboot_graph-0x10000], al + mov [preboot_graph], al cmp al, 4 ja @f - mov si, probetext-0x10000 + mov si, probetext call printplain mov bx, '12' call getkey - mov [preboot_gprobe-0x10000], al + mov [preboot_gprobe], al @@: _setcursor 10,0 jmp .d .change_b: _setcursor 15,0 - mov si, ask_dma-0x10000 + mov si, ask_dma call print mov bx, '12' call getkey - mov [preboot_dma_write-0x10000], al + mov [preboot_dma_write], al _setcursor 11,0 jmp .d .change_c: _setcursor 15,0 - mov si, vrrmprint-0x10000 + mov si, vrrmprint call print mov bx, '12' call getkey - mov [preboot_vrrm-0x10000], al + mov [preboot_vrrm], al _setcursor 12,0 jmp .d .say_on_off: pushf call print - mov si, on_msg-0x10000 + mov si, on_msg popf jz @f - mov si, off_msg-0x10000 + mov si, off_msg @@: call printplain ret ; novesa and vervesa strings are not used at the moment of executing this code @@ -794,10 +558,9 @@ virtual at novesa .bSettingsChanged db ? .timer dd ? end virtual - org $+0x10000 .loader_block dd -1 - org $-0x10000 .gettime: + mov ah, 0 int 1Ah xchg ax, cx @@ -809,10 +572,10 @@ end virtual push cs pop ds pushf - call [.oldtimer-0x10000] + call [.oldtimer] pushad call .gettime - sub eax, [.starttime-0x10000] + sub eax, [.starttime] sub ax, 18*5 jae .timergo neg ax @@ -829,12 +592,12 @@ if lang eq ru mov cl, 'г' jz @f mov cl, 'л' -@@: mov [time_str+9-0x10000], cl +@@: mov [time_str+9], cl else if lang eq et cmp al, 1 ja @f - mov [time_str+9-0x10000], ' ' - mov [time_str+10-0x10000],' ' + mov [time_str+9], ' ' + mov [time_str+10],' ' @@: else ; wait 5/4/3/2 seconds, 1 second @@ -842,11 +605,11 @@ else mov cl, 's' ja @f mov cl, ' ' -@@: mov [time_str+9-0x10000], cl +@@: mov [time_str+9], cl end if add al, '0' - mov [time_str+1-0x10000], al - mov si, time_msg-0x10000 + mov [time_str+1], al + mov si, time_msg _setcursor 7,0 call print _setcursor 25,0 @@ -856,31 +619,31 @@ end if .timergo: push 0 pop es - mov eax, [.oldtimer-0x10000] + mov eax, [.oldtimer] mov [es:8*4], eax mov sp, 0EC00h .continue: sti _setcursor 6,0 - mov si, space_msg-0x10000 + mov si, space_msg call printplain call printplain _setcursor 6,0 - mov si, loading_msg-0x10000 + mov si, loading_msg call print _setcursor 15,0 - cmp [.bSettingsChanged-0x10000], 0 + cmp [.bSettingsChanged], 0 jz .load - cmp [.loader_block-0x10000], -1 + cmp [.loader_block], -1 jz .load - les bx, [.loader_block-0x10000] + les bx, [.loader_block] mov eax, [es:bx+3] push ds pop es test eax, eax jz .load push eax - mov si, save_quest-0x10000 + mov si, save_quest call print .waityn: mov ah, 0 @@ -891,7 +654,7 @@ end if cmp al, 'y' jnz .waityn call putchar - mov byte [space_msg-0x10000+80], 186 + mov byte [space_msg+80], 186 pop eax push cs push .cont @@ -902,7 +665,7 @@ end if .cont: push cs pop ds - mov si, space_msg-0x10000 + mov si, space_msg mov byte [si+80], 0 _setcursor 15,0 call printplain @@ -912,12 +675,12 @@ end if ; ASK GRAPHICS MODE - movzx ax, [preboot_graph-0x10000] + movzx ax, [preboot_graph] push 0 pop es -; address is gr_table+6*(ax-1)-0x10000 +; address is gr_table+6*(ax-1) add ax, ax - lea si, [gr_table-0x10000 + eax + eax*2 - 6] + lea si, [gr_table + eax + eax*2 - 6] mov bx,[si+0] mov cx,[si+2] mov dx,[si+4] @@ -936,14 +699,14 @@ end if ; USE DEFAULTS OR PROBE ; bx - mode : cx - x size : dx - y size - cmp [preboot_gprobe-0x10000], 1 + cmp [preboot_gprobe], 1 jz noprobe mov bx,0x100 newprobe: inc bx cmp bx,0x17f - mov si,prnotfnd-0x10000 + mov si,prnotfnd jz sayerr probemore: @@ -990,12 +753,12 @@ end if mov [es:0x9000],al nov: cmp al,24 - mov si,bt24-0x10000 + mov si,bt24 jz bppl cmp al,32 - mov si,bt32-0x10000 + mov si,bt32 jz bppl - mov si,btns-0x10000 + mov si,btns jmp sayerr bppl: call print @@ -1024,108 +787,26 @@ end if ; DMA WRITE - mov al, [preboot_dma_write-0x10000] + mov al, [preboot_dma_write] mov [es:0x901F],al ; VRR_M USE - mov al,[preboot_vrrm-0x10000] + mov al,[preboot_vrrm] mov [es:0x9030],al - - -; MEMORY MODEL - -; movzx eax,byte [es:preboot_memory-0x10000] -; cmp eax,0 -; jne pre_mem -;;;;;;;;;;;;;;;;;;;;;;;;; -; mario79 - memory size ; -;;;;;;;;;;;;;;;;;;;;;;;;; -; mov ax,0E801h -;;; xor bx,bx ; thanks to Alexei for bugfix [18.07.2004] -; xor cx, cx -; xor dx, dx -; int 0x15 -; movzx ebx, dx ;bx -; movzx eax, cx ;ax -; shl ebx,6 ; перевод в килобайты (x64) -; add eax,ebx -; add eax, 1000h ;440h -; cmp eax,40000h ; 256? -; jge mem_256_z -; cmp eax,20000h ; 128? -; jge mem_128_z -; cmp eax,10000h ; 64? -; jge mem_64_z -; cmp eax,8000h ; 32? -; jge mem_32_z -; jmp mem_16_z -; -;mem_256_z: mov si,memokz256-0x10000 -; call printplain -; mov eax,5 -; jmp pre_mem -;mem_128_z: mov si,memokz128-0x10000 -; call printplain -; mov eax,4 -; jmp pre_mem -;mem_64_z: mov si,memokz64-0x10000 -; call printplain -; mov eax,3 -; jmp pre_mem -;mem_32_z: mov si,memokz32-0x10000 -; call printplain -; mov eax,2 -; jmp pre_mem -;mem_16_z: mov si,memokz16-0x10000 -; call printplain -; mov eax,1 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; pre_mem: -; push word 0x0000 -; pop es -; mov [es:0x9030],al -; push word 0x1000 -; pop es -; mov si,linef-0x10000 -; call printplain - - - - -; DIRECT WRITE TO LFB, PAGING DISABLED - -; movzx eax,byte [es:preboot_lfb-0x10000] -; mov eax,1 ; paging disabled -; cmp eax,0 -; jne pre_lfb -; mov si,gr_direct-0x10000 -; call printplain -; mov ebx,'12' -; call getkey -; pre_lfb: -; push word 0x0000 -; pop es -; mov [es:0x901E],al -; mov ax,0x1000 -; mov es,ax -; mov si,linef-0x10000 -; call printplain mov [es:0x901E],byte 1 - - ; BOOT DEVICE - mov al, [preboot_device-0x10000] + mov al, [preboot_device] dec al - mov [boot_dev-0x10000],al + mov [boot_dev],al ; READ DISKETTE TO MEMORY -; cmp [boot_dev-0x10000],0 +; cmp [boot_dev],0 jne no_sys_on_floppy - mov si,diskload-0x10000 + mov si,diskload call print xor ax, ax ; reset drive xor dx, dx @@ -1138,7 +819,7 @@ end if mov bx, 0xB000 ; es:bx -> data area call boot_read_floppy ; and copy them to extended memory - mov si, movedesc-0x10000 + mov si, movedesc mov [si+8*2+3], bh push es push ds @@ -1152,7 +833,7 @@ sayerr_floppy: mov dx, 0x3f2 mov al, 0 out dx, al - mov si, memmovefailed-0x10000 + mov si, memmovefailed jmp sayerr_plain @@: add dword [si+8*3+2], 512*10 @@ -1241,7 +922,7 @@ sayerr_floppy: aam xchg al, ah add ax, '00' - mov si, pros-0x10000 + mov si, pros cmp [si], ax jz @f mov [si], ax @@ -1319,54 +1000,23 @@ sayerr_floppy: ; jnz reads ; readdone: ; pop ax - mov si,backspace2-0x10000 + + mov si,backspace2 call printplain - mov si,okt-0x10000 + mov si,okt call printplain - no_sys_on_floppy: + +no_sys_on_floppy: xor ax, ax ; reset drive xor dx, dx int 0x13 - mov dx,0x3f2 ; floppy motor off - mov al,0 - out dx,al + mov dx,0x3f2 ; floppy motor off + mov al,0 + out dx,al - push es -; PAGE TABLE - - push dword [es:0x9018] -; -; mmap_mem equ 64 ; amount of memory to map -; - push 0x6000 - pop es ; es:di = 6000:0 -; xor di,di -; mov cx,256*mmap_mem ; Map (mapmem) M -;; initialize as identity mapping -; xor eax, eax -; call pagetable_set -; -; -; 4 KB PAGE DIRECTORY -; - push 0x7F00 - pop es ; es:di = 7F00:0 -; xor di, di -; mov cx, 64 / 4 -; mov eax, 0x60007 ; for 0 M -; call pagetable_set -; xor si,si -; mov di,second_base_address shr 20 -; mov cx,64/2 -; rep movs word [es:di], [es:si] - -; mov eax, 0x7F000 +8+16 ; Page directory and enable caches -; mov cr3, eax ; SET GRAPHICS - pop es - xor ax, ax mov es, ax @@ -1377,11 +1027,12 @@ sayerr_floppy: cmp ax,0x12 je setgr mov ax,0x4f02 ; Vesa - setgr: +setgr: int 0x10 test ah,ah - mov si, fatalsel-0x10000 + mov si, fatalsel jnz sayerr + ; set mode 0x12 graphics registers: cmp bx,0x12 jne gmok2 @@ -1405,7 +1056,6 @@ sayerr_floppy: pop dx out dx,al ; select GDC bit mask register ; for writes to 0x03cf - - gmok2: +gmok2: push ds pop es diff --git a/kernel/branches/flat_kernel/boot/bootru.inc b/kernel/branches/flat_kernel/boot/bootru.inc index e4b19cddf7..87e3899cb7 100644 --- a/kernel/branches/flat_kernel/boot/bootru.inc +++ b/kernel/branches/flat_kernel/boot/bootru.inc @@ -112,7 +112,7 @@ mode1 db "640x480",0 mode2 db "800x600",0 mode3 db "1024x768",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 modevesa12 db ", VESA 1.2 Bnk",0 mode9 db "320x200, EGA/CGA 256 梥⮢",0 @@ -124,7 +124,7 @@ on_msg db " off_msg db " ўлЄ«",13,10,0 vrrm_msg db " [c] €бЇ®«м§®ў ­ЁҐ VRR:",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 pdm2 db "C:\kolibri.img (FAT32)",13,10,0 pdm3 db "ЁбЇ®«м§®ў вм 㦥 § Ја㦥­­л© ®Ўа §",13,10,0 diff --git a/kernel/branches/flat_kernel/boot/preboot.inc b/kernel/branches/flat_kernel/boot/preboot.inc index ddad6f5672..e02ab1d01b 100644 --- a/kernel/branches/flat_kernel/boot/preboot.inc +++ b/kernel/branches/flat_kernel/boot/preboot.inc @@ -16,7 +16,7 @@ preboot_device db 0 ; boot device ;!!!! 0 - autodetect !!!! preboot_blogesc db 1 ; start immediately after bootlog - if $>10200h + if $>0x200 ERROR: prebooting parameters must fit in first sector!!! end if hdsysimage db 'KOLIBRI IMG' ; load from diff --git a/kernel/branches/flat_kernel/boot/rdload.inc b/kernel/branches/flat_kernel/boot/rdload.inc index e0fd730804..b307382336 100644 --- a/kernel/branches/flat_kernel/boot/rdload.inc +++ b/kernel/branches/flat_kernel/boot/rdload.inc @@ -1,9 +1,9 @@ ; READ RAMDISK IMAGE FROM HD - cmp [boot_dev],1 + cmp [boot_dev+OS_BASE+0x10000],1 jne no_sys_on_hd - test [0x40001],byte 0x40 + test [DRIVE_DATA+1],byte 0x40 jz position_2 mov [hdbase],0x1f0 mov [hdid],0x0 @@ -14,11 +14,11 @@ call search_and_read_image cmp [image_retrieved],1 je yes_sys_on_hd - movzx eax,byte [0x40002] + movzx eax,byte [DRIVE_DATA+2] cmp [fat32part],eax jle position_1_1 position_2: - test [0x40001],byte 0x10 + test [DRIVE_DATA+1],byte 0x10 jz position_3 mov [hdbase],0x1f0 mov [hdid],0x10 @@ -29,11 +29,11 @@ call search_and_read_image cmp [image_retrieved],1 je yes_sys_on_hd - movzx eax,byte [0x40003] + movzx eax,byte [DRIVE_DATA+3] cmp eax,[fat32part] jle position_2_1 position_3: - test [0x40001],byte 0x4 + test [DRIVE_DATA+1],byte 0x4 jz position_4 mov [hdbase],0x170 mov [hdid],0x0 @@ -44,11 +44,11 @@ call search_and_read_image cmp [image_retrieved],1 je yes_sys_on_hd - movzx eax,byte [0x40004] + movzx eax,byte [DRIVE_DATA+4] cmp eax,[fat32part] jle position_3_1 position_4: - test [0x40001],byte 0x1 + test [DRIVE_DATA+1],byte 0x1 jz no_sys_on_hd mov [hdbase],0x170 mov [hdid],0x10 @@ -59,7 +59,7 @@ call search_and_read_image cmp [image_retrieved],1 je yes_sys_on_hd - movzx eax,byte [0x40005] + movzx eax,byte [DRIVE_DATA+5] cmp eax,[fat32part] jle position_4_1 jmp yes_sys_on_hd @@ -80,7 +80,7 @@ ret read_image: - mov eax, hdsysimage + mov eax, hdsysimage+OS_BASE+0x10000 mov ebx, 1474560/512 mov ecx, RAMDISK mov esi, 0 diff --git a/kernel/branches/flat_kernel/boot/shutdown.inc b/kernel/branches/flat_kernel/boot/shutdown.inc index 6ae25c081f..7bc01fe5ac 100644 --- a/kernel/branches/flat_kernel/boot/shutdown.inc +++ b/kernel/branches/flat_kernel/boot/shutdown.inc @@ -16,15 +16,15 @@ system_shutdown: ; shut down the system call sys_cd_audio cld - mov al,[0x2f0000+0x9030] + mov al,[BOOT_VAR+0x9030] cmp al,1 jl no_shutdown_parameter cmp al,4 jle yes_shutdown_param no_shutdown_parameter: -; movzx ecx,word [0x2f0000+0x900A] -; movzx esi,word [0x2f0000+0x900C] +; movzx ecx,word [BOOT_VAR+0x900A] +; movzx esi,word [BOOT_VAR+0x900C] ; imul ecx,esi ;[0xfe04] ;; mov ecx,0x500000/4 ;3fff00/4 ; darken screen ; push ecx @@ -378,7 +378,7 @@ restart_kernel_4000: ; bootloader interface push 0x1000 pop ds - mov si, kernel_restart_bootblock-0x10000 + mov si, kernel_restart_bootblock mov ax, 'KL' jmp 0x1000:0000 diff --git a/kernel/branches/flat_kernel/const.inc b/kernel/branches/flat_kernel/const.inc index 28c4b4a1d2..debd4f389d 100644 --- a/kernel/branches/flat_kernel/const.inc +++ b/kernel/branches/flat_kernel/const.inc @@ -134,9 +134,9 @@ SSE_FZ equ 0x8000 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) TASK_COUNT equ (OS_BASE+0x0003004) @@ -196,7 +196,6 @@ MOUSE_BUFF_COUNT equ (OS_BASE+0x000FCFF) LFBAddress equ (OS_BASE+0x000FE80) MEM_AMOUNT equ (OS_BASE+0x000FE8C) -;LFBSize equ (OS_BASE+0x02f9050) ScreenWidth equ (OS_BASE+0x000FE00) ScreenHeight equ (OS_BASE+0x000FE04) @@ -235,7 +234,7 @@ SB16_Status equ (OS_BASE+0x02B0000) BUTTON_INFO equ (OS_BASE+0x02C0000) RESERVED_PORTS equ (OS_BASE+0x02D0000) IRQ_SAVE equ (OS_BASE+0x02E0000) -SYS_VAR equ (OS_BASE+0x02f0000) +BOOT_VAR equ (OS_BASE+0x02f0000) IMG_BACKGROUND equ (OS_BASE+0x0300000) WinMapAddress 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) draw_data equ (OS_BASE+0x988000) -HEAP_BASE equ (OS_BASE+0x98B000) +HEAP_BASE equ (OS_BASE+0x01000000) LFB_BASE equ 0x7DC00000 @@ -264,10 +263,8 @@ page_tabs equ 0x7FC00000 master_tab equ 0x7FDFF000 app_page_tabs equ 0x7FE00000 -sys_pgdir equ OS_BASE+0x00050000 -sys_master_tab equ OS_BASE+0x00051000 -sys_pgmap equ OS_BASE+0x00052000 - +sys_pgdir equ (OS_BASE+0x00050000) +sys_pgmap equ (OS_BASE+0x00052000) new_app_base equ 0x80000000 @@ -330,10 +327,6 @@ struc SYS_VARS .vesa_mode dd ? .x_res dd ? .y_res dd ? - .cpu_caps dd ? - dd ? - dd ? - dd ? } struc APPOBJ ;common object header diff --git a/kernel/branches/flat_kernel/core/dll.inc b/kernel/branches/flat_kernel/core/dll.inc index 2db407c3d6..adecaa636d 100644 --- a/kernel/branches/flat_kernel/core/dll.inc +++ b/kernel/branches/flat_kernel/core/dll.inc @@ -1038,21 +1038,3 @@ destroy_kernel_object: 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 diff --git a/kernel/branches/flat_kernel/core/memory.inc b/kernel/branches/flat_kernel/core/memory.inc index 2745c810b1..1aa00d7c5f 100644 --- a/kernel/branches/flat_kernel/core/memory.inc +++ b/kernel/branches/flat_kernel/core/memory.inc @@ -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 proc alloc_page @@ -382,21 +226,29 @@ proc init_LFB cmp dword [LFBAddress], -1 jne @f - mov [0x2f0000+0x901c],byte 2 + mov [BOOT_VAR+0x901c],byte 2 stdcall kernel_alloc, 0x280000 mov [LFBAddress], eax ret @@: test [SCR_MODE],word 0100000000000000b jnz @f - mov [0x2f0000+0x901c],byte 2 + mov [BOOT_VAR+0x901c],byte 2 ret @@: mov edx, LFB_BASE mov esi, [LFBAddress] - mov edi, [LFBSize] + mov edi, 0x00800000 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 mov [pg_count], edi shr edi, 10 @@ -427,7 +279,7 @@ proc init_LFB @@: call alloc_page stdcall map_page_table, edx, eax - add esi, 0x00400000 + add edx, 0x00400000 dec edi jnz @B @@ -436,7 +288,11 @@ proc init_LFB or eax, PG_UW mov ecx, [pg_count] cld - rep stosd +@@: + stosd + add eax, 0x1000 + dec ecx + jnz @B mov dword [LFBAddress], LFB_BASE mov eax, cr3 ;flush TLB @@ -605,6 +461,14 @@ align 4 proc page_fault_handler 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 eax, cr2 push eax @@ -670,6 +534,7 @@ proc page_fault_handler mov esp, ebp popad add esp, 4 + iretd save_ring3_context ;debugger support @@ -1085,148 +950,10 @@ new_services: mov [esp+36], eax 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 proc init_mtrr - cmp [0x2f0000+0x901c],byte 2 + cmp [BOOT_VAR+0x901c],byte 2 je .exit bt [cpu_caps], CAPS_MTRR @@ -1297,6 +1024,43 @@ proc set_mtrr stdcall, reg:dword,base:dword,size:dword,mem_type:dword ret 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 proc stall stdcall, delay:dword push ecx @@ -1324,106 +1088,6 @@ proc stall stdcall, delay:dword ret 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 k_strrchr: push eax @@ -1643,3 +1307,15 @@ k_strlen: ret 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 + + diff --git a/kernel/branches/flat_kernel/core/sys32.inc b/kernel/branches/flat_kernel/core/sys32.inc index a24316b719..a8e7144749 100644 --- a/kernel/branches/flat_kernel/core/sys32.inc +++ b/kernel/branches/flat_kernel/core/sys32.inc @@ -7,6 +7,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +align 4 idtreg: dw 8*0x41-1 dd idts+8 diff --git a/kernel/branches/flat_kernel/core/taskman.inc b/kernel/branches/flat_kernel/core/taskman.inc index 3d05099a8b..ff3ab737dc 100644 --- a/kernel/branches/flat_kernel/core/taskman.inc +++ b/kernel/branches/flat_kernel/core/taskman.inc @@ -1119,13 +1119,5 @@ proc set_app_params stdcall,slot:dword, params:dword,\ ret endp - - 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 - diff --git a/kernel/branches/flat_kernel/data16.inc b/kernel/branches/flat_kernel/data16.inc new file mode 100644 index 0000000000..420d5a7c19 --- /dev/null +++ b/kernel/branches/flat_kernel/data16.inc @@ -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 diff --git a/kernel/branches/flat_kernel/data32.inc b/kernel/branches/flat_kernel/data32.inc new file mode 100644 index 0000000000..4cd4b961a6 --- /dev/null +++ b/kernel/branches/flat_kernel/data32.inc @@ -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?',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 + diff --git a/kernel/branches/flat_kernel/detect/commouse.inc b/kernel/branches/flat_kernel/detect/commouse.inc index 13c1de7176..fc996989a8 100644 --- a/kernel/branches/flat_kernel/detect/commouse.inc +++ b/kernel/branches/flat_kernel/detect/commouse.inc @@ -17,7 +17,7 @@ Detect_COM_Mouse: mov eax,4 shl eax,2 - mov [irq_owner+eax],byte 1 + mov [irq_owner+eax], 1 inc dword [RESERVED_PORTS] mov edi,[RESERVED_PORTS] @@ -39,7 +39,7 @@ Detect_COM_Mouse: mov eax,3 shl eax,2 - mov [irq_owner+eax],byte 1 + mov [irq_owner+eax], 1 inc dword [RESERVED_PORTS] mov edi,[RESERVED_PORTS] diff --git a/kernel/branches/flat_kernel/detect/dev_hdcd.inc b/kernel/branches/flat_kernel/detect/dev_hdcd.inc index 4049347140..05389ee2c2 100644 --- a/kernel/branches/flat_kernel/detect/dev_hdcd.inc +++ b/kernel/branches/flat_kernel/detect/dev_hdcd.inc @@ -12,25 +12,25 @@ FindHDD: mov [DiskNumber],0 call FindHDD_3 ; mov ax,[Sector512+176] -; mov [0x40006],ax +; mov [DRIVE_DATA+6],ax ; mov ax,[Sector512+126] -; mov [0x40008],ax +; mov [DRIVE_DATA+8],ax ; mov ax,[Sector512+128] -; mov [0x40008],ax +; mov [DRIVE_DATA+8],ax mov [DiskNumber],1 call FindHDD_3 ; mov al,[Sector512+176] -; mov [0x40007],al +; mov [DRIVE_DATA+7],al inc [ChannelNumber] mov [DiskNumber],0 call FindHDD_3 ; mov al,[Sector512+176] -; mov [0x40008],al +; mov [DRIVE_DATA+8],al mov [DiskNumber],1 call FindHDD_1 ; mov al,[Sector512+176] -; mov [0x40009],al - +; mov [DRIVE_DATA+9],al + jmp EndFindHDD FindHDD_1: @@ -41,7 +41,7 @@ FindHDD_1: ja FindHDD_2 cmp [Sector512+12],word 255 ja FindHDD_2 - inc byte [0x40001] + inc byte [DRIVE_DATA+1] jmp FindHDD_2_2 FindHDD_2: call DeviceReset @@ -50,14 +50,14 @@ FindHDD_1: call ReadCD_ID cmp [DevErrorCode],0 jne FindHDD_2_2 - inc byte [0x40001] - inc byte [0x40001] + inc byte [DRIVE_DATA+1] + inc byte [DRIVE_DATA+1] FindHDD_2_2: ret FindHDD_3: call FindHDD_1 - shl byte [0x40001],2 + shl byte [DRIVE_DATA+1],2 ret @@ -84,7 +84,7 @@ ReadHDD_ID: cmp [DevErrorCode],0 ;проверить код ошибки jne @@End ;закончить, сохранив код ошибки mov DX,[ATABasePortAddr] - add DX,7 ;адрес регистра состояния + add DX,7 ;адрес регистра состояни mov ecx,0xffff @@WaitCompleet: ; Проверить время выполнения команды @@ -191,15 +191,15 @@ SendCommandToHDD: ; mov eax,[timer_ticks] ; mov [TickCounter_1],eax @@WaitHDReady: - ; Проверить время ожидания + ; Проверить время ожидани dec ecx cmp ecx,0 je @@Err1 ; mov eax,[timer_ticks] ; sub eax,[TickCounter_1] -; cmp eax,300 ;ожидать 300 тиков +; cmp eax,300 ;ожидать 300 тиков ; ja @@Err1 ;ошибка тайм-аута - ; Прочитать регистр состояния + ; Прочитать регистр состояни in AL,DX ; Проверить состояние сигнала BSY test AL,80h @@ -255,7 +255,7 @@ SendCommandToHDD: jmp @@End_2 @@Err5: mov [DevErrorCode],5 ; Завершение работы программы -@@End_2: +@@End_2: ret ;************************************************* @@ -285,7 +285,7 @@ ReadCD_ID: add DX,7 ;порт 1х7h mov ecx,0xffff @@WaitCompleet_1: - ; Проверить время + ; Проверить врем dec ecx cmp ecx,0 je @@Error1_1 ;ошибка тайм-аута @@ -348,11 +348,11 @@ DeviceReset: out DX,AL mov ecx,0x80000 @@WaitHDReady_1: - ; Проверить время ожидания + ; Проверить время ожидани dec ecx cmp ecx,0 je @@Err1_2 ;ошибка тайм-аута - ; Прочитать регистр состояния + ; Прочитать регистр состояни in AL,DX ; Проверить состояние сигнала BSY test AL,80h diff --git a/kernel/branches/flat_kernel/detect/sear_par.inc b/kernel/branches/flat_kernel/detect/sear_par.inc index 9f1e547561..1bc6bb0601 100644 --- a/kernel/branches/flat_kernel/detect/sear_par.inc +++ b/kernel/branches/flat_kernel/detect/sear_par.inc @@ -3,9 +3,9 @@ ; и занесение данных в область таблицы ; автор Mario79 ;**************************************************** - mov [transfer_adress],0x4000a + mov [transfer_adress],DRIVE_DATA+0xa search_partitions_ide0: - test [0x40001],byte 0x40 + test [DRIVE_DATA+1],byte 0x40 jz search_partitions_ide1 mov [hdbase],0x1f0 mov [hdid],0x0 @@ -15,14 +15,14 @@ call set_FAT32_variables cmp [problem_partition],0 jne search_partitions_ide1 - inc byte [0x40002] + inc byte [DRIVE_DATA+2] call partition_data_transfer add [transfer_adress],100 inc [fat32part] jmp search_partitions_ide0_1 search_partitions_ide1: - test [0x40001],byte 0x10 + test [DRIVE_DATA+1],byte 0x10 jz search_partitions_ide2 mov [hdbase],0x1f0 mov [hdid],0x10 @@ -32,14 +32,14 @@ call set_FAT32_variables cmp [problem_partition],0 jne search_partitions_ide2 - inc byte [0x40003] + inc byte [DRIVE_DATA+3] call partition_data_transfer add [transfer_adress],100 inc [fat32part] jmp search_partitions_ide1_1 search_partitions_ide2: - test [0x40001],byte 0x4 + test [DRIVE_DATA+1],byte 0x4 jz search_partitions_ide3 mov [hdbase],0x170 mov [hdid],0x0 @@ -49,14 +49,14 @@ call set_FAT32_variables cmp [problem_partition],0 jne search_partitions_ide3 - inc byte [0x40004] + inc byte [DRIVE_DATA+4] call partition_data_transfer add [transfer_adress],100 inc [fat32part] jmp search_partitions_ide2_1 search_partitions_ide3: - test [0x40001],byte 0x1 + test [DRIVE_DATA+1],byte 0x1 jz end_search_partitions_ide mov [hdbase],0x170 mov [hdid],0x10 @@ -66,14 +66,14 @@ call set_FAT32_variables cmp [problem_partition],0 jne end_search_partitions_ide - inc byte [0x40005] + inc byte [DRIVE_DATA+5] call partition_data_transfer add [transfer_adress],100 inc [fat32part] jmp search_partitions_ide3_1 - -partition_data_transfer: + +partition_data_transfer: mov edi,[transfer_adress] mov esi,PARTITION_START mov ecx,(file_system_data_size+3)/4 diff --git a/kernel/branches/flat_kernel/fs/fs.inc b/kernel/branches/flat_kernel/fs/fs.inc index 676cf56ae0..e9109a53ca 100644 --- a/kernel/branches/flat_kernel/fs/fs.inc +++ b/kernel/branches/flat_kernel/fs/fs.inc @@ -389,8 +389,8 @@ choice_necessity_partition: choice_necessity_partition_1: mov ecx,[hdpos] xor eax,eax - mov [0xfe10], eax ; entries in hd cache - mov edx,0x40002 + mov [hd_entries], eax ; entries in hd cache + mov edx,DRIVE_DATA+2 search_partition_array: mov bl,[edx] movzx ebx,bl @@ -402,7 +402,7 @@ choice_necessity_partition_1: dec eax xor edx,edx imul eax,100 - add eax,0x4000a + add eax,DRIVE_DATA+0xa mov [transfer_adress],eax call partition_data_transfer_1 ret diff --git a/kernel/branches/flat_kernel/fs/fs_lfn.inc b/kernel/branches/flat_kernel/fs/fs_lfn.inc index 0ac6f0b4a6..fdd0bd8436 100644 --- a/kernel/branches/flat_kernel/fs/fs_lfn.inc +++ b/kernel/branches/flat_kernel/fs/fs_lfn.inc @@ -427,7 +427,7 @@ fs_OnHd: mov [hdpos], eax cmp ecx, 0x100 jae .nf - cmp cl, [0x40001+eax] + cmp cl, [DRIVE_DATA+eax] jbe @f .nf: call free_hd_channel @@ -503,7 +503,7 @@ fs_OnCd: jae .nf push ecx ebx mov cl,al - mov bl,[0x40001] + mov bl,[DRIVE_DATA+1] shr bl,cl test bl,2 pop ebx ecx diff --git a/kernel/branches/flat_kernel/gui/font.inc b/kernel/branches/flat_kernel/gui/font.inc index 8b2a949311..6da4a245b1 100644 --- a/kernel/branches/flat_kernel/gui/font.inc +++ b/kernel/branches/flat_kernel/gui/font.inc @@ -10,8 +10,8 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org]) ; edi 1 force pushad - call [disable_mouse] + call [disable_mouse] mov ebp, ecx ; ebp=pointer to text mov ecx, ebx ; ecx=color movsx ebx, ax ; ebx=y diff --git a/kernel/branches/flat_kernel/gui/window.inc b/kernel/branches/flat_kernel/gui/window.inc index 9e8d1a8f03..9342697688 100644 --- a/kernel/branches/flat_kernel/gui/window.inc +++ b/kernel/branches/flat_kernel/gui/window.inc @@ -516,7 +516,7 @@ display_settings: repos_windows: mov ecx,[TASK_COUNT] - mov edi,0x20*2 + mov edi, OS_BASE+0x20*2 mov byte[REDRAW_BACKGROUND],1 dec ecx jge @f @@ -537,6 +537,7 @@ repos_windows: neg eax mov [edi+WDATA.box.height],eax .lp1: + call set_window_clientbox add edi,0x20 loop @b diff --git a/kernel/branches/flat_kernel/hid/mousedrv.inc b/kernel/branches/flat_kernel/hid/mousedrv.inc index 73eb81f5da..b9aea2ba0b 100644 --- a/kernel/branches/flat_kernel/hid/mousedrv.inc +++ b/kernel/branches/flat_kernel/hid/mousedrv.inc @@ -100,6 +100,7 @@ save_draw_mouse: mov ecx, [ScreenWidth] inc ecx mul ecx + movzx edx, byte [display_data+ebx+eax] shl edx, 8 mov ecx, [edx+SLOT_BASE+APPDATA.cursor] @@ -320,9 +321,10 @@ yes_mouse_disable: disable_m: cmp dword [MOUSE_VISIBLE],dword 0 jne no_mouse_disable + pushf cli call draw_mouse_under - sti + popf mov [MOUSE_VISIBLE],dword 1 no_mouse_disable: popad @@ -350,9 +352,10 @@ __sys_draw_pointer: mov [MOUSE_VISIBLE], dword 0 movzx ebx,word [MOUSE_Y] movzx eax,word [MOUSE_X] + pushfd cli call save_draw_mouse - sti + popfd nodmu2: popad ret @@ -367,10 +370,11 @@ chms00: jne redrawmouse jmp nodmp redrawmouse: + pushfd cli call draw_mouse_under call save_draw_mouse - sti + popfd nodmp: popad ret diff --git a/kernel/branches/flat_kernel/init.inc b/kernel/branches/flat_kernel/init.inc new file mode 100644 index 0000000000..3645b2ba94 --- /dev/null +++ b/kernel/branches/flat_kernel/init.inc @@ -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 + diff --git a/kernel/branches/flat_kernel/kernel.asm b/kernel/branches/flat_kernel/kernel.asm index 65d27057fc..f6abd3029f 100644 --- a/kernel/branches/flat_kernel/kernel.asm +++ b/kernel/branches/flat_kernel/kernel.asm @@ -15,19 +15,17 @@ include "kglobals.inc" include "lang.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 jmp start_of_code -; mike.dld { - 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 -version db 'Kolibri OS version 0.6.5.0 ',13,10,13,10,0 - ;dd endofcode-0x10000 - - ;db 'Boot02' -;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include "boot/preboot.inc" -;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -preboot_lfb db 0 -preboot_bootlog db 0 +if lang eq en +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 - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; 16 BIT INCLUDED FILES ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -include "kernel16.inc" +include "boot/bootcode.inc" ; 16 bit system boot code +include "bus/pci/pci16.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 @@ -121,7 +93,7 @@ app_data equ 3+app_data_l-gdts ; Enabling 32 bit protected mode - sidt [cs:old_ints_h-0x10000] + ; sidt [cs:old_ints_h-0x10000] cli ; disable all irqs cld @@ -143,195 +115,162 @@ app_data equ 3+app_data_l-gdts jnz l.7 mov al, 0xFF 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 and eax, 10011111b *65536*256 + 0xffffff ; caching enabled 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 -if gdte >= $ -error 'GDT overlaps with used code!' -end if +align 8 +tmp_gdt: + + 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 +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_LEVEL__ fix 1 include 'fdo.inc' - -iglobal - 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 +include 'init.inc' +include "boot/shutdown.inc" ; shutdown or restart -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; 32 BIT ENTRY ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - +org OS_BASE+$ 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: -; CLEAR 0x280000-0xF00000 + mov dword [sys_pgdir], 0 + mov dword [sys_pgdir+4], 0 + mov dword [sys_pgdir+8], 0 + mov dword [sys_pgdir+12], 0 - xor eax,eax - mov edi,0x280000 - 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 + mov eax, sys_pgdir-OS_BASE + mov cr3, eax ; SAVE REAL MODE VARIABLES - mov ax, [0x2f0000 + 0x9031] + mov ax, [BOOT_VAR + 0x9031] mov [IDEContrRegsBaseAddr], ax ; --------------- APM --------------------- - mov eax, [0x2f0000 + 0x9040] ; entry point - mov dword[apm_entry], eax - mov word [apm_entry + 4], apm_code_32 - gdts +; mov eax, [BOOT_VAR + 0x9040] ; entry point +; mov dword[apm_entry], eax +; 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 ; ----------------------------------------- -; movzx eax,byte [0x2f0000+0x9010] ; mouse port +; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port ; mov [0xF604],byte 1 ;al - mov al, [0x2F0000+0x901F] ; DMA writing + mov al, [BOOT_VAR+0x901F] ; DMA writing mov [allow_dma_write], al - mov al,[0x2f0000+0x9000] ; bpp + mov al,[BOOT_VAR+0x9000] ; bpp mov [ScreenBPP],al - movzx eax,word [0x2f0000+0x900A] ; X max + movzx eax,word [BOOT_VAR+0x900A] ; X max dec eax mov [ScreenWidth],eax mov [screen_workarea.right],eax - movzx eax,word [0x2f0000+0x900C] ; Y max + movzx eax,word [BOOT_VAR+0x900C] ; Y max dec eax mov [ScreenHeight],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 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 [BytesPerScanLine],word 640*4 ; Bytes PerScanLine cmp [SCR_MODE],word 0x13 ; 320x200 je @f cmp [SCR_MODE],word 0x12 ; VGA 640x480 je @f - mov ax,[0x2f0000+0x9001] ; for other modes + mov ax,[BOOT_VAR+0x9001] ; for other modes mov [BytesPerScanLine],ax @@: ; GRAPHICS ADDRESSES - ;mov eax,0x100000*8 ; LFB address - ;cmp [0xfe0c],word 0x13 - ;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 byte [BOOT_VAR+0x901e],0x0 + mov eax,[BOOT_VAR+0x9018] mov [LFBAddress],eax cmp [SCR_MODE],word 0100000000000000b @@ -339,39 +278,28 @@ B32: cmp [SCR_MODE],word 0x13 je v20ga32 mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2 - mov [0xe024],dword Vesa12_getpixel24 + mov [GETPIXEL],dword Vesa12_getpixel24 cmp [ScreenBPP],byte 24 jz ga24 mov [PUTPIXEL],dword Vesa12_putpixel32 - mov [0xe024],dword Vesa12_getpixel32 + mov [GETPIXEL],dword Vesa12_getpixel32 ga24: jmp v20ga24 setvesa20: mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0 - mov [0xe024],dword Vesa20_getpixel24 + mov [GETPIXEL],dword Vesa20_getpixel24 cmp [ScreenBPP],byte 24 jz v20ga24 v20ga32: mov [PUTPIXEL],dword Vesa20_putpixel32 - mov [0xe024],dword Vesa20_getpixel32 + mov [GETPIXEL],dword Vesa20_getpixel32 v20ga24: cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480 jne no_mode_0x12 mov [PUTPIXEL],dword VGA_putpixel - mov [0xe024],dword Vesa20_getpixel32 + mov [GETPIXEL],dword Vesa20_getpixel32 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 ---------- ; Intel SYSENTER/SYSEXIT (AMD CPU support it too) bt [cpu_caps], CAPS_SEP @@ -415,26 +343,13 @@ B32: .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 stdcall kernel_alloc, 0x2000 mov [os_stack], eax + mov [LFBSize], 0x800000 + call init_mtrr + call init_LFB call init_fpu @@ -511,7 +426,7 @@ include 'vmodeld.inc' mov esi,char xor ebx,ebx - mov ecx,2560;26000 + mov ecx,2560 mov edx,FONT_I call fs_RamdiskRead @@ -552,14 +467,13 @@ include 'vmodeld.inc' call build_scheduler ; sys32.inc ; LOAD IDT - lidt [cs:idtreg] - cli + lidt [idtreg] mov esi,boot_devices call boot_log call detect_devices - ; TIMER SET TO 1/100 S +; TIMER SET TO 1/100 S mov esi,boot_timer 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.sse_handler], 0 - - mov ebx, [def_cursor] mov dword [SLOT_BASE+256+APPDATA.cursor], ebx mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET @@ -637,6 +549,8 @@ include 'vmodeld.inc' mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx ; 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.pid], 1 ; process id number mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address @@ -667,9 +581,11 @@ include 'vmodeld.inc' ltr ax 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 call boot_log @@ -720,10 +636,8 @@ include 'vmodeld.inc' call load_skin ; LOAD FIRST APPLICATION - mov [CURRENT_TASK],dword 1 - mov [TASK_COUNT],dword 1 cli - cmp byte [0x2f0000+0x9030],1 + cmp byte [BOOT_VAR+0x9030],1 jne no_load_vrr_m mov ebp, vrr_m @@ -748,7 +662,6 @@ first_app_found: ;mov [TASK_COUNT],dword 2 mov [CURRENT_TASK],dword 1 ; set OS task fisrt - ; SET KEYBOARD PARAMETERS mov al, 0xf6 ; reset keyboard, scan enabled call kb_write @@ -815,6 +728,43 @@ first_app_found: ; 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 ; @@ -918,13 +868,14 @@ reserve_irqs_ports: pushad - mov [irq_owner+4*0],byte 1 ; timer - mov [irq_owner+4*1],byte 1 ; keyboard - mov [irq_owner+4*5],byte 1 ; sound blaster - mov [irq_owner+4*6],byte 1 ; floppy diskette - mov [irq_owner+4*13],byte 1 ; math co-pros - mov [irq_owner+4*14],byte 1 ; ide I - mov [irq_owner+4*15],byte 1 ; ide II + mov [irq_owner+4*0], 1 ; timer + mov [irq_owner+4*1], 1 ; keyboard + mov [irq_owner+4*5], 1 ; sound blaster + mov [irq_owner+4*6], 1 ; floppy diskette + mov [irq_owner+4*13], 1 ; math co-pros + mov [irq_owner+4*14], 1 ; ide I + mov [irq_owner+4*15], 1 ; ide II + ; movzx eax,byte [0xf604] ; mouse irq ; dec eax ; add eax,mouseirqtable @@ -1017,10 +968,10 @@ set_variables: ; mov [MOUSE_X],dword 100*65536+100 ; mouse x/y push eax - mov ax,[0x2f0000+0x900c] + mov ax,[BOOT_VAR+0x900c] shr ax,1 shl eax,16 - mov ax,[0x2f0000+0x900A] + mov ax,[BOOT_VAR+0x900A] shr ax,1 mov [MOUSE_X],eax pop eax @@ -1031,7 +982,7 @@ set_variables: ;!! IP 04.02.2005: mov [next_usage_update], 100 - mov byte [0xFFFF], 0 ; change task if possible + mov byte [DONT_SWITCH], 0 ; change task if possible ret @@ -1929,7 +1880,7 @@ sys_system: ret sysfn_shutdown: ; 18.1 = BOOT - mov [0x2f0000+0x9030],byte 0 + mov [BOOT_VAR+0x9030],byte 0 for_shutdown_parameter: mov eax,[TASK_COUNT] @@ -2053,7 +2004,7 @@ sysfn_shutdown_param: ; 18.9 = system shutdown with param jl exit_for_anyone cmp ebx,4 jg exit_for_anyone - mov [0x2f0000+0x9030],bl + mov [BOOT_VAR+0x9030],bl jmp for_shutdown_parameter sysfn_minimize: ; 18.10 = minimize window @@ -2798,7 +2749,7 @@ draw_window_caption: mov ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption] or ecx,ecx 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] and al,0x0F @@ -4755,7 +4706,7 @@ syscall_getpixel: ; GetPixel div ecx mov ebx,edx xchg eax,ebx - call dword [0xe024] + call dword [GETPIXEL] mov [esp+36],ecx ret @@ -4920,162 +4871,8 @@ undefined_syscall: ; Undefined system call mov [esp+36],dword -1 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?',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 diff16 "end of kernel code",0,$ diff --git a/kernel/branches/flat_kernel/kernel32.inc b/kernel/branches/flat_kernel/kernel32.inc index 6759bd15b2..74f4a51346 100644 --- a/kernel/branches/flat_kernel/kernel32.inc +++ b/kernel/branches/flat_kernel/kernel32.inc @@ -238,8 +238,6 @@ include "gui/button.inc" ; shutdown -include "boot/shutdown.inc" ; shutdown or restart - ; file system include "fs/fs.inc" ; syscall diff --git a/kernel/branches/flat_kernel/network/stack.inc b/kernel/branches/flat_kernel/network/stack.inc index 0b43fadd25..87288f2180 100644 --- a/kernel/branches/flat_kernel/network/stack.inc +++ b/kernel/branches/flat_kernel/network/stack.inc @@ -72,10 +72,10 @@ SOCKET_INTERFACE equ 53 ; 128KB allocated for the stack and network driver buffers and other ; data requirements -stack_data_start equ 0x700000 -eth_data_start equ 0x700000 -stack_data equ 0x704000 -stack_data_end equ 0x71ffff +;stack_data_start equ 0x700000 +;eth_data_start equ 0x700000 +;stack_data equ 0x704000 +;stack_data_end equ 0x71ffff ; 32 bit word 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 diff --git a/kernel/branches/flat_kernel/sound/sb16.inc b/kernel/branches/flat_kernel/sound/sb16.inc index 9153bceba1..1c2bde36dd 100644 --- a/kernel/branches/flat_kernel/sound/sb16.inc +++ b/kernel/branches/flat_kernel/sound/sb16.inc @@ -18,7 +18,7 @@ SB16_play_music equ 0xc0000001 DMAPage equ 0x2A Rate equ 44100 SB16Buffer equ 0x2A0000 -SB16_Status equ SB16Buffer+65536 +;SB16_Status equ SB16Buffer+65536 iglobal sound_data_format dd 0x1 diff --git a/kernel/branches/flat_kernel/video/cursors.inc b/kernel/branches/flat_kernel/video/cursors.inc index 78826037f7..743e2d9251 100644 --- a/kernel/branches/flat_kernel/video/cursors.inc +++ b/kernel/branches/flat_kernel/video/cursors.inc @@ -444,6 +444,7 @@ proc init_cursors stdcall load_driver, szHwMouse mov [hw_cursor], eax + test eax, eax jz .sw_mouse diff --git a/kernel/branches/flat_kernel/video/vesa20.inc b/kernel/branches/flat_kernel/video/vesa20.inc index ba1982acd8..384bd9f248 100644 --- a/kernel/branches/flat_kernel/video/vesa20.inc +++ b/kernel/branches/flat_kernel/video/vesa20.inc @@ -38,7 +38,7 @@ getpixel: push eax ebx edx edi - call dword [0xe024] + call dword [GETPIXEL] pop edi edx ebx eax ret diff --git a/kernel/branches/flat_kernel/vmodeld.inc b/kernel/branches/flat_kernel/vmodeld.inc index c84dcea7d8..46b0dc710b 100644 --- a/kernel/branches/flat_kernel/vmodeld.inc +++ b/kernel/branches/flat_kernel/vmodeld.inc @@ -1,6 +1,6 @@ ; ; Load of videomode driver in memory -; +; ; (driver is located at 0x760000-0x768000 - 32kb) // if this area not occuped anything ; ; Author: Trans @@ -13,11 +13,11 @@ ; LOAD VIDEOMODE DRIVER ; If vmode.mdr file not found or eax,-1 ; Driver ID = -1 (not present in system) - mov [0x760000],eax ; - mov [0x760100],byte 0xC3 ; Instruction RETN - driver loop + mov [OS_BASE+0x760000],eax ; + mov [OS_BASE+0x760100],byte 0xC3 ; Instruction RETN - driver loop mov esi, vmode xor ebx, ebx mov ecx, 0x8000 ; size of memory area for driver - mov edx, 0x760000 ; Memory position of driver - call fs_RamdiskRead \ No newline at end of file + mov edx, OS_BASE+0x760000 ; Memory position of driver + call fs_RamdiskRead