trunk: merge kolibri-acpi code

git-svn-id: svn://kolibrios.org@5595 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2015-07-22 11:17:45 +00:00
parent e5efe832f3
commit 1888797ed4
5 changed files with 91 additions and 9 deletions

View File

@ -495,6 +495,17 @@ struct RWSEM
count dd ? count dd ?
ends ends
struct FUTEX
list LHEAD
magic dd ?
handle dd ?
destroy dd ?
wait_list LHEAD
pointer dd ?
flags dd ?
ends
struct display_t struct display_t
x dd ? x dd ?
y dd ? y dd ?

View File

@ -1426,3 +1426,52 @@ destroy_kernel_object:
call free ;release object memory call free ;release object memory
ret ret
; param
; ecx= size
align 4
create_object:
push esi
push edi
pushfd
cli
mov esi, [current_process]
mov eax, [esi+PROC.ht_free]
mov edi, [esi+PROC.ht_next]
dec eax
js .err0
mov [esi+PROC.ht_free], eax
mov eax, [esi+PROC.htab+edi*4]
mov [esi+PROC.ht_next], eax
popfd
mov eax, ecx
call malloc
test eax, eax
jz .err1
mov [eax+FUTEX.handle], edi
mov [esi+PROC.htab+edi*4], eax
pop edi
pop esi
ret
.err1:
pushfd
cli
mov eax, [esi+PROC.ht_next]
mov [esi+PROC.htab+edi*4], eax
mov [esi+PROC.ht_next], edi
inc [esi+PROC.ht_free]
.err0:
popfd
pop edi
pop esi
xor eax, eax
ret

View File

@ -472,7 +472,7 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
mov [process], eax mov [process], eax
lea edi, [eax+PROC.heap_lock] lea edi, [eax+PROC.heap_lock]
mov ecx, (PROC.ht_next-PROC.heap_lock)/4 mov ecx, (PROC.ht_free-PROC.heap_lock)/4
list_init eax list_init eax
add eax, PROC.thr_list add eax, PROC.thr_list
@ -482,14 +482,17 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
cld cld
rep stosd rep stosd
mov [edi], dword (PROC.pdt_0 - PROC.htab)/4 - 3
mov [edi+4], dword 3 ;reserve handles for stdin stdout and stderr
mov ecx, (PROC.pdt_0 - PROC.htab)/4 mov ecx, (PROC.pdt_0 - PROC.htab)/4
add edi, 8
inc eax
@@: @@:
stosd stosd
inc eax inc eax
cmp eax, ecx cmp eax, ecx
jbe @B jbe @B
mov [edi-4096+PROC.ht_next], 3 ;reserve handles for stdin stdout and stderr
mov eax, edi mov eax, edi
call get_pg_addr call get_pg_addr
mov [edi-4096+PROC.pdt_0_phys], eax mov [edi-4096+PROC.pdt_0_phys], eax

View File

@ -702,11 +702,30 @@ setvideomode:
mov esi, boot_setostask mov esi, boot_setostask
call boot_log call boot_log
mov edi, sys_proc mov eax, sys_proc
list_init edi lea edi, [eax+PROC.heap_lock]
lea ecx, [edi+PROC.thr_list] mov ecx, (PROC.ht_free-PROC.heap_lock)/4
list_init ecx
mov [edi+PROC.pdt_0_phys], sys_proc-OS_BASE+PROC.pdt_0 list_init eax
add eax, PROC.thr_list
list_init eax
xor eax, eax
cld
rep stosd
mov [edi], dword (PROC.pdt_0 - PROC.htab)/4 - 3
mov [edi+4], dword 3 ;reserve handles for stdin stdout and stderr
mov ecx, (PROC.pdt_0 - PROC.htab)/4
add edi, 8
inc eax
@@:
stosd
inc eax
cmp eax, ecx
jbe @B
mov [sys_proc+PROC.pdt_0_phys], sys_proc-OS_BASE+PROC.pdt_0
mov eax, -1 mov eax, -1
mov edi, thr_slot_map+4 mov edi, thr_slot_map+4
@ -807,7 +826,6 @@ endg
call free_page call free_page
.no_wake_cpus: .no_wake_cpus:
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f ; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
mov esi, boot_initirq mov esi, boot_initirq
call boot_log call boot_log

View File

@ -111,7 +111,8 @@ struct PROC
io_map_0 rd 1 io_map_0 rd 1
io_map_1 rd 1 io_map_1 rd 1
ht_lock rd 1 ;htab[0] stdin ht_lock rd 1
ht_free rd 1 ;htab[0] stdin
ht_next rd 1 ;htab[1] stdout ht_next rd 1 ;htab[1] stdout
htab rd (4096-$)/4 ;htab[2] stderr htab rd (4096-$)/4 ;htab[2] stderr
pdt_0 rd 1024 pdt_0 rd 1024