Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 164 → Rev 163

/kernel/trunk/drivers/CODEC.INC
File deleted
/kernel/trunk/drivers/INFINITY.ASM
File deleted
/kernel/trunk/drivers/MAIN.INC
File deleted
/kernel/trunk/drivers/SIS.ASM
File deleted
/kernel/trunk/drivers/PROC32.INC
File deleted
/kernel/trunk/drivers/Unisound.asm
File deleted
/kernel/trunk/drivers/MIXER.ASM
File deleted
/kernel/trunk/const.inc
File deleted
/kernel/trunk/PROC32.INC
File deleted
/kernel/trunk/kernel.asm
10,28 → 10,24
;; Compile with last version FASM
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include "proc32.inc"
include "kglobals.inc"
include "lang.inc"
 
include "const.inc"
WinMapAddress equ 0x460000
display_data = 0x460000
 
NEW equ 0
 
;WinMapAddress equ 0x460000
;display_data = 0x460000
 
max_processes equ 255
 
;window_data equ 0x0000
;tss_data equ 0xD20000
window_data equ 0x0000
tss_data equ 0xD20000
;tss_step equ (128+2048) ; tss & i/o - 16384 ports, * 256=557056
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
;draw_data equ 0xC00000
;sysint_stack_data equ 0xC03000
draw_data equ 0xC00000
sysint_stack_data equ 0xC03000
 
;twdw equ (0x3000-window_data)
 
twdw equ (0x3000-window_data)
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Included files:
120,7 → 116,17
 
; CR0 Flags - Protected mode and Paging
 
mov ecx, 0x00000021
mov ecx,0x00000001
;and ebx,65535
;cmp ebx,00100000000000000b ; lfb -> paging
;jb no_paging
;mov ax,0x0000
;mov es,ax
;mov al,[es:0x901E]
;cmp al,1
;je no_paging
;or ecx, 0x80000000
;no_paging:
 
; Enabling 32 bit protected mode
 
222,6 → 228,13
 
ret
 
uglobal
cpuid_0 dd 0,0,0,0
cpuid_1 dd 0,0,0,0
cpuid_2 dd 0,0,0,0
cpuid_3 dd 0,0,0,0
endg
 
iglobal
firstapp db '/rd/1/LAUNCHER',0
char db 'CHAR MT '
322,7 → 335,7
mov byte [0x2f0000+0x901e],0x0
mov eax,[0x2f0000+0x9018]
;no_d_lfb:
mov [LFBAddress],eax
mov [0xfe80],eax
 
cmp [0xfe0c],word 0100000000000000b
jge setvesa20
353,28 → 366,48
 
; MEMORY MODEL
 
call mem_test
mov [MEM_AMOUNT], eax
; mov [0xfe84],dword 0x100000*16 ; apps mem base address
; movzx ecx,byte [0x2f0000+0x9030]
; dec ecx
; mov eax,16*0x100000 ; memory-16
; shl eax,cl
; mov [0xfe8c],eax ; memory for use
; cmp eax,16*0x100000
; jne no16mb
; mov [0xfe84],dword 0xD80000 ; !!! 10 !!!
; no16mb:
 
mov [pg_data.mem_amount], eax
mov [pg_data.kernel_max], eax
; init:
; 1) 0xFE84 - applications base
; 2) 0xFE8C - total amount of memory
 
shr eax, 12
mov edx, eax
mov [pg_data.pages_count], eax
mov [pg_data.kernel_pages], eax
xor edi, edi
m_GMS_loop:
add edi, 0x400000
mov eax, dword [edi]
mov dword [edi], 'TEST'
wbinvd
cmp dword [edi], 'TEST'
jne m_GMS_exit
cmp dword [0], 'TEST'
je m_GMS_exit
mov dword [es:edi], eax
jmp m_GMS_loop
m_GMS_exit:
mov [edi], eax
; now edi contains the EXACT amount of memory
 
shr eax, 3
mov [pg_data.pagemap_size], eax
mov eax, 0x100000*16
cmp edi, eax ;0x100000*16
jb $ ; less than 16 Mb
 
