kos_acpi:update

git-svn-id: svn://kolibrios.org@3500 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2013-05-11 12:38:27 +00:00
parent a524093376
commit 7f3e618a3a
48 changed files with 1441 additions and 769 deletions

View File

@ -150,7 +150,7 @@ struct DISK
; 0 if media fields are not used, nonzero otherwise. If .MediaRefCount is
; nonzero, this field is nonzero too; however, when .MediaRefCount goes
; to zero, there is some time interval during which media object is still used.
align 4
dw ? ; padding
; The following fields are not valid unless either .MediaInserted is nonzero
; or they are accessed from a code which has obtained the reference when
; .MediaInserted was nonzero.
@ -381,6 +381,7 @@ disk_add:
call mutex_init
xor eax, eax
mov dword [esi+DISK.MediaInserted], eax
mov [esi+DISK.MediaRefCount], eax
inc eax
mov [esi+DISK.RefCount], eax
; The DISK structure is initialized.

View File

@ -629,7 +629,9 @@ disk_sync:
mov [hdd_appl_data], 0
call write_cache
mov [hdd_appl_data], 1
jmp write_cache
call write_cache
mov eax, [hd_error]
ret
@@:
; The algorithm is straightforward.
push esi

View File

@ -340,7 +340,11 @@ hd_timeout_error:
; call clear_application_table_status
; mov esi,hd_timeout_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD tiempo de espera agotado\n"
else
DEBUGF 1,"K : FS - HD timeout\n"
end if
mov [hd_error], 1
pop eax
@ -352,7 +356,11 @@ hd_read_error:
; call clear_application_table_status
; mov esi,hd_read_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD error de lectura\n"
else
DEBUGF 1,"K : FS - HD read error\n"
end if
pop edx eax
ret
@ -362,7 +370,11 @@ hd_write_error:
; call clear_application_table_status
; mov esi,hd_write_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD error de escritura\n"
else
DEBUGF 1,"K : FS - HD write error\n"
end if
ret
hd_write_error_dma:
@ -370,7 +382,11 @@ hd_write_error_dma:
; call clear_application_table_status
; mov esi, hd_write_str
; call sys_msg_board_str
DEBUGF 1,"K : FS - HD read error\n"
if lang eq sp
DEBUGF 1,"K : FS - HD error de escritura\n"
else
DEBUGF 1,"K : FS - HD write error\n"
end if
pop esi
ret
@ -379,7 +395,11 @@ hd_lba_error:
; call clear_application_table_status
; mov esi,hd_lba_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD error en LBA\n"
else
DEBUGF 1,"K : FS - HD LBA error\n"
end if
jmp LBA_read_ret

View File

@ -2257,8 +2257,10 @@ fs_RamdiskDelete:
jmp .lfndel
.lfndone:
; delete FAT chain
test eax, eax
jz .done
cmp eax, 2
jb .done
cmp eax, 0xFF8
jae .done
lea eax, [RAMDISK_FAT + eax*2]
push dword [eax]
and word [eax], 0

View File

@ -24,7 +24,7 @@ sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only)
mov ebx, saverd_fileinfo
mov [saverd_fileinfo.name], ecx
pushad
call file_system_lfn ;in ebx
call file_system_lfn_protected ;in ebx
popad
mov [esp+32], eax
ret

View File

@ -863,6 +863,14 @@ else if lang eq et
mov [time_str+9], ' '
mov [time_str+10], ' '
@@:
else if lang eq sp
; esperar 5/4/3/2 segundos, 1 segundo
cmp al, 1
mov cl, 's'
ja @f
mov cl, ' '
@@:
mov [time_str+10], cl
else
; wait 5/4/3/2 seconds, 1 second
cmp al, 1
@ -917,7 +925,11 @@ if ~ defined extended_primary_loader
or al, 20h
cmp al, 'n'
jz .loadc
if lang eq sp
cmp al, 's'
else
cmp al, 'y'
end if
jnz .waityn
call putchar
mov byte [space_msg+80], 186

View File

@ -0,0 +1,101 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;======================================================================
;
; BOOT DATA
;
;======================================================================
$Revision: 2455 $
d80x25_bottom:
db 186,' KolibriOS is based on MenuetOS and comes with ABSOLUTELY '
db 'NO WARRANTY ',186
db 186,' See file COPYING for details '
db ' ',186
line_full_bottom
d80x25_bottom_num = 3
msg_apm db " APM x.x ", 0
novesa db "Display: EGA/CGA",13,10,0
s_vesa db "Version of VESA: "
.ver db "?.?",13,10,0
gr_mode db "Select a videomode: ",13,10,0
ask_bd db "Add disks visible by BIOS emulated in V86-mode? [1-yes, 2-no]: ",0
if defined extended_primary_loader
bdev db "Load ramdisk from [1-floppy; 2-kolibri.img]: ",0
else
bdev db "Load ramdisk from [1-floppy; 2-C:\kolibri.img (FAT32);"
db 13,10,186," "
db "3-use preloaded ram-image from kernel restart;"
db 13,10,186," "
db "4-create blank image]: ",0
end if
prnotfnd db "Fatal - Videomode not found.",0
not386 db "Fatal - CPU 386+ required.",0
fatalsel db "Fatal - Graphics mode not supported by hardware.",0
pres_key db "Press any key to choose a new videomode.",0
badsect db 13,10,186," Fatal - Bad sector. Replace floppy.",0
memmovefailed db 13,10,186," Fatal - Int 0x15 move failed.",0
okt db " ... OK"
linef db 13,10,0
diskload db "Loading diskette: 00 %",8,8,8,8,0
pros db "00"
backspace2 db 8,8,0
boot_dev db 0 ; 0=floppy, 1=hd
start_msg db "Press [abcd] to change settings, press [Enter] to continue booting",13,10,0
time_msg db " or wait "
time_str db " 5 seconds"
db " before automatical continuation",13,10,0
current_cfg_msg db "Current settings:",13,10,0
curvideo_msg db " [a] Videomode: ",0
mode0 db "320x200, EGA/CGA 256 colors",13,10,0
mode9 db "640x480, VGA 16 colors",13,10,0
usebd_msg db " [b] Add disks visible by BIOS:",0
on_msg db " on",13,10,0
off_msg db " off",13,10,0
preboot_device_msg db " [c] Floppy image: ",0
if defined extended_primary_loader
preboot_device_msgs dw 0,pdm1,pdm2,0
pdm1 db "real floppy",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
else
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "real floppy",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "use already loaded image",13,10,0
pdm4 db "create blank image",13,10,0
end if
loading_msg db "Loading KolibriOS...",0
if ~ defined extended_primary_loader
save_quest db "Remember current settings? [y/n]: ",0
loader_block_error db "Bootloader data invalid, I cannot continue. Stopped.",0
end if
_st db 186,' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄ¿',13,10,0
_r1 db 186,' ³ 320x200 EGA/CGA 256 colors ³ ³',13,10,0
_r2 db 186,' ³ 640x480 VGA 16 colors ³ ³',13,10,0
_rs db 186,' ³ ????x????@?? SVGA VESA ³ ³',13,10,0
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,0
remark1 db "Default values were selected to match most of configurations, but not all.",0
remark2 db "If the system does not boot, try to disable the item [b].",0
remarks dw remark1, remark2
num_remarks = 2

View File

