Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4993 → Rev 4992

/kernel/branches/kolibri-process/blkdev/flp_drv.inc
5,7 → 5,7
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision: 4695 $
$Revision: 4273 $
 
 
;**********************************************************
/kernel/branches/kolibri-process/blkdev/hd_drv.inc
5,7 → 5,7
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision: 4839 $
$Revision: 4420 $
 
 
; Low-level driver for HDD access
/kernel/branches/kolibri-process/blkdev/ide_cache.inc
21,7 → 21,7
;
;**************************************************************************
 
$Revision: 4700 $
$Revision: 3742 $
 
align 4
find_empty_slot_CD_cache:
/kernel/branches/kolibri-process/blkdev/disk_cache.inc
5,7 → 5,7
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision: 4465 $
$Revision: 4133 $
 
; Read/write functions try to do large operations,
; it is significantly faster than several small operations.
/kernel/branches/kolibri-process/blkdev/disk.inc
5,7 → 5,7
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision: 4437 $
$Revision: 4273 $
 
; =============================================================================
; ================================= Constants =================================
/kernel/branches/kolibri-process/core/mtrr.inc
File deleted
/kernel/branches/kolibri-process/core/v86.inc
14,7 → 14,9
 
struct V86_machine
; page directory
process dd ?
pagedir dd ?
; translation table: V86 address -> flat linear address
pages dd ?
; mutex to protect all data from writing by multiple threads at one time
mutex dd ?
; i/o permission map
36,87 → 38,91
and dword [eax+V86_machine.mutex], 0
; allocate tables
mov ebx, eax
 
stdcall create_process, 4096, OS_BASE, 4096
test eax, eax
jz .fail2
 
mov [eax+PROC.mem_used], 4096
mov [ebx+V86_machine.process], eax
 
push 2000h
; We allocate 4 pages.
; First is main page directory for V86 mode.
; Second page:
; first half (0x800 bytes) is page table for addresses 0 - 0x100000,
; second half is for V86-to-linear translation.
; Third and fourth are for I/O permission map.
push 8000h ; blocks less than 8 pages are discontinuous
call kernel_alloc
test eax, eax
jz .fail2
 
mov [ebx+V86_machine.iopm], eax
 
 
mov [ebx+V86_machine.pagedir], eax
push edi eax
mov edi, eax
add eax, 1800h
mov [ebx+V86_machine.pages], eax
; initialize tables
push edi
mov edi, eax
mov eax, -1
mov ecx, 2000h/4
xor eax, eax
rep stosd
mov [ebx+V86_machine.iopm], edi
dec eax
mov ecx, 2000h/4
rep stosd
pop eax
; page directory: first entry is page table...
mov edi, eax
add eax, 1000h
push eax
call get_pg_addr
or al, PG_UW
stosd
; ...and also copy system page tables
; thx to Serge, system is located at high addresses
add edi, (OS_BASE shr 20) - 4
push esi
mov esi, sys_proc+PROC.pdt_0+(OS_BASE shr 20)
mov ecx, 0x80000000 shr 22
rep movsd
 
mov eax, [ebx+V86_machine.process]
mov eax, [eax+PROC.pdt_0_phys]
mov eax, [ebx+V86_machine.pagedir] ;root dir also is
call get_pg_addr ;used as page table
or al, PG_SW
mov [edi-4096+(page_tabs shr 20)], eax
 
pushfd
cli
mov cr3, eax
 
 
pop esi
; now V86 specific: initialize known addresses in first Mb
 
pop eax
; first page - BIOS data (shared between all machines!)
; physical address = 0
; linear address = OS_BASE
mov dword [eax], 111b
mov dword [eax+800h], OS_BASE
; page before 0xA0000 - Extended BIOS Data Area (shared between all machines!)
; physical address = 0x9C000
; linear address = 0x8009C000
; (I have seen one computer with EBDA segment = 0x9D80,
; all other computers use less memory)
 
mov eax, PG_UW
mov [page_tabs], eax
invlpg [eax]
 
mov byte [0x500], 0xCD
mov byte [0x501], 0x13
mov byte [0x502], 0xF4
mov byte [0x503], 0xCD
mov byte [0x504], 0x10
mov byte [0x505], 0xF4
 