shr edx, 10
cmp edx, 4
ja @f
inc edx ;at least 4Mb for kernel heap
mov dword [0xFE84], eax ;0x100000*16
cmp edi, eax ;0x100000*16
jne @f
mov dword [0xFE84], 0xD80000 ; =0x100000*13.5
@@:
mov [pg_data.kernel_tables], edx
mov dword [0xFE8C], edi
 
 
;!!!!!!!!!!!!!!!!!!!!!!!!!!
include 'detect/disks.inc'
;!!!!!!!!!!!!!!!!!!!!!!!!!!
381,98 → 414,42
 
; CHECK EXTRA REGION
; ENABLE PAGING
 
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
; btr [cpu_caps], CAPS_TSC ;test: don't use TSC
 
call init_memEx
call init_page_map
 
mov eax, sys_pgdir ;+PG_NOCACHE
mov cr3, eax
 
mov eax,cr0
or eax,0x80000000
mov cr0,eax
jmp $+2
 
call init_kernel_heap
call init_LFB
call init_mtrr
call MEM_Init
;add 0x800000-0xc00000 area
cmp word [0xfe0c],0x13
jle .less_memory
mov eax,0x800000 ;linear address
mov ebx,0x400000 shr 12 ;size in pages (4Mb)
mov ecx,0x800000 ;physical address
jmp .end_first_block
.less_memory:
mov eax,0x980000 ;linear address
mov ebx,0x280000 shr 12 ;size in pages (2.5Mb)
mov ecx,0x980000 ;physical address
.end_first_block:
call MEM_Add_Heap ;nobody can lock mutex yet
 
stdcall alloc_kernel_space, 0x50000
mov [ipc_tmp], eax
mov ebx, 0x1000
call create_general_page_table
;add 0x1000000(0xd80000)-end_of_memory area
mov eax,second_base_address
mov ebx,[0xfe8c]
mov ecx,[0xfe84]
sub ebx,ecx
shr ebx,12
add eax,ecx
call MEM_Add_Heap
;init physical memory manager.
call Init_Physical_Memory_Manager
 
add eax, 0x40000
mov [proc_mem_map], eax
mov dword [0xfe80],0x80000000 ;0x800000
 
add eax, 0x8000
mov [proc_mem_pdir], eax
 
add eax, ebx
mov [proc_mem_tab], eax
 
add eax, ebx
mov [current_pdir], eax
 
add eax, ebx
mov [tmp_task_pdir], eax
 
add eax, ebx
mov [tmp_task_ptab], eax
 
add eax, ebx
mov [ipc_pdir], eax
 
add eax, ebx
mov [ipc_ptab], eax
 
stdcall kernel_alloc, 0x1000
mov [tmp_task_data], eax
 
mov [dll_map], 0xFFFFFFFF
mov [srv_map], 0xFFFFFFFF
 
call alloc_dll
mov edi, eax
mov esi, szKernel
mov ecx, 16
rep movsb
 
bt [cpu_caps], CAPS_FXSR
jnc .no_FXSR
 
stdcall kernel_alloc, 512*256
mov [fpu_data], eax
mov ebx, cr4
or ebx, CR4_OSFXSR
mov cr4, ebx
jmp .clts
.no_FXSR:
stdcall kernel_alloc, 112*256
mov [fpu_data], eax
mov ebx, cr4
and ebx, not (CR4_OSFXSR+CR4_OSXMMEXPT)
mov cr4, ebx
.clts:
clts
fninit
 
mov edi, irq_tab
xor eax, eax
mov ecx, 16
rep stosd
 
;Set base of graphic segment to linear address of LFB
mov eax,[LFBAddress] ; set for gs
mov eax,[0xfe80] ; set for gs
mov [graph_data_l+2],ax
shr eax,16
mov [graph_data_l+4],al
525,12 → 502,23
or ecx, (10+29*6) shl 16 ; "Determining amount of memory"
sub ecx, 10
mov edx, 0xFFFFFF
mov ebx, [MEM_AMOUNT]
mov ebx, [0xFE8C]
shr ebx, 20
mov edi, 1
mov eax, 0x00040000
call display_number
 
; CHECK EXTENDED REGION
; mov dword [0x80000000],0x12345678
; cmp dword [0x80000000],0x12345678
; jz extended_region_found
; mov esi,boot_ext_region
; call boot_log
; jmp $
;extended_region_found:
 
 
 
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
 
mov esi,boot_irqs
547,11 → 535,64
; LOAD IDT
lidt [cs:idtreg]
 