@ -0,0 +1,103 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;======================================================================
;
; BOOT DATA
;
;======================================================================
; Para modificar ste archivo es necesario abrirlo con codificaci¢n CP850
$Revision: 2455 $
d80x25_bottom:
db 186,' KolibriOS est  basado en MenuetOS y viene ABSOLUTAMENTE '
db 'SIN GARANT¡A ',186
db 186,' Lee el archivo COPYING por m s detalles '
db ' ',186
line_full_bottom
d80x25_bottom_num = 3
msg_apm db " APM x.x ", 0
novesa db "Monitor: EGA/CGA",13,10,0
s_vesa db "Versi¢n de VESA: "
.ver db "?.?",13,10,0
gr_mode db "Selecciona un modo de video: ",13,10,0
ask_bd db "¨Agregar discos visibles por el BIOS emulados en modo V86? [1-si, 2-no]: ",0
if defined extended_primary_loader
bdev db "Cargar unidad ram desde [1-disquete; 2-kolibri.img]: ",0
else
bdev db "Cargar unidad ram desde [1-disquete; 2-C:\kolibri.img (FAT32);"
db 13,10,186," "
db "3-usar imagen precargada en el reinicio del n£cleo;"
db 13,10,186," "
db "4-crear imagen vac¡a]: ",0
end if
prnotfnd db "Fatal - Modo de video no encontrado.",0
not386 db "Fatal - CPU 386+ requerido.",0
fatalsel db "Fatal - Modo de gr ficos no soportado por hardware.",0
pres_key db "Presiona una tecla para seleccionar otro modo de video.",0
badsect db 13,10,186," Fatal - Sector mal. Reemplaze el disquete.",0
memmovefailed db 13,10,186," Fatal - Int 0x15 move failed.",0
okt db " ... BIEN"
linef db 13,10,0
diskload db "Cargando disquete: 00 %",8,8,8,8,0
pros db "00"
backspace2 db 8,8,0
boot_dev db 0 ; 0=floppy, 1=hd
start_msg db "Presiona [abcd] para cambiar la configuraci¢n, [Enter] para continuar",13,10,0
time_msg db " o espera "
time_str db " 5 segundos"
db " para que inicie autom ticamente",13,10,0
current_cfg_msg db "Configuraci¢n actual:",13,10,0
curvideo_msg db " [a] Modo de video: ",0
mode0 db "320x200, EGA/CGA 256 colores",13,10,0
mode9 db "640x480, VGA 16 colores",13,10,0
usebd_msg db " [b] Agregar discos visibles por el BIOS:",0
on_msg db " activado",13,10,0
off_msg db " desactivado",13,10,0
preboot_device_msg db " [c] Imagen de disquete: ",0
if defined extended_primary_loader
preboot_device_msgs dw 0,pdm1,pdm2,0
pdm1 db "disquete real",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
else
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "disquete real",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "usar imagen ya cargada",13,10,0
pdm4 db "crear imagen vac¡a",13,10,0
end if
loading_msg db "Cargando KolibriOS...",0
if ~ defined extended_primary_loader
save_quest db "¨Recordar configuraci¢n actual? [s/n]: ",0
loader_block_error db "Bootloader inv lido, no puedo continuar. Detenido.",0
end if
_st db 186,' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄ¿',13,10,0
_r1 db 186,' ³ 320x200 EGA/CGA 256 colores ³ ³',13,10,0
_r2 db 186,' ³ 640x480 VGA 16 colores ³ ³',13,10,0
_rs db 186,' ³ ????x????@?? SVGA VESA ³ ³',13,10,0
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,0
remark1 db "Los valores por defecto puede que no funcionen en algunas configuraciones.",0
remark2 db "Si el sistema no inicia, prueba deshabilitar la opci¢n [b].",0
remarks dw remark1, remark2
num_remarks = 2

View File

@ -103,7 +103,7 @@ endg
read_image:
mov ebx, read_image_fsinfo
pushad
call file_system_lfn
call file_system_lfn_protected
popad
ret

View File

@ -15,6 +15,8 @@
;
; Version 1.0
include "lang.inc"
lf equ 0ah
cr equ 0dh
@ -262,7 +264,11 @@ conv_abs_to_THS:
retn
;------------------------------------------
if lang eq sp
loading db cr,lf,'Iniciando el sistema ',00h
else
loading db cr,lf,'Starting system ',00h
end if
error_message db 13,10
kernel_name db 'KERNEL MNT ?',cr,lf,00h
FirstRootDirSecNum dw ?

View File

@ -155,12 +155,12 @@ pci_make_config_cmd:
align 4
pci_read_reg:
push ebx esi
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_read_reg_2
; mechanism 1
push esi ; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
call pci_make_config_cmd
@ -202,15 +202,14 @@ pci_fin_read1:
out dx, eax
pop eax
pop esi
pop esi ebx
ret
pci_read_reg_2:
test bh, 128 ;mech#2 only supports 16 devices per bus
jnz pci_read_reg_err
push esi; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
push eax
@ -262,12 +261,13 @@ pci_fin_read2:
out dx, al
pop eax
pop esi
pop esi ebx
ret
pci_read_reg_err:
xor eax, eax
dec eax
pop esi ebx
ret
@ -286,12 +286,12 @@ pci_read_reg_err:
align 4
pci_write_reg:
push esi ebx
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_write_reg_2
; mechanism 1
push esi ; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
call pci_make_config_cmd
@ -335,7 +335,7 @@ pci_fin_write1:
out dx, eax
xor eax, eax
pop esi
pop ebx esi
ret
pci_write_reg_2:
@ -344,8 +344,7 @@ pci_write_reg_2:
jnz pci_write_reg_err
push esi; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
push eax
@ -397,12 +396,13 @@ pci_fin_write2:
out dx, al
xor eax, eax
pop esi
pop ebx esi
ret
pci_write_reg_err:
xor eax, eax
dec eax
pop ebx esi
ret
if defined mmio_pci_addr ; must be set above
@ -658,3 +658,67 @@ sys_pcibios:
.return_a:
mov dword[esp + 32], eax
ret
proc pci_enum
push ebp
mov ebp, esp
push 0
virtual at ebp-4
.devfn db ?
.bus db ?
end virtual
.loop:
mov ah, [.bus]
mov al, 2
mov bh, [.devfn]
mov bl, 0
call pci_read_reg
cmp eax, 0xFFFFFFFF
jnz .has_device
test byte [.devfn], 7
jnz .next_func
jmp .no_device
.has_device:
push eax
push sizeof.PCIDEV
pop eax
call malloc
pop ecx
test eax, eax
jz .nomemory
mov edi, eax
mov [edi+PCIDEV.vendor_device_id], ecx
mov eax, pcidev_list
mov ecx, [eax+PCIDEV.bk]
mov [edi+PCIDEV.bk], ecx
mov [edi+PCIDEV.fd], eax
mov [ecx+PCIDEV.fd], edi
mov [eax+PCIDEV.bk], edi
mov eax, dword [.devfn]
mov word [edi+PCIDEV.devfn], ax
mov bh, al
mov al, 2
mov bl, 8
call pci_read_reg
shr eax, 8
mov [edi+PCIDEV.class], eax
test byte [.devfn], 7
jnz .next_func
mov ah, [.bus]
mov al, 0
mov bh, [.devfn]
mov bl, 0Eh
call pci_read_reg
test al, al
js .next_func
.no_device:
or byte [.devfn], 7
.next_func:
inc dword [.devfn]
mov ah, [.bus]
cmp ah, [BOOT_VAR+0x9021]
jbe .loop
.nomemory:
leave
ret
endp

View File

@ -218,10 +218,10 @@ KEY_BUFF equ (OS_BASE+0x000F401)
BTN_COUNT equ (OS_BASE+0x000F500)
BTN_BUFF equ (OS_BASE+0x000F501)
CPU_FREQ equ (OS_BASE+0x000F600)
;CPU_FREQ equ (OS_BASE+0x000F600)
;unused ? no active references
MOUSE_PORT equ (OS_BASE+0x000F604)
;MOUSE_PORT equ (OS_BASE+0x000F604)
;unused
PS2_CHUNK equ (OS_BASE+0x000FB00)
@ -570,6 +570,35 @@ struct MUTEX
count dd ?
ends
struct PCIDEV
bk dd ?
fd dd ?
vendor_device_id dd ?
class dd ?
devfn db ?
bus db ?
ends
; The following macro assume that we are on uniprocessor machine.
; Serious work is needed for multiprocessor machines.
macro spin_lock_irqsave spinlock
{
pushf
cli
}
macro spin_unlock_irqrestore spinlock
{
popf
}
macro spin_lock_irq spinlock
{
cli
}
macro spin_unlock_irq spinlock
{
sti
}
struct MEM_STATE
mutex MUTEX
smallmap dd ?

View File

@ -380,6 +380,33 @@ proc enable_irq stdcall, irq_line:dword
ret
endp
proc disable_irq stdcall, irq_line:dword
mov ebx, [irq_line]
cmp [irq_mode], IRQ_APIC
je .APIC
mov edx, 0x21
cmp ebx, 8
jb @F
mov edx, 0xA1
sub ebx, 8
@@:
in al, dx
bts eax, ebx
out dx, al
ret
.APIC:
shl ebx, 1
add ebx, 0x10
mov eax, ebx
call IOAPIC_read
or eax, 0x10000; bit 16
xchg eax, ebx
call IOAPIC_write
ret
endp
align 4
pci_irq_fixup:
@ -419,6 +446,7 @@ pci_irq_fixup:
pop ebp
ret
if 0
align 4
start_ap:
;eax= cpu id
@ -448,6 +476,8 @@ CMD_IPI_START equ (IPI_START+IPI_LEVEL_ASSERT)+((0x10000+__ap_start_16) shr 12)
.exit:
ret
end if

View File