mov eax, 0x99000+PG_UW
mov edi, page_tabs+0x99*4
mov edx, 0x1000
mov ecx, 7
mov ecx, 4
mov edx, 0x9C000
push eax
lea edi, [eax+0x9C*4]
@@:
lea eax, [edx + OS_BASE]
mov [edi+800h], eax
lea eax, [edx + 111b]
stosd
add eax, edx
add edx, 0x1000
loop @b
 
pop eax
pop edi
; addresses 0xC0000 - 0xFFFFF - BIOS code (shared between all machines!)
; physical address = 0xC0000
 
mov eax, 0xC0000+PG_UW
mov edi, page_tabs+0xC0*4
mov edx, 0x1000
mov ecx, 64
; linear address = 0x800C0000
mov ecx, 0xC0
@@:
stosd
add eax, edx
loop @b
 
mov eax, sys_proc-OS_BASE+PROC.pdt_0
 
mov cr3, eax
popfd
 
pop edi
 
mov edx, ecx
shl edx, 12
push edx
or edx, 111b
mov [eax+ecx*4], edx
pop edx
add edx, OS_BASE
mov [eax+ecx*4+0x800], edx
inc cl
jnz @b
mov eax, ebx
ret
.fail2:
126,16 → 132,15
xor eax, eax
ret
 
;not used
; Destroy V86 machine
; in: eax = handle
; out: nothing
; destroys: eax, ebx, ecx, edx (due to free)
;v86_destroy:
; push eax
; stdcall kernel_free, [eax+V86_machine.pagedir]
; pop eax
; jmp free
v86_destroy:
push eax
stdcall kernel_free, [eax+V86_machine.pagedir]
pop eax
jmp free
 
; Translate V86-address to linear address
; in: eax=V86 address
145,7 → 150,7
v86_get_lin_addr:
push ecx edx
mov ecx, eax
mov edx, page_tabs
mov edx, [esi+V86_machine.pages]
shr ecx, 12
and eax, 0xFFF
add eax, [edx+ecx*4] ; atomic operation, no mutex needed
152,7 → 157,6
pop edx ecx
ret
 
;not used
; Sets linear address for V86-page
; in: eax=linear address (must be page-aligned)
; ecx=V86 page (NOT address!)
159,15 → 163,15
; esi=handle
; out: nothing
; destroys: nothing
;v86_set_page:
; push eax ebx
; mov ebx, [esi+V86_machine.pagedir]
; mov [ebx+ecx*4+0x1800], eax
; call get_pg_addr
; or al, 111b
; mov [ebx+ecx*4+0x1000], eax
; pop ebx eax
; ret
v86_set_page:
push eax ebx
mov ebx, [esi+V86_machine.pagedir]
mov [ebx+ecx*4+0x1800], eax
call get_pg_addr
or al, 111b
mov [ebx+ecx*4+0x1000], eax
pop ebx eax
ret
 
; Allocate memory in V86 machine
; in: eax=size (in bytes)
210,7 → 214,21
mov [sys_v86_machine], eax
test eax, eax
jz .ret
mov byte [OS_BASE + 0x500], 0xCD
mov byte [OS_BASE + 0x501], 0x13
mov byte [OS_BASE + 0x502], 0xF4
mov byte [OS_BASE + 0x503], 0xCD
mov byte [OS_BASE + 0x504], 0x10
mov byte [OS_BASE + 0x505], 0xF4
mov esi, eax
mov ebx, [eax+V86_machine.pagedir]
; one page for stack, two pages for results (0x2000 bytes = 16 sectors)
mov dword [ebx+0x99*4+0x1000], 0x99000 or 111b
mov dword [ebx+0x99*4+0x1800], OS_BASE + 0x99000
mov dword [ebx+0x9A*4+0x1000], 0x9A000 or 111b
mov dword [ebx+0x9A*4+0x1800], OS_BASE + 0x9A000
mov dword [ebx+0x9B*4+0x1000], 0x9B000 or 111b
mov dword [ebx+0x9B*4+0x1800], OS_BASE + 0x9B000
if ~DEBUG_SHOW_IO
; allow access to all ports
mov ecx, [esi+V86_machine.iopm]
254,9 → 272,6
; eax = 3 - IRQ is already hooked by another VM
; destroys: nothing
v86_start:
 
xchg bx, bx
 
pushad
 