; READ CPUID RESULT
 
mov esi,boot_cpuid
call boot_log
pushfd ; get current flags
pop eax
mov ecx,eax
xor eax,0x00200000 ; attempt to toggle ID bit
push eax
popfd
pushfd ; get new EFLAGS
pop eax
push ecx ; restore original flags
popfd
and eax,0x00200000 ; if we couldn't toggle ID,
and ecx,0x00200000 ; then this is i486
cmp eax,ecx
jz nopentium
; It's Pentium or later. Use CPUID
mov edi,cpuid_0
mov esi,0
cpuid_new_read:
mov eax,esi
cpuid
call cpuid_save
add edi,4*4
cmp esi,3
jge cpuid_done
cmp esi,[cpuid_0]
jge cpuid_done
inc esi
jmp cpuid_new_read
cpuid_save:
mov [edi+00],eax
mov [edi+04],ebx
mov [edi+8],ecx
mov [edi+12],edx
ret
cpuid_done:
nopentium:
 
; CR4 flags - enable fxsave / fxrstore
;
; finit
; mov eax,1
; cpuid
; test edx,1000000h
; jz fail_fpu
; mov eax,cr4
; or eax,200h ; Enable fxsave/fxstor
; mov cr4,eax
; fail_fpu:
 
;The CPU to this moment should be already in PM,
;and bit MP of the register cr0 should be installed in 1.
;finit ;reset of the FPU (finit, instead of fninit)
;fsetpm ;enable PM of the FPU
;finit ;reset the registers, contents which are still equal RM
finit ;reset of the FPU (finit, instead of fninit)
fsetpm ;enable PM of the FPU
finit ;reset the registers, contents which are still equal RM
;Now FPU too in PM
; DETECT DEVICES
 
607,19 → 648,6
; name for OS/IDLE process
mov dword [0x80000+256+APPDATA.app_name], dword 'OS/I'
mov dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
mov eax, [fpu_data]
mov dword [0x80000+APPDATA.fpu_state], eax
mov dword [0x80000+APPDATA.fpu_handler], 0
mov dword [0x80000+APPDATA.sse_handler], 0
 
add eax, 112
bt [cpu_caps], CAPS_FXSR
jnc .no_sse
add eax, 512-112
.no_sse:
mov dword [0x80000+256+APPDATA.fpu_state], eax
mov dword [0x80000+256+APPDATA.fpu_handler], 0
mov dword [0x80000+256+APPDATA.sse_handler], 0
; task list
mov [0x3020+TASKDATA.wnd_number], 1 ; on screen number
mov [0x3020+TASKDATA.pid], 1 ; process id number
697,6 → 725,11
movsd
call load_skin
 
; MTRR'S
 
call enable_mtrr
 
 
; LOAD FIRST APPLICATION
mov [0x3000],dword 1
mov [0x3004],dword 1
785,8 → 818,6
 
loop ready_for_irqs ; flush the queue
 
stdcall attach_int_handler, dword 1, irq1
 
; mov [dma_hdd],1
cmp [IDEContrRegsBaseAddr], 0
setnz [dma_hdd]
896,6 → 927,57
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
enable_mtrr:
 
pushad
 
cmp [0x2f0000+0x901c],byte 2
je no_mtrr
mov eax,[0xFE0C] ; if no LFB then no MTRR
test eax,0100000000000000b
jz no_mtrr
mov edx,[cpuid_1+3*4] ; edx - MTRR's supported ?
test edx,1000000000000b
jz no_mtrr
call find_empty_mtrr
cmp ecx,0
jz no_mtrr
mov esi,boot_mtrr ; 'setting mtrr'
call boot_log
mov edx,0x0 ; LFB , +8 M , write combine
mov eax,[0x2f9018]
or eax,1
wrmsr
inc ecx
mov edx,0xf
mov eax,0xff800800
wrmsr
mov ecx,0x2ff ; enable mtrr's
rdmsr
or eax,100000000000b ; set
wrmsr
no_mtrr:
 
popad
ret
 
 
find_empty_mtrr: ; 8 pairs checked
 
mov ecx,0x201-2
mtrr_find:
add ecx,2
cmp ecx,0x200+8*2
jge no_free_mtrr
rdmsr
test eax,0x0800
jnz mtrr_find
dec ecx
ret
no_free_mtrr:
mov ecx,0
ret
 
