forked from KolibriOS/kolibrios
create_futex()
git-svn-id: svn://kolibrios.org@5577 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
cdf5c48fbb
commit
e9583ee97f
@ -7,8 +7,7 @@
|
||||
|
||||
$Revision: 4420 $
|
||||
|
||||
|
||||
; Access through BIOS by diamond
|
||||
; Disk access through BIOS
|
||||
iglobal
|
||||
align 4
|
||||
bd_callbacks:
|
||||
@ -23,6 +22,16 @@ bd_callbacks:
|
||||
.end:
|
||||
endg
|
||||
|
||||
uglobal
|
||||
bios_hdpos dd 0
|
||||
bios_cur_sector dd ?
|
||||
bios_read_len dd ?
|
||||
cache_chain_ptr dd ?
|
||||
int13_regs_in rb sizeof.v86_regs
|
||||
int13_regs_out rb sizeof.v86_regs
|
||||
cache_chain_size db ?
|
||||
endg
|
||||
;-----------------------------------------------------------------
|
||||
proc bd_read_interface stdcall uses edi, \
|
||||
userdata, buffer, startsector:qword, numsectors
|
||||
; userdata = old [hdpos] = 80h + index in NumBiosDisks
|
||||
@ -76,7 +85,7 @@ endl
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
;-----------------------------------------------------------------
|
||||
proc bd_write_interface stdcall uses esi edi, \
|
||||
userdata, buffer, startsector:qword, numsectors
|
||||
; userdata = old [hdpos] = 80h + index in NumBiosDisks
|
||||
@ -142,7 +151,7 @@ endl
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
;-----------------------------------------------------------------
|
||||
; This is a stub.
|
||||
proc bd_querymedia stdcall, hd_data, mediainfo
|
||||
mov eax, [mediainfo]
|
||||
@ -153,16 +162,7 @@ proc bd_querymedia stdcall, hd_data, mediainfo
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; \begin{diamond}
|
||||
uglobal
|
||||
bios_hdpos dd 0 ; 0 is invalid value for [hdpos]
|
||||
bios_cur_sector dd ?
|
||||
bios_read_len dd ?
|
||||
endg
|
||||
;-----------------------------------------------------------------------------
|
||||
align 4
|
||||
;-----------------------------------------------------------------
|
||||
bd_read:
|
||||
push eax
|
||||
push edx
|
||||
@ -209,8 +209,7 @@ bd_read:
|
||||
.v86err:
|
||||
mov [hd_error], 1
|
||||
jmp hd_read_error
|
||||
;-----------------------------------------------------------------------------
|
||||
align 4
|
||||
;-----------------------------------------------------------------
|
||||
bd_write_cache_chain:
|
||||
pusha
|
||||
mov edi, OS_BASE + 0x9A000
|
||||
@ -234,13 +233,7 @@ bd_write_cache_chain:
|
||||
popa
|
||||
mov [hd_error], 1
|
||||
jmp hd_write_error
|
||||
;-----------------------------------------------------------------------------
|
||||
uglobal
|
||||
int13_regs_in rb sizeof.v86_regs
|
||||
int13_regs_out rb sizeof.v86_regs
|
||||
endg
|
||||
;-----------------------------------------------------------------------------
|
||||
align 4
|
||||
;-----------------------------------------------------------------
|
||||
int13_call:
|
||||
; Because this code uses fixed addresses,
|
||||
; it can not be run simultaniously by many threads.
|
||||
@ -290,4 +283,3 @@ int13_call:
|
||||
mov edx, ecx
|
||||
@@:
|
||||
ret
|
||||
; \end{diamond}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -165,7 +165,6 @@ pci_read_reg:
|
||||
|
||||
call pci_make_config_cmd
|
||||
mov ebx, eax
|
||||
; get current state
|
||||
mov dx, 0xcf8
|
||||
in eax, dx
|
||||
push eax
|
||||
@ -692,7 +691,7 @@ end virtual
|
||||
test eax, eax
|
||||
jz .nomemory
|
||||
mov edi, eax
|
||||
mov [edi+PCIDEV.vid_did], ecx
|
||||
mov [edi+PCIDEV.vendor_device_id], ecx
|
||||
mov edx, pcidev_list
|
||||
list_add_tail edi, edx
|
||||
mov eax, dword [.devfn]
|
||||
@ -704,19 +703,19 @@ end virtual
|
||||
shr eax, 8 ;FIXME use byte mask
|
||||
mov [edi+PCIDEV.class], eax
|
||||
|
||||
mov ah, [.bus]
|
||||
mov bh, byte [.devfn]
|
||||
mov al, 2
|
||||
mov bl, PCI_SUBSYSTEM_VENDOR_ID
|
||||
call pci_read_reg
|
||||
mov [edi+PCIDEV.svid_sdid], eax
|
||||
; mov ah, [.bus]
|
||||
; mov bh, byte [.devfn]
|
||||
; mov al, 2
|
||||
; mov bl, PCI_SUBSYSTEM_VENDOR_ID
|
||||
; call pci_read_reg
|
||||
; mov [edi+PCIDEV.svid_sdid], eax
|
||||
|
||||
mov ah, [.bus]
|
||||
mov al, 0
|
||||
mov bh, [.devfn]
|
||||
mov bl, PCI_IRQ_LINE
|
||||
call pci_read_reg
|
||||
mov [edi+PCIDEV.irq_line], al
|
||||
; mov ah, [.bus]
|
||||
; mov al, 0
|
||||
; mov bh, [.devfn]
|
||||
; mov bl, PCI_IRQ_LINE
|
||||
; call pci_read_reg
|
||||
; mov [edi+PCIDEV.irq_line], al
|
||||
|
||||
test byte [.devfn], 7
|
||||
jnz .next_func
|
||||
@ -739,6 +738,11 @@ end virtual
|
||||
ret
|
||||
endp
|
||||
|
||||
; Export for drivers. Just returns the pointer to the pci-devices list.
|
||||
proc get_pcidev_list
|
||||
mov eax, pcidev_list
|
||||
ret
|
||||
endp
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
@ -229,7 +229,6 @@ SLOT_BASE equ (OS_BASE+0x0080000)
|
||||
VGABasePtr equ (OS_BASE+0x00A0000)
|
||||
|
||||
CLEAN_ZONE equ (_CLEAN_ZONE-OS_BASE)
|
||||
IDE_DMA equ (_IDE_DMA-OS_BASE)
|
||||
|
||||
UPPER_KERNEL_PAGES equ (OS_BASE+0x0400000)
|
||||
|
||||
@ -493,9 +492,21 @@ ends
|
||||
|
||||
struct RWSEM
|
||||
wait_list LHEAD
|
||||
count dd ?
|
||||
count dd ?
|
||||
ends
|
||||
|
||||
struct FUTEX
|
||||
list LHEAD
|
||||
magic dd ?
|
||||
handle dd ?
|
||||
destroy dd ?
|
||||
|
||||
wait_list LHEAD
|
||||
pointer dd ?
|
||||
flags dd ?
|
||||
ends
|
||||
|
||||
|
||||
struct display_t
|
||||
x dd ?
|
||||
y dd ?
|
||||
|
@ -1340,3 +1340,72 @@ destroy_kernel_object:
|
||||
|
||||
call free ;release object memory
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; param
|
||||
; eñõ= 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
|
||||
|
||||
|
||||
align 4
|
||||
create_futex:
|
||||
mov ecx, sizeof.FUTEX
|
||||
call create_object
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [eax+FUTEX.magic], 'FUTX'
|
||||
mov [eax+FUTEX.destroy], 0
|
||||
lea ecx, [eax+FUTEX.wait_list]
|
||||
list_init ecx
|
||||
mov [eax+FUTEX.pointer], 0
|
||||
mov [eax+FUTEX.flags], 0
|
||||
|
||||
.fail:
|
||||
ret
|
||||
|
||||
|
@ -469,10 +469,11 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
|
||||
stdcall kernel_alloc, 0x2000
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [process], eax
|
||||
|
||||
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
|
||||
add eax, PROC.thr_list
|
||||
@ -482,14 +483,17 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
|
||||
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 [edi-4096+PROC.ht_next], 3 ;reserve handles for stdin stdout and stderr
|
||||
mov eax, edi
|
||||
call get_pg_addr
|
||||
mov [edi-4096+PROC.pdt_0_phys], eax
|
||||
|
@ -533,7 +533,6 @@ align 65536
|
||||
SB16Buffer rb 65536
|
||||
|
||||
align 4096
|
||||
_IDE_DMA rb 16*512
|
||||
BUTTON_INFO rb 64*1024
|
||||
RESERVED_PORTS: rb 64*1024
|
||||
|
||||
|
@ -702,11 +702,30 @@ setvideomode:
|
||||
mov esi, boot_setostask
|
||||
call boot_log
|
||||
|
||||
mov edi, sys_proc
|
||||
list_init edi
|
||||
lea ecx, [edi+PROC.thr_list]
|
||||
list_init ecx
|
||||
mov [edi+PROC.pdt_0_phys], sys_proc-OS_BASE+PROC.pdt_0
|
||||
mov eax, sys_proc
|
||||
lea edi, [eax+PROC.heap_lock]
|
||||
mov ecx, (PROC.ht_free-PROC.heap_lock)/4
|
||||
|
||||
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 edi, thr_slot_map+4
|
||||
@ -807,7 +826,6 @@ endg
|
||||
call free_page
|
||||
.no_wake_cpus:
|
||||
|
||||
|
||||
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
|
||||
mov esi, boot_initirq
|
||||
call boot_log
|
||||
|
@ -111,7 +111,8 @@ struct PROC
|
||||
io_map_0 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
|
||||
htab rd (4096-$)/4 ;htab[2] stderr
|
||||
pdt_0 rd 1024
|
||||
|
@ -1508,9 +1508,9 @@ SOCKET_ring_create:
|
||||
add eax, SOCKET_MAXDATA
|
||||
mov [esi + RING_BUFFER.end_ptr], eax
|
||||
mov eax, esi
|
||||
pop esi
|
||||
|
||||
.fail:
|
||||
pop esi
|
||||
ret
|
||||
|
||||
;-----------------------------------------------------------------
|
||||
|
@ -281,7 +281,7 @@ blit_32:
|
||||
mov ebp, [d_width_calc_area+ebp*4]
|
||||
|
||||
add ebp, ebx
|
||||
add ebp, [_WinMapAddress]
|
||||
add ebp, [_display.win_map]
|
||||
|
||||
mov eax, [esp+BLITTER.src_y]
|
||||
imul eax, [esp+BLITTER.stride]
|
||||
@ -370,7 +370,7 @@ align 4
|
||||
jnz .inner32
|
||||
|
||||
add esi, [esp+BLITTER.stride]
|
||||
add edi, [_display.pitch]
|
||||
add edi, [_display.lfb_pitch]
|
||||
add ebp, [_display.width]
|
||||
inc dword [esp+.x_y]
|
||||
|
||||
@ -432,7 +432,7 @@ align 4
|
||||
jnz .inner32
|
||||
|
||||
add esi, [esp+BLITTER.stride]
|
||||
add edi, [_display.pitch]
|
||||
add edi, [_display.lfb_pitch]
|
||||
add ebp, [_display.width]
|
||||
inc dword [esp+.x_y]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user