@ -0,0 +1,11 @@
; <EFBFBD>ste archivo debe ser editado con codificaci¢n CP866
ugui_mouse_speed db 'velocidad del rat¢n',0
ugui_mouse_delay db 'demora del rat¢n',0
udev db 'disp',0
unet db 'red',0
unet_active db 'activa',0
unet_addr db 'direc',0
unet_mask db 'm sc',0
unet_gate db 'puer',0

View File

@ -67,12 +67,8 @@ proc set_kernel_conf
endp
iglobal
ugui db 'gui',0
ugui_mouse_speed db 'mouse_speed',0
ugui_mouse_speed_def db '2',0
ugui_mouse_delay db 'mouse_delay',0
ugui_mouse_delay_def db '0x00A',0
udev db 'dev',0
udev_midibase db 'midibase',0
udev_midibase_def db '0x320',0
endg
@ -125,11 +121,18 @@ endl
endp
iglobal
unet db 'net',0
unet_active db 'active',0
unet_addr db 'addr',0
unet_mask db 'mask',0
unet_gate db 'gate',0
if lang eq sp
include 'core/conf_lib-sp.inc'
else
ugui_mouse_speed db 'mouse_speed',0
ugui_mouse_delay db 'mouse_delay',0
udev db 'dev',0
unet db 'net',0
unet_active db 'active',0
unet_addr db 'addr',0
unet_mask db 'mask',0
unet_gate db 'gate',0
end if
unet_def db 0
endg
; convert string to DWord

View File

@ -369,7 +369,7 @@ proc read_file stdcall,file_name:dword, buffer:dword, off:dword,\
pushad
lea ebx, [cmd]
call file_system_lfn
call file_system_lfn_protected
popad
ret
endp

View File

@ -154,11 +154,11 @@ proc init_kernel_heap
mov [ecx+block_next], eax
mov [ecx+block_prev], ebx
mov [edi+list_fd], eax
mov [edi+list_bk], eax
mov [edi+block_base], eax
mov [edi+block_size], eax
mov [edi+block_flags], USED_BLOCK
mov [ecx+list_fd], eax
mov [ecx+list_bk], eax
mov [ecx+block_base], eax
mov [ecx+block_size], eax
mov [ecx+block_flags], USED_BLOCK
mov [ebx+block_next], ecx
mov [ebx+block_prev], edi
@ -440,6 +440,7 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
cmp edx, [edx]
jne .add_block
btr [mem_block_mask], ecx
.add_block:
bts [mem_block_mask], eax
lea edx, [mem_block_list+eax*8]
@ -758,11 +759,13 @@ proc user_alloc_at stdcall, address:dword, alloc_size:dword
inc ebx
dec eax
jnz .fill
.second_nofill:
sub ecx, edx
jz .nothird
or cl, FREE_BLOCK
mov [page_tabs+ebx*4], ecx
.nothird:
mov edx, [current_slot]
@ -822,6 +825,7 @@ proc user_free stdcall, base:dword
inc esi
dec ecx
jnz .release
.released:
push edi

View File

@ -1470,33 +1470,6 @@ proc set_mtrr stdcall, base:dword,size:dword,mem_type:dword
ret
endp
align 4
proc stall stdcall, delay:dword
push ecx
push edx
push ebx
push eax
mov eax, [delay]
mul [stall_mcs]
mov ebx, eax ;low
mov ecx, edx ;high
rdtsc
add ebx, eax
adc ecx, edx
@@:
rdtsc
sub eax, ebx
sbb edx, ecx
jb @B
pop eax
pop ebx
pop edx
pop ecx
ret
endp
align 4
proc create_ring_buffer stdcall, size:dword, flags:dword
locals

View File

@ -283,11 +283,15 @@ __exports:
alloc_page, 'AllocPage', \ ; gcc ABI
alloc_pages, 'AllocPages', \ ; stdcall
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
\
disk_add, 'DiskAdd', \ ;stdcall
disk_media_changed, 'DiskMediaChanged', \ ;stdcall
\
create_event, 'CreateEvent', \ ; ecx, esi
destroy_event, 'DestroyEvent', \ ;
raise_event, 'RaiseEvent', \ ; eax, ebx, edx, esi
wait_event, 'WaitEvent', \ ; eax, ebx
wait_event_timeout, 'WaitEventTimeout', \ ; eax, ebx, ecx
get_event_ex, 'GetEvent', \ ; edi
\
create_kernel_object, 'CreateObject', \
@ -331,7 +335,8 @@ __exports:
delay_hs, 'Delay', \ ; ebx
set_mouse_data, 'SetMouseData', \ ;
set_keyboard_data, 'SetKeyboardData', \ ; gcc fastcall
timer_hs, 'TimerHs' ; stdcall
timer_hs, 'TimerHs', \ ; stdcall
get_cpu_freq, 'GetCpuFreq'

View File

@ -0,0 +1,4 @@
; <EFBFBD>ste archivo debe ser editado con codificaci¢n CP866
msg_sel_ker db "n£cleo", 0
msg_sel_app db "aplicaci¢n", 0

View File

@ -13,7 +13,6 @@
$Revision$
align 4 ;3A08
build_interrupt_table:
mov edi, idts
@ -75,8 +74,12 @@ iglobal
msg_exc_d db "General protection fault", 0
msg_exc_e db "Page fault", 0
if lang eq sp
include 'core/sys32-sp.inc'
else
msg_sel_ker db "kernel", 0
msg_sel_app db "application", 0
end if
endg
@ -213,7 +216,11 @@ show_error_parameters:
pop ebx
.no_ud:
mov edx, [TASK_BASE];not scratched below
DEBUGF 1, "K : Process - forced terminate PID: %x\n", [edx+TASKDATA.pid]
if lang eq sp
DEBUGF 1, "K : Proceso - terminado forzado PID: %x [%s]\n", [edx+TASKDATA.pid], [current_slot]
else
DEBUGF 1, "K : Process - forced terminate PID: %x [%s]\n", [edx+TASKDATA.pid], [current_slot]
end if
cmp bl, 0x08
jb .l0
cmp bl, 0x0e
@ -707,3 +714,78 @@ restore .slot
; mov esi,boot_sched_2
; call boot_log
; ret
; Three following procedures are used to guarantee that
; some part of kernel code will not be terminated from outside
; while it is running.
; Note: they do not protect a thread from terminating due to errors inside
; the thread; accessing a nonexisting memory would still terminate it.
; First two procedures must be used in pair by thread-to-be-protected
; to signal the beginning and the end of an important part.
; It is OK to have nested areas.
; The last procedure must be used by outside wanna-be-terminators;
; if it is safe to terminate the given thread immediately, it returns eax=1;
; otherwise, it returns eax=0 and notifies the target thread that it should
; terminate itself when leaving a critical area (the last critical area if
; they are nested).
; Implementation. Those procedures use one dword in APPDATA for the thread,
; APPDATA.terminate_protection.
; * The upper bit is 1 during normal operations and 0 when terminate is requested.
; * Other bits form a number = depth of critical regions,
; plus 1 if the upper bit is 1.
; * When this dword goes to zero, the thread should be destructed,
; and the procedure in which it happened becomes responsible for destruction.
; Enter critical area. Called by thread which wants to be protected.
proc protect_from_terminate
mov edx, [current_slot]
; Atomically increment depth of critical areas and get the old value.
mov eax, 1
lock xadd [edx+APPDATA.terminate_protection], eax
; If the old value was zero, somebody has started to terminate us,
; so we are destructing and cannot do anything protected.
; Otherwise, return to the caller.
test eax, eax
jz @f
ret
@@:
; Wait for somebody to finish us.
call change_task
jmp @b
endp
; Leave critical area. Called by thread which wants to be protected.
proc unprotect_from_terminate
mov edx, [current_slot]
; Atomically decrement depth of critical areas.
lock dec [edx+APPDATA.terminate_protection]
; If the result of decrement is zero, somebody has requested termination,
; but at that moment we were inside a critical area; terminate now.
jz sys_end
; Otherwise, return to the caller.
ret
endp
; Request termination of thread identified by edx = SLOT_BASE + slot*256.
; Called by anyone.
proc request_terminate
xor eax, eax ; set return value
; Atomically clear the upper bit. If it was already zero, then
; somebody has requested termination before us, so just exit.
lock btr [edx+APPDATA.terminate_protection], 31
jnc .unsafe
; Atomically decrement depth of critical areas.
lock dec [edx+APPDATA.terminate_protection]
; If the result of decrement is nonzero, the target thread is inside a
; critical area; leave termination to leaving that area.
jnz .unsafe
; Otherwise, it is safe to kill the target now and the caller is responsible
; for this. Return eax=1.
inc eax
.unsafe:
ret
endp

View File