reserve_irqs_ports:
 
pushad
4264,8 → 4346,10
 
 
_rdtsc:
bt [cpu_caps], CAPS_TSC
jnc ret_rdtsc
 
mov edx,[cpuid_1+3*4]
test edx,00010000b
jz ret_rdtsc
rdtsc
ret
ret_rdtsc:
4540,6 → 4624,128
ret
 
 
sys_ipc:
cmp eax,1 ; DEFINE IPC MEMORY
jne no_ipc_def
mov edi,[0x3000]
shl edi,8
add edi,0x80000
mov [edi + APPDATA.ipc_start], ebx
mov [edi + APPDATA.ipc_size], ecx
mov [esp+36],dword 0
ret
no_ipc_def:
 
cmp eax,2 ; SEND IPC MESSAGE
jne no_ipc_send
mov esi,1
mov edi,0x3020
ipcs1:
cmp [edi+TASKDATA.pid], ebx
je ipcs2
add edi,0x20
inc esi
cmp esi,[0x3004]
jbe ipcs1
mov [esp+36],dword 4
ret
ipcs2:
 
cli
 
push esi
mov eax,esi
shl eax,8
mov ebx,[eax+0x80000 + APPDATA.ipc_start]
test ebx,ebx ; ipc area not defined ?
je ipc_err1
 
add ebx,[eax+0x80000 + APPDATA.ipc_size]
mov eax,esi
shl eax,5
add ebx,[eax+0x3000 + TASKDATA.mem_start] ; ebx <- max data position
 
mov eax,esi ; to
shl esi,8
add esi,0x80000
mov edi,[esi+APPDATA.ipc_start]
shl eax,5
add eax,0x3000
add edi,[eax+TASKDATA.mem_start]
 
cmp [edi],byte 0 ; overrun ?
jne ipc_err2
 
mov ebp,edi
add edi,[edi+4]
add edi,8
 
mov esi,ecx ; from
mov eax,[0x3010]
mov eax,[eax+TASKDATA.mem_start]
add esi,eax
 
mov ecx,edx ; size
 
mov eax,edi
add eax,ecx
cmp eax,ebx
jg ipc_err3 ; not enough room ?
 
push ecx
 
mov eax,[0x3010]
mov eax,[eax+TASKDATA.pid]
mov [edi-8],eax
mov [edi-4],ecx
cld
rep movsb
 
pop ecx
add ecx,8
 
mov edi,ebp ; increase memory position
add dword [edi+4],ecx
 
mov edi,[esp]
shl edi,8
or dword [edi+0x80000+APPDATA.event_mask],dword 01000000b ; ipc message
 
cmp [check_idle_semaphore],dword 20
jge ipc_no_cis
mov [check_idle_semaphore],5
ipc_no_cis:
 
xor eax, eax
 
ipc_err:
add esp,4
mov [esp+36],eax
sti
ret
 
ipc_err1:
add esp,4
mov [esp+36],dword 1
sti
ret
ipc_err2:
add esp,4
mov [esp+36],dword 2
sti
ret
ipc_err3:
add esp,4
mov [esp+36],dword 3
sti
ret
 
no_ipc_send:
 
mov [esp+36],dword -1
ret
 
 
align 4
 
sys_gs: ; direct screen access
5031,11 → 5237,6
 
buttontype dd 0x0
windowtypechanged dd 0x0
 
align 4
pg_data PG_DATA
heap_test dd ?
cpu_caps dd 4 dup(0)
endg
 