cli
281,11 → 296,13
mov [ecx+APPDATA.saved_esp0], esp
mov [tss._esp0], esp
 
mov eax, [esi+V86_machine.process]
mov eax, [esi+V86_machine.pagedir]
call get_pg_addr
mov [ecx+APPDATA.process], eax
mov eax, [eax+PROC.pdt_0_phys]
mov cr3, eax
; mov cr3, eax
 
; mov [irq_tab+5*4], my05
 
; We do not enable interrupts, because V86 IRQ redirector assumes that
; machine is running
; They will be enabled by IRET.
778,7 → 795,6
pop ebx
mov dword [SLOT_BASE+ecx+APPDATA.io_map], ebx
mov dword [page_tabs + (tss._io_map_0 shr 10)], ebx
mov eax, [eax+PROC.pdt_0_phys]
mov cr3, eax
sti
 
827,7 → 843,8
pop eax
v86_irq2:
mov esi, [v86_irqhooks+edi*8] ; get VM handle
mov eax, [esi+V86_machine.process]
mov eax, [esi+V86_machine.pagedir]
call get_pg_addr
mov ecx, [CURRENT_TASK]
shl ecx, 8
cmp [SLOT_BASE+ecx+APPDATA.process], eax
878,7 → 895,6
popad
iretd
.found:
mov eax, [eax+PROC.pdt_0_phys]
mov cr3, eax
mov esi, [ebx+APPDATA.saved_esp0]
sub word [esi-sizeof.v86_regs+v86_regs.esp], 6
/kernel/branches/kolibri-process/core/exports.inc
94,7 → 94,6
load_cursor, 'LoadCursor', \ ;stdcall
\
get_curr_task, 'GetCurrentTask', \
change_task, 'ChangeTask', \
load_file, 'LoadFile', \ ;retval eax, ebx
delay_ms, 'Sleep', \
\
/kernel/branches/kolibri-process/detect/init_ata.inc
File deleted
/kernel/branches/kolibri-process/gui/button.inc
39,7 → 39,6
;> 7 (31) = 0
;> 6 (30) = don't draw button
;> 5 (29) = don't draw button frame when pressed
;> 4 (28) = don't draw button 3d frame
;> esi = button color
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Undefine button:
87,11 → 86,9
mov ax, dx
stosw ; button id number: bits 0-15
mov eax, ebx
dec eax
rol eax, 16
stosd ; x start | x size
mov eax, ecx
dec eax
rol eax, 16
stosd ; y start | y size
mov eax, edx
103,115 → 100,113
test edx, 0x40000000
jnz .exit
 
; DRAW BODY -----------------------------
; draw button body
 
pushad
call button._.button_calc_relativ
xor edi, edi ; for __sys_draw_line
; set color
 
; calculate window-relative coordinates
movzx edi, cx
shr ebx, 16
shr ecx, 16
mov eax, [TASK_BASE]
add ebx, [eax - twdw + WDATA.box.left]
add ecx, [eax - twdw + WDATA.box.top]
mov eax, ebx
shl eax, 16
mov ax, bx
add ax, word[esp + 16]
mov ebx, ecx
shl ebx, 16
mov bx, cx
 
; calculate initial color
mov ecx, esi
; set coordinate
inc edx
; if gradient
cmp [buttontype], 0
je .next_line
call button._.incecx
align 4
je @f
call button._.incecx2
 
; set button height counter
@@:
mov edx, edi
 
.next_line:
call button._.button_dececx
push edi
xor edi, edi
; call [draw_line]
call __sys_draw_line
pop edi
add ebx, 0x00010001
dec edx
jnz .next_line
 
popad
 
; DRAW FRAME ----------------------------
pushad
call button._.button_calc_relativ
mov esi, common_colours
; draw button frame
 
mov edi, dword [esi+104]
call .top_border
mov edi, dword [esi+104]
call .bottom_border
mov edi, dword [esi+104]
call .right_border
mov edi, dword [esi+104]
call .left_border
popad
push ebx ecx
 
; DRAW 3D SHADOW ------------------------
test edx, 0x10000000
jnz .exit
; calculate window-relative coordinates
shr ebx, 16
shr ecx, 16
mov eax, [TASK_BASE]
add ebx, [eax - twdw + WDATA.box.left]
add ecx, [eax - twdw + WDATA.box.top]
 