@ -38,9 +38,13 @@ sysenter_entry:
pushad
cld
movzx eax, al
call protect_from_terminate
movzx eax, byte [esp+28]
mov edx, dword [esp+20]
call dword [servetable2 + eax * 4]
call unprotect_from_terminate
popad
;------------------
xchg ecx, [ss:esp] ; â âåðøèí ñòåêà - app ecx, ecx - app esp + 4
@ -62,8 +66,11 @@ align 16
i40:
pushad
cld
movzx eax, al
call protect_from_terminate
movzx eax, byte [esp+28]
mov edx, dword [esp+20]
call dword [servetable2 + eax * 4]
call unprotect_from_terminate
popad
iretd
@ -85,10 +92,13 @@ syscall_entry:
;------------------
pushad
cld
call protect_from_terminate
movzx eax, al
movzx eax, byte [esp+28]
mov edx, dword [esp+20]
call dword [servetable2 + eax * 4]
call unprotect_from_terminate
popad
;------------------
mov ecx, [ss:esp+4]
@ -125,7 +135,7 @@ iglobal
dd sys_getkey ; 2-GetKey
dd sys_clock ; 3-GetTime
dd syscall_writetext ; 4-WriteText
dd delay_hs ; 5-DelayHs
dd delay_hs_unprotected ; 5-DelayHs
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
dd syscall_putimage ; 7-PutImage
dd syscall_button ; 8-DefineButton

View File