iglobal
/kernel/trunk/kernel32.inc
171,16 → 171,10
{
.app_name db 11 dup(?)
db 5 dup(?)
 
.fpu_state dd ? ;+16
.fpu_init dd ? ;+20
.fpu_handler dd ? ;+24
.sse_handler dd ? ;+28
.event dd ? ;+32
 
db 92 dup(?)
 
.wnd_shape dd ? ;+128
.fpu_save_area: db 108 dup(?)
db 3 dup(?)
.is_fpu_saved db ?
.wnd_shape dd ?
.wnd_shape_scale dd ?
dd ?
.mem_size dd ?
215,14 → 209,10
include "core/sys32.inc" ; process management
include "core/sched.inc" ; process scheduling
include "core/syscall.inc" ; system call
include "core/memory.inc"
include "core/heap.inc"
include "core/taskman.inc"
include "core/dll.inc"
include "core/exports.inc"
include "core/except.inc"
include "core/mem.inc" ; high-level memory management
include "core/newproce.inc" ;new process management
include "core/physmem.inc" ; access to physical memory for applications
 
 
; GUI stuff
include "gui/window.inc"
include "gui/event.inc"
/kernel/trunk/boot/bootcode.inc
474,9 → 474,6
cmp ax,0x004f
mov si, novesa-0x10000
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
827,7 → 824,7
mov al, 32 ; BPP
jb @f
mov [es:0x9000], al
mov dword [es:0x9018], 0xFFFFFFFF; 0x800000
mov dword [es:0x9018], 0x800000
@@:
mov [es:0x9008],bx
mov [es:0x900A],cx
1233,41 → 1230,37
; PAGE TABLE
 
push dword [es:0x9018]
;
; mmap_mem equ 64 ; amount of memory to map
;
 
map_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
;
;
xor di,di
mov cx,256*map_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]
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
mov eax, 0x7F000 +8+16 ; Page directory and enable caches
mov cr3, eax
 
; SET GRAPHICS
 
pop es
 
xor ax, ax
mov es, ax
 
mov ax,[es:0x9008] ; vga & 320x200
mov bx, ax
cmp ax,0x13
/kernel/trunk/core/exports.inc
File deleted
/kernel/trunk/core/dll.inc
File deleted
/kernel/trunk/core/taskman.inc
File deleted
/kernel/trunk/core/heap.inc
File deleted
/kernel/trunk/core/memory.inc
File deleted
/kernel/trunk/core/except.inc
File deleted
/kernel/trunk/core/sys32.inc
54,18 → 54,18
; -----------------------------------------
 
app_code_l:
dw 0xFFFF;((0x80000000-std_application_base_address) shr 12) and 0xffff
dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
dw 0
db 0x40
db cpl3
dw G32+D32+0x6000+0x7;
db 0
dw 11010000b*256+11111010b+256*((0x80000000-std_application_base_address) shr 28)
db std_application_base_address shr 24
 
app_data_l:
dw 0xFFFF;(0x80000000-std_application_base_address) shr 12 and 0xffff
dw (0x80000000-std_application_base_address) shr 12 and 0xffff
dw 0
db 0x40
db drw3
dw G32+D32+0x6000+0x7;
db 0
dw 11010000b*256+11110010b+256*((0x80000000-std_application_base_address) shr 28)
db std_application_base_address shr 24
 
graph_data_l:
 
81,10 → 81,11
gdte:
 
 
 
idtreg:
dw 8*0x41-1
dd idts+8
;label idts at 0xB100-8
label idts at 0xB100-8
 
 
 
165,20 → 166,16
 
ret
 
 
 
iglobal
sys_int:
dd e0,debug_exc,e2,e3
dd e4,e5,e6,e7
dd e8,e9,e10,e11
dd e12,e13,page_fault_handler,e15
 
dd except_16, e17
dd e0,debug_exc,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15
dd e16,e17
times 14 dd unknown_interrupt
 
dd irq0 , irq_serv.irq_1, p_irq2 ,irq_serv.irq_3
dd p_irq4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
dd irq_serv.irq_11,p_irq12,irqD ,p_irq14,p_irq15
dd irq0 ,irq1 ,p_irq2 ,p_irq3 ,p_irq4 ,p_irq5,p_irq6 ,p_irq7
dd p_irq8,p_irq9,p_irq10,p_irq11,p_irq12,irqD ,p_irq14,p_irq15
 
times 16 dd unknown_interrupt
 
219,7 → 216,7
jmp exc_c
}
 
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15 ; 18, 19
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 16 ; 18, 19
exc_w_code 8, 10, 11, 12, 13, 14, 17
 
exc_c:
279,46 → 276,25
mov ds, ax
mov es, ax
 
mov ebx, [fpu_owner]
cmp ebx, [CURRENT_TASK]
je .exit
mov eax, [prev_user_of_fpu]
shl eax, 8
add eax, 0x80000 + APPDATA.fpu_save_area
fsave [eax]
 