pushad
mov edi, edx
call button._.button_calc_relativ
; get color address
mov esi, common_colours
test edi, 0x10000000
jnz @f
add eax, 0x10000
dec eax
inc ecx
dec edx
dec edx
align 4
@@:
mov edi, dword [esi+12]
call .top_border
mov edi, dword [esi+8]
call .bottom_border
mov edi, dword [esi+8]
call .right_border
mov edi, dword [esi+12]
call .left_border
popad
ret
 
align 4
.top_border:
; top border
mov eax, ebx
shl eax, 16
mov ax, bx
add ax, [esp + 4]
mov ebx, ecx
shl ebx, 16
mov bx , cx
mov ecx, edi
push ebx
xor edi, edi
mov ecx, esi
call button._.incecx
; call [draw_line]
call __sys_draw_line
ret
 
align 4
.bottom_border:
add bx , dx
rol ebx, 16
add bx , dx
mov ecx, edi
xor edi, edi
; bottom border
movzx edx, word[esp + 4 + 0]
add ebx, edx
shl edx, 16
add ebx, edx
mov ecx, esi
call button._.dececx
; call [draw_line]
call __sys_draw_line
ret
 
align 4
.right_border:
push eax
sub bx, dx
mov cx, ax
shl eax, 16
mov ax, cx
mov ecx, edi
xor edi, edi
; left border
pop ebx
push edx
mov edx, eax
shr edx, 16
mov ax, dx
mov edx, ebx
shr edx, 16
mov bx, dx
add bx, [esp + 4 + 0]
pop edx
mov ecx, esi
call button._.incecx
; call [draw_line]
call __sys_draw_line
pop eax
ret
 
align 4
.left_border:
shr eax, 16
mov cx, ax
shl eax, 16
mov ax, cx
mov ecx, edi
xor edi, edi
; right border
mov dx, [esp + 4]
add ax, dx
shl edx, 16
add eax, edx
add ebx, 0x00010000
mov ecx, esi
call button._.dececx
; call [draw_line]
call __sys_draw_line
ret
align 4
 
pop ecx ebx
 
.exit:
ret
 
274,10 → 269,8
jz .exit
 
mov ebx, dword[eax + SYS_BUTTON.id_hi - 2]
push edi ; spam
xor edi, edi
call button._.negative_button
pop edi
 
.exit:
ret
 
296,11 → 289,8
jz .exit
 
mov ebx, dword[eax + SYS_BUTTON.id_hi - 2]
push edi ; spam
xor edi, edi
inc edi
call button._.negative_button
pop edi
 
.exit:
ret
 
384,41 → 374,49
ret
 
;------------------------------------------------------------------------------
button._.button_dececx: ;//////////////////////////////////////////////////////
button._.dececx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
cmp [buttontype], 1
jne .finish
 
push eax
mov al, 1
;cmp edi, 20
;jg @f
;mov al, 2
 
@@:
sub cl, al
sub cl, 0x20
jnc @f
xor cl, cl
@@:
sub ch, al
sub ch, 0x20
jnc @f
xor ch, ch
@@:
rol ecx, 16
sub cl, al
sub cl, 0x20
jnc @f
xor cl, cl
@@:
rol ecx, 16
ret
 
pop eax
;------------------------------------------------------------------------------
button._.incecx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
add cl, 0x20
jnc @f
or cl, -1
@@:
add ch, 0x20
jnc @f
or ch, -1
@@:
rol ecx, 16
add cl, 0x20
jnc @f
or cl, -1
@@:
rol ecx, 16
ret
 
.finish:
ret
;------------------------------------------------------------------------------
button._.incecx: ;////////////////////////////////////////////////////////////
button._.incecx2: ;////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
437,26 → 435,40
@@:
rol ecx, 16
ret
 
;------------------------------------------------------------------------------
button._.button_calc_relativ: ;
button._.button_dececx: ;//////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
movzx edx, cx
dec edx ; get height
shr ebx, 16
shr ecx, 16
mov eax, [TASK_BASE]
add ebx, [eax - twdw + WDATA.box.left]
add ecx, [eax - twdw + WDATA.box.top]
mov eax, ebx
shl eax, 16
mov ax, bx
add ax, word[esp + 20]
dec eax
mov bx, cx
shl ebx, 16
mov bx, cx
cmp [buttontype], 1
jne .finish
 