@ -1023,6 +1023,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
mov [eax+SLOT_BASE+APPDATA.exc_handler], 0
mov [eax+SLOT_BASE+APPDATA.except_mask], 0
mov [eax+SLOT_BASE+APPDATA.terminate_protection], 80000001h
;set default io permission map
mov ecx, [SLOT_BASE+256+APPDATA.io_map]
@ -1147,6 +1148,14 @@ proc set_app_params stdcall,slot:dword, params:dword,\
mov eax, [esi+0x08] ;app_eip
mov [ebx+REG_EIP], eax;app_entry
mov [ebx+REG_CS], dword app_code
mov eax, [CURRENT_TASK]
shl eax, 8 ; created by kernel?
cmp [SLOT_BASE+eax+APPDATA.dir_table], sys_pgdir - OS_BASE
jnz @f
cmp [app_path], 0 ; it is a thread?
jnz @f
mov [ebx+REG_CS], dword os_code ; kernel thread
@@:
mov [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
mov eax, [esi+0x0C] ;app_esp

View File

@ -888,6 +888,7 @@ v86_irq2:
.cont2:
pop ecx
.cont:
add ebx, 0x100
loop .scan
mov ecx, edi
call irq_eoi

View File

@ -87,6 +87,8 @@ if lang eq ru
if preboot_blogesc
boot_tasking db '‚ᥠ£®â®¢® ¤«ï § ¯ã᪠, ­ ¦¬¨âॠESC ¤«ï áâ àâ ',0
end if
else if lang eq sp
include 'data32sp.inc'
else
boot_initirq db 'Initialize IRQ',0
boot_picinit db 'Initialize PIC',0
@ -131,8 +133,10 @@ 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
if ~ lang eq sp
msg_version db 'incompatible driver version',13,10,0
msg_www db 'please visit www.kolibrios.org',13,10,0
end if
msg_CR db 13,10,0
intel_str db "GenuineIntel",0
@ -155,7 +159,7 @@ firstapp db 'LAUNCHER',0
notifyapp db '@notify',0
if lang eq ru
ud_user_message db 'Žè¨¡ª : ­¥¯®¤¤¥à¦¨¢ ¥¬ ï ¨­áâàãªæ¨ï ¯à®æ¥áá®à ',0
else
else if ~ lang eq sp
ud_user_message db 'Error: unsupported processor instruction',0
end if
@ -177,6 +181,10 @@ dll_list:
.bk dd dll_list
.fd dd dll_list
pcidev_list:
.bk dd pcidev_list
.fd dd pcidev_list
MAX_DEFAULT_DLL_ADDR = 0x80000000
MIN_DEFAULT_DLL_ADDR = 0x70000000
dll_cur_addr dd MIN_DEFAULT_DLL_ADDR
@ -324,6 +332,8 @@ mem_block_list rd 64*2
mem_used_list rd 64*2
mem_hash_cnt rd 64
cpu_freq rq 1
heap_mutex MUTEX
heap_size rd 1
heap_free rd 1
@ -382,7 +392,6 @@ default_io_map rd 1
LFBSize rd 1
stall_mcs rd 1
current_slot rd 1
; status

View File

@ -0,0 +1,40 @@
boot_initirq db 'Inicializar IRQ',0
boot_picinit db 'Inicializar PIC',0
boot_v86machine db 'Inicializar sistema V86',0
boot_inittimer db 'Inicializar reloj del sistema (IRQ0)',0
boot_initapic db 'Prueba inicializar APIC',0
boot_enableirq db 'Habilitar interrupciones 2, 6, 13, 14, 15',0
boot_enablint_ide db 'Habiliar interrupciones en controladores IDE',0
boot_detectfloppy db 'Buscar unidades de disquete',0
boot_detecthdcd db 'Buscar discos duros y unidades ATAPI',0
boot_getcache db 'Tomar memoria para cach',0
boot_detectpart db 'Buscar particiones en discos',0
boot_init_sys db 'Inicializar directorio del sistema /sys',0
boot_loadlibs db 'Cargando librer¡as (.obj)',0
boot_memdetect db 'Determinando cantidad de memoria',0
boot_tss db 'Configurando TSSs',0
boot_cpuid db 'Leyendo CPUIDs',0
; boot_devices db 'Detectando dispositivos',0
boot_setmouse db 'Configurando el rat¢n',0
boot_windefs db 'Setting window defaults',0
boot_bgr db 'Calculating background',0
boot_resirqports db 'Reservando IRQs y puertos',0
boot_setostask db 'Configurando tarea OS',0
boot_allirqs db 'Desenmascarando IRQs',0
boot_tsc db 'Leyendo TSC',0
boot_cpufreq db 'La frequencia del CPU es ',' ',' MHz',0
boot_pal_ega db 'Configurando paleta EGA/CGA 320x200',0
boot_pal_vga db 'Configurando paleta VGA 640x480',0
boot_failed db 'Fallo al iniciar la primer aplicaci¢n',0
boot_mtrr db 'Configurando MTRR',0
boot_APIC_found db 'APIC habilitado', 0
boot_APIC_nfound db 'APIC no encontrado', 0
if preboot_blogesc
boot_tasking db 'Todo configurado - presiona ESC para iniciar',0
end if
msg_version db 'versi¢n incompatible del controlador',13,10,0
msg_www db 'por favor, visita www.kolibrios.org',13,10,0
ud_user_message db 'Error: instrucci¢n no soportada por el procesador',0

View File

@ -13,14 +13,12 @@ drivers. They must be called in the following order: DiskAdd, then zero or
more DiskMediaChanged, then optionally DiskDel. The driver must not call
two functions in parallel, including two calls to DiskMediaChanged.
void* DiskAdd(DISKFUNC* functions, const char* name, void* userdata, int flags);
; The pointer 'functions' must be valid at least until the disk will be deleted
; (until DISKFUNC.close is called).
; The pointer 'name' can be invalid after this function returns.
; It should point to ASCIIZ-string without leading '/' in latin lowercase and
; digits, like 'usbhd0'.
; The value 'userdata' is any pointer-sized data, passed as is to all
; callbacks.
void* stdcall DiskAdd(DISKFUNC* functions, const char* name, void* userdata,
int flags); ; The pointer 'functions' must be valid at least until the disk
will be deleted ; (until DISKFUNC.close is called). ; The pointer 'name' can
be invalid after this function returns. ; It should point to ASCIIZ-string
without leading '/' in latin lowercase and ; digits, like 'usbhd0'. ; The
value 'userdata' is any pointer-sized data, passed as is to all ; callbacks.
DISK_NO_INSERT_NOTIFICATION = 1
; The bitfield 'flags' has currently only one bit defined. If it is set, the
; driver will never call DiskMediaChanged(hDisk, true), so the kernel must scan
@ -29,13 +27,13 @@ struc DISKFUNC
{
.strucsize dd ?
.close dd ?
; void close(void* userdata);
; void stdcall (*close)(void* userdata);
; Optional.
; The last function that is called for the given disk. The kernel calls it when
; the kernel has finished all operations with the disk and it is safe to free
; all driver-specific data identified by 'userdata'.
.closemedia dd ?
; void closemedia(void* userdata);
; void stdcall (*closemedia)(void* userdata);
; Optional.
; The kernel calls this function when it finished all processing with the
; current media. If media is removed, the driver should decline all requests
@ -43,25 +41,25 @@ struc DISKFUNC
; until this function is called. If media is removed, a new call to
; DiskMediaChanged(hDisk, true) is not allowed until this function is called.
.querymedia dd ?
; int querymedia(void* userdata, DISKMEDIAINFO* info);
; int stdcall (*querymedia)(void* userdata, DISKMEDIAINFO* info);
; return value: 0 = success, otherwise = error
.read dd ?
; int read(void* userdata, void* buffer, __int64 startsector,
; int stdcall (*read)(void* userdata, void* buffer, __int64 startsector,
; int* numsectors);
; return value: 0 = success, otherwise = error
.write dd ?
; int write(void* userdata, const void* buffer, __int64 startsector,
; int stdcall (*write)(void* userdata, const void* buffer, __int64 startsector,
; int* numsectors);
; Optional.
; return value: 0 = success, otherwise = error
.flush dd ?
; int flush(void* userdata);
; int stdcall (*flush)(void* userdata);
; Optional.
; Flushes the hardware cache, if it exists. Note that a driver should not
; implement a software cache for read/write, since they are called from the
; kernel cache manager.
.adjust_cache_size dd ?
; unsigned int adjust_cache_size(unsigned int suggested_size);
; unsigned int stdcall (*adjust_cache_size)(unsigned int suggested_size);
; Optional.
; Returns the cache size for this device in bytes. 0 = disable cache.
}

View File

@ -3423,6 +3423,8 @@ IPC
* ¡¨â 6 (¬ áª  0x40): CapsLock ¢ª«îçñ­
* ¡¨â 7 (¬ áª  0x80): NumLock ¢ª«îçñ­
* ¡¨â 8 (¬ áª  0x100): ScrollLock ¢ª«îçñ­
* ¡¨â 9 (¬ áª  0x200): «¥¢ë© Win ­ ¦ â
* ¡¨â 10 (¬ áª  0x400): ¯à ¢ë© Win ­ ¦ â
* ¯à®ç¨¥ ¡¨âë á¡à®è¥­ë
----- <20>®¤äã­ªæ¨ï 4 - ãáâ ­®¢¨âì ®¡é¥á¨á⥬­ãî "£®àïçãî ª« ¢¨èã". -----
@ -4571,6 +4573,46 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* eax = 0 - ãᯥ譮
* eax = 1 - ¡ãä¥à § ¯®«­¥­
======================================================================
===================== ”ã­ªæ¨ï 73 - blit bitmap =====================
======================================================================
¡«¨â - ª®¯¨à®¢ ­¨¥ ¡¨â®¢®£® ¬ áᨢ
<EFBFBD> à ¬¥âàë:
* eax = 73 - ­®¬¥à ä㭪樨
* ebx = ROP ¨ ®¯æ¨®­ «ì­ë¥ ä« £¨
31 6 5 4 3 0
[ reserved ][T][B][ROP]
ROP - ª®¤ à áâ஢ëå ®¯¥à æ¨©
0: ª®¯¨à®¢ âì
1-15: ‡ à¥§¥à¢¨à®¢ ­®
B - ¡«¨â ­  ä®­®¢ãî ¯®ä¥àå­®áâì
T - ¡«¨â á ¯à®§à ç­®áâìî
* ecx = 㪠§ â¥«ì ­  ¯ à ¬¥âàë ä㭪樨
ᬥ饭¨¥ 楫¨ÿ¨ ®âá¥ç¥­¨¥
+0 signed dword: ᬥ饭¨¥ ¯® X ®ª­ , ¤«ï 楫¥¢®£® ¯àאַ㣮«ì­¨ª 
¢¥àå­¨© «¥¢ë© 㣮«
+4 signed dword: ᬥ饭¨¥ ¯® Y ®ª­ , ¤«ï 楫¥¢®£® ¯àאַ㣮«ì­¨ª 
¢¥àå­¨© «¥¢ë© 㣮«
+8 dword: è¨à¨­  楫¥¢®£® ¯àאַ㣮«ì­¨ª 
+12 dword: ¢ëá®â  楫¥¢®£® ¯àאַ㣮«ì­¨ª 
ᬥ饭¨¥ ¨á室­¨ª ÿ¨ ®âá¥ç¥­¨¥
+16 signed dword: ᬥ饭¨¥ ¯® X bitmap, ¤«ï ¨á室­®£® ¯àאַ㣮«ì­¨ª 
¢¥àå­¨© «¥¢ë© 㣮«
+20 signed dword: ᬥ饭¨¥ ¯® Y bitmap, ¤«ï ¨á室­®£® ¯àאַ㣮«ì­¨ª 
¢¥àå­¨© «¥¢ë© 㣮«
+24 dword: è¨à¨­  ¨á室­®£® ¯àאַ㣮«ì­¨ª 
+28 dword: ¢ëá®â  ¨á室­®£® ¯àאַ㣮«ì­¨ª 
+32: dword: ¤ ­­ë¥ bitmap - ¤®«¦­ë ¡ëâì 32bpp
+36: dword: à §¬¥à áâப¨ bitmap ¢ ¡ ©â å
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
======================================================================
========== ”ã­ªæ¨ï -1 - § ¢¥àè¨âì ¢ë¯®«­¥­¨¥ ¯®â®ª /¯à®æ¥áá  =========
======================================================================

View File

@ -3403,6 +3403,8 @@ Returned value:
* bit 6 (mask 0x40): CapsLock is on
* bit 7 (mask 0x80): NumLock is on
* bit 8 (mask 0x100): ScrollLock is on
* bit 9 (mask 0x200): left Win is pressed
* bit 10 (mask 0x400): right Win is pressed
* other bits are cleared
-------------- Subfunction 4 - set system-wide hotkey. ---------------
@ -4555,7 +4557,7 @@ Parameters:
B - blit into the background surface
T - transparent blit
* ecx = pointer to the function parametrs
* ecx = pointer to the function parameters
destination offset and clipping
+0 signed dword: destination rectangle X offset from the window
top-left corner
@ -4565,18 +4567,19 @@ Parameters:
+12 dword: destination rectangle height
source offset and clipping
+16 signed dword: source rectangle X offset from the bitmap top-left corner
+20 signed dword: source rectangle Y offset from the bitmap top-left corner
+16 signed dword: source rectangle X offset from the bitmap
top-left corner
+20 signed dword: source rectangle Y offset from the bitmap
top-left corner
+24 dword: source rectangle width
+28 dword: source rectangle height
+32: dword: size of the bitmap row in bytes
+36: dword: bitmap data - must be 32bpp
+32: dword: bitmap data - must be 32bpp
+36: dword: size of the bitmap row in bytes
Returned value:
* function does not return value
======================================================================
=============== Function -1 - terminate thread/process ===============
======================================================================

View File

@ -74,7 +74,7 @@ format_disk_fat16:
mov edx, eax
@@:
; 2. Zero all system areas on the disk.
lea ecx, [256*(1+FAT16_ROOTDIR_SECTORS)/2+edx+255]
lea ecx, [256*(1+FAT16_ROOTDIR_SECTORS)+edx+255]
and ecx, not 255
shr ecx, 1
xor eax, eax
@ -299,7 +299,7 @@ fat32bootsector_stub:
db 'KOLIBRI ' ; BS_OEMName
dw 512 ; BPB_BytsPerSec
db 1 ; BPB_SecsPerClus
dw 1 ; BPB_RsvdSecCnt
dw 2 ; BPB_RsvdSecCnt
db 1 ; BPB_NumFATs
dw 0 ; BPB_RootEntCnt
dw 0 ; BPB_TotSec16

View File

@ -450,7 +450,7 @@ ext2_get_inode_block:
mov ebx, [ext2_data.ext2_temp_block]
call ext2_get_block
test eax, eax
jz @F ;если не было ошибки
jnz @F ;если не было ошибки
mov ecx, [ebx + ecx*4] ;заносим результат
@@:
@ -565,7 +565,7 @@ ext2_HdReadFolder:
rep movsd
pop ecx
@@:
cmp [ebp + EXT2_INODE_STRUC.i_blocks], 0 ;папка пуста
cmp [ebp + EXT2_INODE_STRUC.i_size], 0 ;папка пуста
je .error_empty_dir
push edx ;адрес результата [edi + 28]
@ -616,14 +616,14 @@ ext2_HdReadFolder:
test ebx, 0x3 ; длина записи должна делиться на 4
jnz .error_bad_len
sub [ebp + EXT2_INODE_STRUC.i_size], ebx ;вычитаем напрямую из структуры inode
add esi, ebx ; к следующей записи
cmp esi, [edi + 24] ; сравниваем с концом блока
jb .find_wanted_start
push .find_wanted_start
.end_block: ;вылетели из цикла
mov ebx, [ext2_data.count_block_in_block]
sub [ebp + EXT2_INODE_STRUC.i_blocks], ebx ;вычитаем напрямую из структуры inode
cmp [ebp + EXT2_INODE_STRUC.i_size], 0
jle .end_dir
inc dword [edi] ;получаем новый блок
@ -727,6 +727,7 @@ ext2_HdReadFolder:
test ebx, 0x3 ; длина записи должна делиться на 4
jnz .error_bad_len
sub [ebp + EXT2_INODE_STRUC.i_size], ebx ;вычитаем напрямую из структуры inode
add esi, ebx
cmp esi, [edi + 24] ;дошли ли до конца блока?
jb .wanted_start
@ -895,15 +896,13 @@ ext2_HdRead:
jae .size_great_great
.size_great_less:
push 1
; or [EXT2_files_in_folder], 1 ;читаем по границе размера
push 1 ;читаем по границе размера
mov ecx, [ebp + EXT2_INODE_STRUC.i_size]
sub ecx, [esi] ;(размер - старт) = сколько читать
jmp @F
.size_great_great:
push 0
; and [EXT2_files_in_folder], 0 ;читаем столько сколько запросили
push 0 ;читаем столько сколько запросили
@@:
;здесь мы точно знаем сколько байт читать - ecx
@ -919,7 +918,7 @@ ext2_HdRead:
mov eax, [esi]
div [ext2_data.block_size]
push eax ;номер блока запоминаем
push eax ;счетчик блоков ложим в стек
push ecx
mov ecx, eax
@ -949,7 +948,7 @@ ext2_HdRead:
.zero_start:
mov eax, ecx
push 0 ;счетчик блоков
push 0 ;счетчик блоков ложим в стек
;теперь в eax кол-во оставшихся байт для чтения
.calc_blocks_count:
mov ebx, edi ;чтение блока прям в ->ebx
@ -982,7 +981,7 @@ ext2_HdRead:
inc ecx
call ext2_get_inode_block
test eax, eax
jz .error_at_finish_block
jnz .error_at_finish_block
mov edi, ebx
mov eax, ecx
@ -994,9 +993,13 @@ ext2_HdRead:
mov ecx, edx
mov esi, ebx
rep movsb ;кусок last блока
jmp @F
.end_read:
pop ebx
pop eax
pop ecx ;счетчик блоков, который хранился в стеке
@@:
pop ebx ;количество считанных байт
pop eax ; 1 или 0 - достигли ли конца файла
test eax, eax
jz @F
@ -1009,7 +1012,6 @@ ext2_HdRead:
.only_one_block:
mov esi, ebx
rep movsb ;кусок last блока
pop eax
jmp .end_read
.error_at_first_block:
@ -1094,6 +1096,7 @@ ext2_find_lfn:
push [ebp + EXT2_INODE_STRUC.i_blocks]
xor ecx, ecx
.folder_block_cycle:
push ecx
call ext2_get_inode_block
test eax, eax
jnz .error_get_inode_block
@ -1106,7 +1109,7 @@ ext2_find_lfn:
push esi
call ext2_test_block_by_name
pop edi
pop edi ecx
cmp edi, esi ;нашли имя?
je .next_folder_block ;не нашли -> к след. блоку
@ -1132,11 +1135,11 @@ ext2_find_lfn:
sub eax, [ext2_data.count_block_in_block]
jle .not_found
push eax
inc ecx
jmp .folder_block_cycle
.not_found:
pop ebx
mov eax, ERROR_FILE_NOT_FOUND
ret
@ -1152,6 +1155,7 @@ ext2_find_lfn:
.error_get_inode_block:
.error_get_block:
pop ecx
.error_get_inode:
pop ebx
.error_empty_root:

View File

@ -2257,15 +2257,17 @@ fs_FloppyDelete:
popa
; delete FAT chain
pop eax
test eax, eax
jz .done
@@:
cmp eax, 2
jb .done
cmp eax, 0xFF8
jae .done
lea eax, [FLOPPY_FAT + eax*2]
push dword [eax]
and word [eax], 0
pop eax
and eax, 0xFFF
jnz @b
jmp @b
.done:
call save_flp_fat
pop edi

View File

@ -0,0 +1,13 @@
dir0:
db 'DISCO DURO '
db 'UNIDAD RAM '
db 'DISQUETE '
db 0
dir1:
db 'PRIMERO '
db 'SEGUNDO '
db 'TERCERO '
db 'CUARTO '
db 0

View File

@ -21,6 +21,10 @@ $Revision$
iglobal
if lang eq sp
include 'fs/fs-sp.inc'
else
dir0:
db 'HARDDISK '
db 'RAMDISK '
@ -33,6 +37,7 @@ dir1:
db 'THIRD '
db 'FOURTH '
db 0
end if
not_select_IDE db 0

View File

@ -103,6 +103,17 @@ fs_additional_handlers:
dd 0
endg
file_system_lfn_protected:
pushad
call protect_from_terminate
call file_system_lfn
call unprotect_from_terminate
popad
mov [image_of_eax], eax
mov [image_of_ebx], ebx
ret
file_system_lfn:
; in: ebx->fileinfo block
; operation codes:

Binary file not shown.

Binary file not shown.

View File

@ -165,6 +165,7 @@ raise_event: ;; EXPORT use
; esi - event data (=0 => skip)
;scratched: ebx,ecx,esi,edi
call NotDummyTest ; not returned for fail !!!
mov [check_idle_semaphore], 5
or esi, esi
jz @f
lea edi, [ebx+EVENT.code]
@ -307,6 +308,23 @@ wait_event: ;; EXPORT use
jmp wait_finish
;-----------------------------------------------------------------------------
align 4
wait_event_timeout:
;param:
; eax - event
; ebx - uid (for Dummy testing)
; ecx - timeout in timer ticks
;retval:
; eax - EVENT handle or 0 if timeout
call DummyTest
mov ebx, ecx
mov ecx, eax ; wait_param
mov edx, get_event_alone ; wait_test
call Wait_events_ex
test eax, eax
jnz wait_finish
ret
;-----------------------------------------------------------------------------
align 4
get_event_ex: ;; f68:14
;info:
; Îæèäàíèå ëþáîãî ñîáûòèÿ â î÷åðåäè EventList òåêóùåãî ñëîòà
@ -441,7 +459,7 @@ align 4
;--------------------------------------
align 4
.result:
setae byte[esp+32] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32]==72
setae byte[esp+32+4] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32+4]==72
;--------------------------------------
align 4
.retf:
@ -467,9 +485,11 @@ sys_waitforevent: ;; f10
;--------------------------------------
align 4
sys_wait_event_timeout: ;; f23
call unprotect_from_terminate
mov edx, get_event_for_app; wait_test
call Wait_events_ex ; ebx - timeout
mov [esp+32], eax
call protect_from_terminate
ret
;-----------------------------------------------------------------------------
align 4

View File

@ -7,6 +7,8 @@
$Revision$
include "lang.inc"
;------------------------------------------------------------------------------
align 4
dtext_asciiz_esi: ; for skins title out
@ -231,9 +233,17 @@ draw_text_to_user_area:
;------------------------------------------------------------------------------
align 4
FONT_I:
if lang eq sp
file 'char_sp.mt'
else
file 'char.mt'
end if
;------------------------------------------------------------------------------
align 4
FONT_II:
if lang eq sp
file 'char2_sp.mt'
else
file 'char2.mt'
end if
;------------------------------------------------------------------------------

View File

@ -381,6 +381,16 @@ align 4
push esi edx ecx ebx
mov eax, esp
mov bl, [edi + WDATA.fl_wstate]
;--------------------------------------
align 4
@@:
cmp [REDRAW_BACKGROUND], byte 0
jz @f
call change_task
jmp @b
;--------------------------------------
align 4
@@:
call window._.set_window_box
add esp, sizeof.BOX

View File

@ -17,6 +17,8 @@ VKEY_RALT = 0000000000100000b
VKEY_CAPSLOCK = 0000000001000000b
VKEY_NUMLOCK = 0000000010000000b
VKEY_SCRLOCK = 0000000100000000b
VKEY_LWIN = 0000001000000000b
VKEY_RWIN = 0000010000000000b
VKEY_SHIFT = 0000000000000011b
VKEY_CONTROL = 0000000000001100b
@ -224,6 +226,29 @@ send_scancode:
xchg cl, [ext_code]
and al, 0x7F
mov bh, 1
;--------------------------------------
@@:
cmp al, 0x5B
jne @f
cmp cl, 0xE0
jne @f
mov eax, VKEY_LWIN
mov bh, 0
jmp .modifier
;--------------------------------------
@@:
cmp al, 0x5C
jne @f
cmp cl, 0xE0
jne @f
mov eax, VKEY_RWIN
mov bh, 0
jmp .modifier
;--------------------------------------
@@:
cmp al, 0x2A
jne @f
@ -359,9 +384,6 @@ send_scancode:
xor [kb_state], eax
xor [kb_lights], bl
push ecx
call set_lights
pop ecx
.writekey:
pushad
; test for system hotkeys
@ -495,10 +517,12 @@ set_lights:
ret
ps2_set_lights:
stdcall disable_irq, 1
mov al, 0xED
call kb_write
mov al, [esp+8]
call kb_write
stdcall enable_irq, 1
ret 8
;// mike.dld ]

View File

@ -66,6 +66,8 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
format binary as "mnt"
include 'macros.inc'
include 'struct.inc'
@ -131,13 +133,19 @@ use16
org 0x0
jmp start_of_code
if lang eq sp
include "kernelsp.inc" ; spanish kernel messages
else
version db 'Kolibri OS version 0.7.7.0+ ',13,10,13,10,0
end if
include "boot/bootstr.inc" ; language-independent boot messages
include "boot/preboot.inc"
if lang eq en
include "boot/booteng.inc" ; english system boot messages
if lang eq ge
include "boot/bootge.inc" ; german system boot messages
else if lang eq sp
include "boot/bootsp.inc" ; spanish system boot messages
else if lang eq ru
include "boot/bootru.inc" ; russian system boot messages
include "boot/ru.inc" ; Russian font
@ -145,7 +153,7 @@ 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
include "boot/booten.inc" ; english system boot messages
end if
include "boot/bootcode.inc" ; 16 bit system boot code
@ -161,8 +169,6 @@ include "detect/biosdisk.inc"
; CR0 Flags - Protected mode and Paging
align 16
mov ecx, CR0_PE
; Enabling 32 bit protected mode
@ -200,20 +206,6 @@ align 16
mov cr0, eax
jmp pword os_code:B32 ; jmp to enable 32 bit mode
include "boot/shutdown.inc" ; shutdown or restart
include "data16.inc"
align 4096
__ap_start_16:
cli
lgdt [cs:(tmp_gdt-__ap_start_16)] ; Load GDT
mov eax, cr0 ; protected mode
or eax, CR0_PE
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled
mov cr0, eax
jmp pword os_code:__ap_start_32 ; jmp to enable 32 bit mode
align 8
tmp_gdt:
@ -233,37 +225,11 @@ tmp_gdt:
dw 11011111b *256 +10010010b
db 0x00
include "data16.inc"
use32
org $+0x10000
align 16
__ap_start_32:
mov ax, os_stack ; Selector for os
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
bt [cpu_caps-OS_BASE], CAPS_PSE
jnc .no_PSE
mov ebx, cr4
or ebx, CR4_PSE
mov eax, PG_LARGE+PG_SW
mov cr4, ebx
.no_PSE:
mov eax, sys_pgdir-OS_BASE
mov cr3, eax
mov eax, cr0
or eax, CR0_PG+CR0_WP
mov cr0, eax
lgdt [gdts]
jmp pword os_code:ap_entry
align 4
B32:
mov ax, os_stack ; Selector for os
@ -325,6 +291,11 @@ align 4
bios32_entry dd ?
tmp_page_tabs dd ?
use16
org $-0x10000
include "boot/shutdown.inc" ; shutdown or restart
org $+0x10000
use32
__DEBUG__ fix 1
__DEBUG_LEVEL__ fix 1
@ -334,37 +305,6 @@ org OS_BASE+$
include 'fdo.inc'
ap_entry:
bt [cpu_caps], CAPS_PGE
jnc @F
mov ebx, cr4
or ebx, CR4_PGE
mov cr4, ebx
@@:
mov esi, [LAPIC_BASE]
xor ebp, ebp
.1:
mov ebx, [esi+0x20] ;apic_id
shr ebx, 24
shl ebx, 6+2
add ebx, LFB_BASE
mov edx, 32
.2:
mov ecx, 32
mov edi, ebx
mov eax, [_display.width]
lea ebx, [ebx+eax*4]
mov eax, ebp
rep stosd
dec edx
jnz .2
dec ebp
jmp .1
hlt
jmp ap_entry
align 4
high_code:
mov ax, os_stack
@ -387,12 +327,12 @@ high_code:
or ebx, CR4_PGE
mov cr4, ebx
@@:
; xor eax, eax
; mov dword [sys_pgdir], eax
; mov dword [sys_pgdir+4], eax
xor eax, eax
mov dword [sys_pgdir], eax
mov dword [sys_pgdir+4], eax
; mov eax, cr3
; mov cr3, eax ; flush TLB
mov eax, cr3
mov cr3, eax ; flush TLB
mov ecx, pg_data.mutex
call mutex_init
@ -674,6 +614,52 @@ no_mode_0x12:
mov [mem_BACKGROUND], 4
mov [img_background], static_background_data
; SET UP OS TASK
mov esi, boot_setostask
call boot_log
xor eax, eax
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
mov dword [SLOT_BASE+APPDATA.exc_handler], eax
mov dword [SLOT_BASE+APPDATA.except_mask], eax
; name for OS/IDLE process
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
mov edi, [os_stack_seg]
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
add edi, 0x2000-512
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
mov dword [SLOT_BASE+256+APPDATA.saved_esp0], edi; just for case
mov dword [SLOT_BASE+256+APPDATA.terminate_protection], 80000001h
mov esi, fpu_data
mov ecx, 512/4
cld
rep movsd
mov dword [SLOT_BASE+256+APPDATA.exc_handler], eax
mov dword [SLOT_BASE+256+APPDATA.except_mask], eax
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
mov dword [SLOT_BASE+256+APPDATA.tls_base], eax
; task list
mov dword [TASK_DATA+TASKDATA.mem_start], eax; process base address
inc eax
mov dword [CURRENT_TASK], eax
mov dword [TASK_COUNT], eax
mov [current_slot], SLOT_BASE+256
mov [TASK_BASE], dword TASK_DATA
mov byte[TASK_DATA+TASKDATA.wnd_number], al ; on screen number
mov dword [TASK_DATA+TASKDATA.pid], eax ; process id number
mov [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
stdcall kernel_alloc, 0x10000/8
@ -707,11 +693,8 @@ no_mode_0x12:
; Try to Initialize APIC
call APIC_init
call LAPIC_init
; mov eax, 1
; call start_ap
mov esi, boot_enableirq
call boot_log
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
; they are used: when partitions are scanned, hd_read relies on timer
call unmask_timer
@ -794,6 +777,8 @@ end if
movzx ecx, word [boot_y]
if lang eq ru
or ecx, (10+30*6) shl 16
else if lang eq sp
or ecx, (10+33*6) shl 16
else
or ecx, (10+29*6) shl 16
end if
@ -814,7 +799,7 @@ end if
; call boot_log
mov [pci_access_enabled], 1
call pci_enum
; SET PRELIMINARY WINDOW STACK AND POSITIONS
@ -835,52 +820,6 @@ end if
call boot_log
call reserve_irqs_ports
; SET UP OS TASK
mov esi, boot_setostask
call boot_log
xor eax, eax
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
mov dword [SLOT_BASE+APPDATA.exc_handler], eax
mov dword [SLOT_BASE+APPDATA.except_mask], eax
; name for OS/IDLE process
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
mov edi, [os_stack_seg]
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
add edi, 0x2000-512
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
mov dword [SLOT_BASE+256+APPDATA.saved_esp0], edi; just for case
; [SLOT_BASE+256+APPDATA.io_map] was set earlier
mov esi, fpu_data
mov ecx, 512/4
cld
rep movsd
mov dword [SLOT_BASE+256+APPDATA.exc_handler], eax
mov dword [SLOT_BASE+256+APPDATA.except_mask], eax
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
mov dword [SLOT_BASE+256+APPDATA.tls_base], eax
; task list
mov dword [TASK_DATA+TASKDATA.mem_start], eax; process base address
inc eax
mov dword [CURRENT_TASK], eax
mov dword [TASK_COUNT], eax
mov [current_slot], SLOT_BASE+256
mov [TASK_BASE], dword TASK_DATA
mov byte[TASK_DATA+TASKDATA.wnd_number], al ; on screen number
mov dword [TASK_DATA+TASKDATA.pid], eax ; process id number
call init_display
mov eax, [def_cursor]
mov [SLOT_BASE+APPDATA.cursor], eax
@ -898,17 +837,11 @@ end if
rdtsc ;call _rdtsc
sti
sub eax, ecx
xor edx, edx
shld edx, eax, 2
shl eax, 2
mov [CPU_FREQ], eax ; save tsc / sec
; mov ebx, 1000000
; div ebx
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥áâ¥
; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥©
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“...
mov edx, 2251799814
mul edx
shr edx, 19
mov [stall_mcs], edx
mov dword [cpu_freq], eax
mov dword [cpu_freq+4], edx
; PRINT CPU FREQUENCY
mov esi, boot_cpufreq
call boot_log
@ -917,6 +850,8 @@ end if
movzx ecx, word [boot_y]
if lang eq ru
add ecx, (10+19*6) shl 16 - 10 ; 'Determining amount of memory'
else if lang eq sp
add ecx, (10+25*6) shl 16 - 10 ; 'Determining amount of memory'
else
add ecx, (10+17*6) shl 16 - 10 ; 'Determining amount of memory'
end if
@ -992,8 +927,8 @@ end if
call fs_execute_from_sysdir
; cmp eax,2 ; continue if a process has been loaded
sub eax, 2
jz first_app_found
test eax, eax
jns first_app_found
mov esi, boot_failed
call boot_log
@ -1099,6 +1034,8 @@ if defined debug_com_base
end if
mov eax, [version_inf.rev]
DEBUGF 1, "K : kernel SVN r%d\n", eax
mov eax, [cpu_count]
test eax, eax
@ -1107,7 +1044,7 @@ end if
@@:
DEBUGF 1, "K : %d CPU detected\n", eax
call print_mem
; call print_mem
; START MULTITASKING
@ -1240,7 +1177,7 @@ reserve_irqs_ports:
mov [eax+16], ecx
mov [eax+16+4], dword 0
mov [eax+16+4], dword 0x2D
mov [eax+16+8], dword 0x2D
mov [eax+32], ecx
mov [eax+32+4], dword 0x30
@ -1248,7 +1185,7 @@ reserve_irqs_ports:
mov [eax+48], ecx
mov [eax+48+4], dword 0x50
mov [eax+28+8], dword 0xDF
mov [eax+48+8], dword 0xDF
mov [eax+64], ecx
mov [eax+64+4], dword 0xE5
@ -2099,8 +2036,6 @@ restore_default_cursor_before_killing:
@@:
mov [redrawmouse_unconditional], 1
popfd
; call [draw_pointer]
call __sys_draw_pointer
ret
;------------------------------------------------------------------------------
iglobal
@ -2173,6 +2108,12 @@ sysfn_terminate: ; 18.2 = TERMINATE
add ecx, CURRENT_TASK+TASKDATA.state
cmp byte [ecx], 9
jz noprocessterminate
push ecx edx
lea edx, [(ecx-(CURRENT_TASK and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
call request_terminate
pop edx ecx
test eax, eax
jz noprocessterminate
;--------------------------------------
cmp [_display.select_cursor], 0
je .restore_end
@ -2254,13 +2195,24 @@ sysfn_deactivate: ; 18.1 = DEACTIVATE WINDOW
call syscall_display_settings._.redraw_whole_screen
.nowindowdeactivate:
ret
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
sysfn_activate: ; 18.3 = ACTIVATE WINDOW
cmp ecx, 2
jb .nowindowactivate
cmp ecx, [TASK_COUNT]
ja .nowindowactivate
;-------------------------------------
@@:
; If the window is captured and moved by the user,
; then you can't change the position in window stack!!!
mov al, [mouse.active_sys_window.action]
and al, WINDOW_MOVE_AND_RESIZE_FLAGS
test al, al
jz @f
call change_task
jmp @b
@@:
;-------------------------------------
mov [window_minimize], 2; restore window if minimized
movzx esi, word [WIN_STACK + ecx*2]
@ -2282,10 +2234,14 @@ sysfn_getidletime: ; 18.4 = GET IDLETIME
ret
;------------------------------------------------------------------------------
sysfn_getcpuclock: ; 18.5 = GET TSC/SEC
mov eax, [CPU_FREQ]
mov eax, dword [cpu_freq]
mov [esp+32], eax
ret
;------------------------------------------------------------------------------
get_cpu_freq:
mov eax, dword [cpu_freq]
mov edx, dword [cpu_freq+4]
ret
; SAVE ramdisk to /hd/1/menuet.img
;!!!!!!!!!!!!!!!!!!!!!!!!
include 'blkdev/rdsave.inc'
@ -2535,7 +2491,7 @@ iglobal
version_inf:
db 0,7,7,0 ; version 0.7.7.0
db 0
dd __REV__
.rev dd __REV__
version_end:
endg
;------------------------------------------------------------------------------
@ -3544,15 +3500,31 @@ nobackgr:
mov edx, [shutdown_processes]
cmp [SYS_SHUTDOWN], dl
jne no_mark_system_shutdown
jne noshutdown
lea ecx, [edx-1]
mov edx, OS_BASE+0x3040
jecxz @f
jecxz no_mark_system_shutdown
;--------------------------------------
align 4
markz:
push ecx edx
cmp [edx+TASKDATA.state], 9
jz .nokill
lea edx, [(edx-(CURRENT_TASK and 1FFFFFFFh))*8+SLOT_BASE]
cmp [edx+APPDATA.dir_table], sys_pgdir - OS_BASE
jz .nokill
call request_terminate
jmp .common
.nokill:
dec byte [SYS_SHUTDOWN]
xor eax, eax
.common:
pop edx ecx
test eax, eax
jz @f
mov [edx+TASKDATA.state], byte 3
@@:
add edx, 0x20
loop markz
;--------------------------------------
@ -3572,11 +3544,27 @@ align 4
newct:
mov cl, [ebx]
cmp cl, byte 3
jz terminate
jz .terminate
cmp cl, byte 4
jz terminate
jnz .noterminate
.terminate:
pushad
mov ecx, eax
shl ecx, 8
add ecx, SLOT_BASE
call restore_default_cursor_before_killing
popad
pushad
call terminate
popad
cmp byte [SYS_SHUTDOWN], 0
jz .noterminate
dec byte [SYS_SHUTDOWN]
je system_shutdown
.noterminate:
add ebx, 0x20
inc esi
dec eax
@ -3786,6 +3774,15 @@ set_app_param:
mov [esp+32], eax ; return old mask value
ret
;-----------------------------------------------------------------------------
; this is for syscall
proc delay_hs_unprotected
call unprotect_from_terminate
call delay_hs
call protect_from_terminate
ret
endp
align 4
delay_hs: ; delay in 1/100 secs
; ebx = delay time
@ -4638,9 +4635,10 @@ sys_msg_board_dword:
popad
ret
msg_board_data_size = 65536 ; Must be power of two
uglobal
msg_board_data:
times 4096 db 0
msg_board_data rb msg_board_data_size
msg_board_count dd 0x0
endg
@ -4673,7 +4671,7 @@ end if
mov [msg_board_data+ecx], bl
inc ecx
and ecx, 4095
and ecx, msg_board_data_size - 1
mov [msg_board_count], ecx
mov [check_idle_semaphore], 5
ret
@ -4766,7 +4764,8 @@ align 4
mov [eax], edx
mov [ecx], eax
mov [eax+12], ecx
jecxz @f
test edx, edx
jz @f
mov [edx+12], eax
@@:
and dword [esp+32], 0
@ -4918,7 +4917,11 @@ syscall_writetext: ; WriteText
add ebp, [eax-twdw+WDATA.box.top]
add bp, word[esi+APPDATA.wnd_clientbox.top]
pop esi
test ecx, 0x08000000 ; redirect the output to the user area
jnz @f
add ebx, ebp
align 4
@@:
mov eax, edi
test ecx, 0x08000000 ; redirect the output to the user area
jnz dtext
@ -5698,4 +5701,6 @@ include "data32.inc"
__REV__ = __REV
uglobals_size = $ - endofcode
if ~ lang eq sp
diff16 "end of kernel code",0,$
end if

View File

@ -137,7 +137,7 @@ struct APPDATA
ipc_size dd ?
event_mask dd ?
debugger_slot dd ?
dd ?
terminate_protection dd ?
keyboard_mode db ?
rb 3
dir_table dd ?

View File

@ -0,0 +1,4 @@
; <EFBFBD>ste archivo debe ser editado con codificaci¢n CP866
version db 'Kolibri OS versi¢n 0.7.7.0+ ',13,10,13,10,0
diff16 "fin del c¢digo del kernel",0,$