shl ebx, 8
mov eax, [ebx+PROC_BASE+APPDATA.fpu_state]
bt [cpu_caps], CAPS_FXSR
jnc .no_SSE
 
fxsave [eax]
mov ebx, [CURRENT_TASK]
mov [fpu_owner], ebx
shl ebx, 8
cmp dword [ebx+PROC_BASE+APPDATA.fpu_init], 0
je .init
mov eax, [ebx+PROC_BASE+APPDATA.fpu_state]
fxrstor [eax]
mov eax, [0x3000]
mov [prev_user_of_fpu], eax
shl eax, 8
add eax, 0x80000
cmp [eax + APPDATA.is_fpu_saved], 0
je @f
frstor [eax+APPDATA.fpu_save_area]
@@:
mov [eax + APPDATA.is_fpu_saved], 1
restore_ring3_context
iret
.init:
fninit ;­ ¬ ­¥ ­ã¦­ë ­¥¬ áª¨à®¢ ­­ë¥ ¨áª«î祭¨ï
mov dword [ebx+PROC_BASE+APPDATA.fpu_init], 1
.exit:
restore_ring3_context
iret
.no_SSE:
fnsave [eax]
mov ebx, [CURRENT_TASK]
mov [fpu_owner], ebx
shl ebx, 8
cmp dword [ebx+PROC_BASE+APPDATA.fpu_init], 0
je .init
 
mov eax, [ebx+PROC_BASE+APPDATA.fpu_state]
frstor [eax]
restore_ring3_context
iret
 
iglobal
fpu_owner dd 1
prev_user_of_fpu dd 1
endg
 
 
635,11 → 611,11
cmp eax,1
jne .no_application_mem_resize
 
stdcall new_mem_resize, ebx
mov [esp+36], eax
ret
jmp new_mem_resize ;resize for new type of processes
 
 
.no_application_mem_resize:
 
ret
 
 
756,16 → 732,11
call set_application_table_status
 
mov eax,esi
call dispose_app_cr3_table
 
pushad
shl eax,8
mov eax,[PROC_BASE+eax+0xB8]
stdcall destroy_app_space, eax
popad
 
cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1
cmp [prev_user_of_fpu],esi ; if user fpu last -> fpu user = 1
jne fpu_ok_1
mov [fpu_owner],1
mov [prev_user_of_fpu],1
fpu_ok_1:
 
mov [0xf400],byte 0 ; empty keyboard buffer
/kernel/trunk/core/syscall.inc
57,7 → 57,7
save_syscall_count dd 0x0
endg
 
;label save_syscall_data dword at 0x5000
label save_syscall_data dword at 0x5000
 
 
iglobal
132,7 → 132,7
dd undefined_syscall ; 57-reserved
dd file_system ; 58-Common file system interface
dd sys_trace ; 59-System call trace
dd sys_IPC ; 60-Inter Process Communication
dd new_sys_ipc ; 60-Inter Process Communication
dd sys_gs ; 61-Direct graphics access
dd sys_pci ; 62-PCI functions
dd sys_msg_board ; 63-System message board
140,7 → 140,7
dd undefined_syscall ; 65-UTF
dd sys_process_def ; 66-Process definitions - keyboard
dd sys_window_move ; 67-Window move or resize
dd new_services ; 68-Some internal services
dd sys_internal_services ; 68-Some internal services
dd sys_debug_services ; 69-Debug
dd file_system_lfn ; 70-Common file system interface, version 2
dd syscall_windowsettings ; 71-Window settings
/kernel/trunk/hid/keyboard.inc
86,12 → 86,12
 
align 4
irq1:
; save_ring3_context
; mov ax, os_data
; mov ds, ax
; mov es, ax
save_ring3_context
mov ax, os_data
mov ds, ax
mov es, ax
 
movzx eax,word[0x3004] ; top window process
mov eax, [0x3004] ; top window process
movzx eax,word[0xC400+eax*2]
shl eax,8
mov al,[0x80000+eax+APPDATA.keyboard_mode]
277,12 → 277,11
.exit.irq1:
mov [check_idle_semaphore],5
 
; mov al,0x20 ; ready for next irq
; out 0x20,al
mov al,0x20 ; ready for next irq
out 0x20,al
 
; restore_ring3_context
; iret
ret
restore_ring3_context
iret
 
set_lights:
mov al,0xED