push eax
mov al, 1
cmp edi, 20
jg @f
mov al, 2
 
@@:
sub cl, al
jnc @f
xor cl, cl
@@:
sub ch, al
jnc @f
xor ch, ch
@@:
rol ecx, 16
sub cl, al
jnc @f
xor cl, cl
@@:
rol ecx, 16
 
pop eax
 
.finish:
ret
 
;------------------------------------------------------------------------------
463,7 → 475,6
button._.negative_button: ;////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? Invert system button border
; edi - 0 activate, 1 - deactivate
;------------------------------------------------------------------------------
; if requested, do not display button border on press.
test ebx, 0x20000000
470,7 → 481,7
jnz .exit
 
pushad
push ebx
 
xchg esi, eax
 
movzx ecx, [esi + SYS_BUTTON.pslot]
488,58 → 499,10
add ax, cx
add bx, dx
 
xor edx, edx
mov dx, [esi + SYS_BUTTON.id_lo]
 
cmp dx, 1
jne .no_close
sub eax, 0x00010001
dec ebx
mov esi, 0x01000000
call draw_rectangle.forced
jmp .fade
align 4
.no_close:
cmp dx, 65535
jne .no_mini
sub eax, 0x00010001
dec ebx
mov esi, 0x01000000
call draw_rectangle.forced
jmp .fade
align 4
.no_mini:
add eax, 0x00010000
add ebx, 0x00010000
pop edx
test edx, 0x10000000
jnz .only_frame
mov edx, common_colours
mov esi, dword [edx+12]
cmp edi, 0
jne .shadow
mov esi, dword [edx+8]
align 4
.shadow:
call draw_rectangle.forced
align 4
.only_frame:
mov edx, common_colours
sub eax, 0x00010000
sub ebx, 0x00010000
mov esi, dword [edx+104]
cmp edi, 0
jne .draw
mov esi, dword [edx+112]
align 4
.draw:
call draw_rectangle.forced
 
popad
ret
align 4
.fade:
pop ebx
popad
align 4
 
.exit:
ret
/kernel/branches/kolibri-process/hid/keyboard.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
;; Distributed under terms of the GNU General Public License ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
457,40 → 457,19
test bl, bl
jz .exit.irq1
 
cmp cl, 0xE0 ; extended keycode
jne @f
test [kb_state], VKEY_NUMLOCK
jz .dowrite
 
cmp ch, 53
jne .dowrite
cmp cl, 0xE0
jz .dowrite
mov bl, '/'
jmp .dowrite
@@:
cmp ch, 55
jne @f
jnz @f
mov bl, '*'
mov bl, 0x2A ;*
jmp .dowrite
;--------------------------------------
@@:
 
cmp ch, 74
jne @f
mov bl, '-'
jmp .dowrite
@@:
 
cmp ch, 78
jne @f
mov bl, '+'
jmp .dowrite
@@:
 
test [kb_state], VKEY_NUMLOCK
jz .dowrite
 
cmp ch, 71
jb .dowrite
/kernel/branches/kolibri-process/kernel.asm
685,8 → 685,7
 
xchg bx, bx
 
; call v86_init
call init_sys_v86
call v86_init
 
mov esi, boot_inittimer
call boot_log
1009,6 → 1008,7
; Load PS/2 mouse driver
 
stdcall load_driver, szPS2MDriver
; stdcall load_driver, szCOM_MDriver
 
mov esi, boot_setmouse
call boot_log
/kernel/branches/kolibri-process/network/IPv4.inc
267,9 → 267,10
cmp eax, 224
je .ip_ok
 
; maybe we just dont have an IP yet and should accept everything on the IP level
; or a loopback address (127.0.0.0/8)
 
cmp [IP_LIST + edi], 0
and eax, 0x00ffffff
cmp eax, 127
je .ip_ok
 
; or it's just not meant for us.. :(
/kernel/branches/kolibri-process/network/stack.inc
110,7 → 110,7
SS_BLOCKED = 0x8000
 
 
SOCKET_MAXDATA = 4096*64 ; must be 4096*(power of 2) where 'power of 2' is at least 8
SOCKET_MAXDATA = 4096*8 ; must be 4096*(power of 2) where 'power of 2' is at least 8
MAX_backlog = 20 ; maximum backlog for stream sockets
 
; Error Codes