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

View File

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

View File

@ -340,7 +340,11 @@ hd_timeout_error:
; call clear_application_table_status ; call clear_application_table_status
; mov esi,hd_timeout_str ; mov esi,hd_timeout_str
; call sys_msg_board_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" DEBUGF 1,"K : FS - HD timeout\n"
end if
mov [hd_error], 1 mov [hd_error], 1
pop eax pop eax
@ -352,7 +356,11 @@ hd_read_error:
; call clear_application_table_status ; call clear_application_table_status
; mov esi,hd_read_str ; mov esi,hd_read_str
; call sys_msg_board_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" DEBUGF 1,"K : FS - HD read error\n"
end if
pop edx eax pop edx eax
ret ret
@ -362,7 +370,11 @@ hd_write_error:
; call clear_application_table_status ; call clear_application_table_status
; mov esi,hd_write_str ; mov esi,hd_write_str
; call sys_msg_board_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" DEBUGF 1,"K : FS - HD write error\n"
end if
ret ret
hd_write_error_dma: hd_write_error_dma:
@ -370,7 +382,11 @@ hd_write_error_dma:
; call clear_application_table_status ; call clear_application_table_status
; mov esi, hd_write_str ; mov esi, hd_write_str
; call sys_msg_board_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 pop esi
ret ret
@ -379,7 +395,11 @@ hd_lba_error:
; call clear_application_table_status ; call clear_application_table_status
; mov esi,hd_lba_str ; mov esi,hd_lba_str
; call sys_msg_board_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" DEBUGF 1,"K : FS - HD LBA error\n"
end if
jmp LBA_read_ret jmp LBA_read_ret

View File

@ -2257,8 +2257,10 @@ fs_RamdiskDelete:
jmp .lfndel jmp .lfndel
.lfndone: .lfndone:
; delete FAT chain ; delete FAT chain
test eax, eax cmp eax, 2
jz .done jb .done
cmp eax, 0xFF8
jae .done
lea eax, [RAMDISK_FAT + eax*2] lea eax, [RAMDISK_FAT + eax*2]
push dword [eax] push dword [eax]
and word [eax], 0 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 ebx, saverd_fileinfo
mov [saverd_fileinfo.name], ecx mov [saverd_fileinfo.name], ecx
pushad pushad
call file_system_lfn ;in ebx call file_system_lfn_protected ;in ebx
popad popad
mov [esp+32], eax mov [esp+32], eax
ret ret

View File

@ -863,6 +863,14 @@ else if lang eq et
mov [time_str+9], ' ' mov [time_str+9], ' '
mov [time_str+10], ' ' 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 else
; wait 5/4/3/2 seconds, 1 second ; wait 5/4/3/2 seconds, 1 second
cmp al, 1 cmp al, 1
@ -917,7 +925,11 @@ if ~ defined extended_primary_loader
or al, 20h or al, 20h
cmp al, 'n' cmp al, 'n'
jz .loadc jz .loadc
if lang eq sp
cmp al, 's'
else
cmp al, 'y' cmp al, 'y'
end if
jnz .waityn jnz .waityn
call putchar call putchar
mov byte [space_msg+80], 186 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: read_image:
mov ebx, read_image_fsinfo mov ebx, read_image_fsinfo
pushad pushad
call file_system_lfn call file_system_lfn_protected
popad popad
ret ret

View File

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

View File

@ -155,12 +155,12 @@ pci_make_config_cmd:
align 4 align 4
pci_read_reg: pci_read_reg:
push ebx esi
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use? cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_read_reg_2 je pci_read_reg_2
; mechanism 1 ; mechanism 1
push esi ; save register size into ESI mov esi, eax ; save register size into ESI
mov esi, eax
and esi, 3 and esi, 3
call pci_make_config_cmd call pci_make_config_cmd
@ -202,15 +202,14 @@ pci_fin_read1:
out dx, eax out dx, eax
pop eax pop eax
pop esi pop esi ebx
ret ret
pci_read_reg_2: pci_read_reg_2:
test bh, 128 ;mech#2 only supports 16 devices per bus test bh, 128 ;mech#2 only supports 16 devices per bus
jnz pci_read_reg_err jnz pci_read_reg_err
push esi; save register size into ESI mov esi, eax ; save register size into ESI
mov esi, eax
and esi, 3 and esi, 3
push eax push eax
@ -262,12 +261,13 @@ pci_fin_read2:
out dx, al out dx, al
pop eax pop eax
pop esi pop esi ebx
ret ret
pci_read_reg_err: pci_read_reg_err:
xor eax, eax xor eax, eax
dec eax dec eax
pop esi ebx
ret ret
@ -286,12 +286,12 @@ pci_read_reg_err:
align 4 align 4
pci_write_reg: pci_write_reg:
push esi ebx
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use? cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_write_reg_2 je pci_write_reg_2
; mechanism 1 ; mechanism 1
push esi ; save register size into ESI mov esi, eax ; save register size into ESI
mov esi, eax
and esi, 3 and esi, 3
call pci_make_config_cmd call pci_make_config_cmd
@ -335,7 +335,7 @@ pci_fin_write1:
out dx, eax out dx, eax
xor eax, eax xor eax, eax
pop esi pop ebx esi
ret ret
pci_write_reg_2: pci_write_reg_2:
@ -344,8 +344,7 @@ pci_write_reg_2:
jnz pci_write_reg_err jnz pci_write_reg_err
push esi; save register size into ESI mov esi, eax ; save register size into ESI
mov esi, eax
and esi, 3 and esi, 3
push eax push eax
@ -397,12 +396,13 @@ pci_fin_write2:
out dx, al out dx, al
xor eax, eax xor eax, eax
pop esi pop ebx esi
ret ret
pci_write_reg_err: pci_write_reg_err:
xor eax, eax xor eax, eax
dec eax dec eax
pop ebx esi
ret ret
if defined mmio_pci_addr ; must be set above if defined mmio_pci_addr ; must be set above
@ -658,3 +658,67 @@ sys_pcibios:
.return_a: .return_a:
mov dword[esp + 32], eax mov dword[esp + 32], eax
ret 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_COUNT equ (OS_BASE+0x000F500)
BTN_BUFF equ (OS_BASE+0x000F501) BTN_BUFF equ (OS_BASE+0x000F501)
CPU_FREQ equ (OS_BASE+0x000F600) ;CPU_FREQ equ (OS_BASE+0x000F600)
;unused ? no active references ;unused ? no active references
MOUSE_PORT equ (OS_BASE+0x000F604) ;MOUSE_PORT equ (OS_BASE+0x000F604)
;unused ;unused
PS2_CHUNK equ (OS_BASE+0x000FB00) PS2_CHUNK equ (OS_BASE+0x000FB00)
@ -570,6 +570,35 @@ struct MUTEX
count dd ? count dd ?
ends 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 struct MEM_STATE
mutex MUTEX mutex MUTEX
smallmap dd ? smallmap dd ?

View File

@ -380,6 +380,33 @@ proc enable_irq stdcall, irq_line:dword
ret ret
endp 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 align 4
pci_irq_fixup: pci_irq_fixup:
@ -419,6 +446,7 @@ pci_irq_fixup:
pop ebp pop ebp
ret ret
if 0
align 4 align 4
start_ap: start_ap:
;eax= cpu id ;eax= cpu id
@ -448,6 +476,8 @@ CMD_IPI_START equ (IPI_START+IPI_LEVEL_ASSERT)+((0x10000+__ap_start_16) shr 12)
.exit: .exit:
ret 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 endp
iglobal iglobal
ugui db 'gui',0 ugui db 'gui',0
ugui_mouse_speed db 'mouse_speed',0
ugui_mouse_speed_def db '2',0 ugui_mouse_speed_def db '2',0
ugui_mouse_delay db 'mouse_delay',0
ugui_mouse_delay_def db '0x00A',0 ugui_mouse_delay_def db '0x00A',0
udev db 'dev',0
udev_midibase db 'midibase',0 udev_midibase db 'midibase',0
udev_midibase_def db '0x320',0 udev_midibase_def db '0x320',0
endg endg
@ -125,11 +121,18 @@ endl
endp endp
iglobal iglobal
unet db 'net',0 if lang eq sp
unet_active db 'active',0 include 'core/conf_lib-sp.inc'
unet_addr db 'addr',0 else
unet_mask db 'mask',0 ugui_mouse_speed db 'mouse_speed',0
unet_gate db 'gate',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 unet_def db 0
endg endg
; convert string to DWord ; convert string to DWord

View File

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

View File

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

View File

@ -1470,33 +1470,6 @@ proc set_mtrr stdcall, base:dword,size:dword,mem_type:dword
ret ret
endp 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 align 4
proc create_ring_buffer stdcall, size:dword, flags:dword proc create_ring_buffer stdcall, size:dword, flags:dword
locals locals

View File

@ -283,11 +283,15 @@ __exports:
alloc_page, 'AllocPage', \ ; gcc ABI alloc_page, 'AllocPage', \ ; gcc ABI
alloc_pages, 'AllocPages', \ ; stdcall alloc_pages, 'AllocPages', \ ; stdcall
commit_pages, 'CommitPages', \ ; eax, ebx, ecx commit_pages, 'CommitPages', \ ; eax, ebx, ecx
\
disk_add, 'DiskAdd', \ ;stdcall
disk_media_changed, 'DiskMediaChanged', \ ;stdcall
\ \
create_event, 'CreateEvent', \ ; ecx, esi create_event, 'CreateEvent', \ ; ecx, esi
destroy_event, 'DestroyEvent', \ ; destroy_event, 'DestroyEvent', \ ;
raise_event, 'RaiseEvent', \ ; eax, ebx, edx, esi raise_event, 'RaiseEvent', \ ; eax, ebx, edx, esi
wait_event, 'WaitEvent', \ ; eax, ebx wait_event, 'WaitEvent', \ ; eax, ebx
wait_event_timeout, 'WaitEventTimeout', \ ; eax, ebx, ecx
get_event_ex, 'GetEvent', \ ; edi get_event_ex, 'GetEvent', \ ; edi
\ \
create_kernel_object, 'CreateObject', \ create_kernel_object, 'CreateObject', \
@ -331,7 +335,8 @@ __exports:
delay_hs, 'Delay', \ ; ebx delay_hs, 'Delay', \ ; ebx
set_mouse_data, 'SetMouseData', \ ; set_mouse_data, 'SetMouseData', \ ;
set_keyboard_data, 'SetKeyboardData', \ ; gcc fastcall 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$ $Revision$
align 4 ;3A08 align 4 ;3A08
build_interrupt_table: build_interrupt_table:
mov edi, idts mov edi, idts
@ -75,8 +74,12 @@ iglobal
msg_exc_d db "General protection fault", 0 msg_exc_d db "General protection fault", 0
msg_exc_e db "Page 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_ker db "kernel", 0
msg_sel_app db "application", 0 msg_sel_app db "application", 0
end if
endg endg
@ -213,7 +216,11 @@ show_error_parameters:
pop ebx pop ebx
.no_ud: .no_ud:
mov edx, [TASK_BASE];not scratched below 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 cmp bl, 0x08
jb .l0 jb .l0
cmp bl, 0x0e cmp bl, 0x0e
@ -707,3 +714,78 @@ restore .slot
; mov esi,boot_sched_2 ; mov esi,boot_sched_2
; call boot_log ; call boot_log
; ret ; 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 pushad
cld cld
movzx eax, al call protect_from_terminate
movzx eax, byte [esp+28]
mov edx, dword [esp+20]
call dword [servetable2 + eax * 4] call dword [servetable2 + eax * 4]
call unprotect_from_terminate
popad popad
;------------------ ;------------------
xchg ecx, [ss:esp] ; â âåðøèí ñòåêà - app ecx, ecx - app esp + 4 xchg ecx, [ss:esp] ; â âåðøèí ñòåêà - app ecx, ecx - app esp + 4
@ -62,8 +66,11 @@ align 16
i40: i40:
pushad pushad
cld cld
movzx eax, al call protect_from_terminate
movzx eax, byte [esp+28]
mov edx, dword [esp+20]
call dword [servetable2 + eax * 4] call dword [servetable2 + eax * 4]
call unprotect_from_terminate
popad popad
iretd iretd
@ -85,10 +92,13 @@ syscall_entry:
;------------------ ;------------------
pushad pushad
cld cld
call protect_from_terminate
movzx eax, al movzx eax, byte [esp+28]
mov edx, dword [esp+20]
call dword [servetable2 + eax * 4] call dword [servetable2 + eax * 4]
call unprotect_from_terminate
popad popad
;------------------ ;------------------
mov ecx, [ss:esp+4] mov ecx, [ss:esp+4]
@ -125,7 +135,7 @@ iglobal
dd sys_getkey ; 2-GetKey dd sys_getkey ; 2-GetKey
dd sys_clock ; 3-GetTime dd sys_clock ; 3-GetTime
dd syscall_writetext ; 4-WriteText dd syscall_writetext ; 4-WriteText
dd delay_hs ; 5-DelayHs dd delay_hs_unprotected ; 5-DelayHs
dd syscall_openramdiskfile ; 6-OpenRamdiskFile dd syscall_openramdiskfile ; 6-OpenRamdiskFile
dd syscall_putimage ; 7-PutImage dd syscall_putimage ; 7-PutImage
dd syscall_button ; 8-DefineButton 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.fpu_state], edi
mov [eax+SLOT_BASE+APPDATA.exc_handler], 0 mov [eax+SLOT_BASE+APPDATA.exc_handler], 0
mov [eax+SLOT_BASE+APPDATA.except_mask], 0 mov [eax+SLOT_BASE+APPDATA.except_mask], 0
mov [eax+SLOT_BASE+APPDATA.terminate_protection], 80000001h
;set default io permission map ;set default io permission map
mov ecx, [SLOT_BASE+256+APPDATA.io_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 eax, [esi+0x08] ;app_eip
mov [ebx+REG_EIP], eax;app_entry mov [ebx+REG_EIP], eax;app_entry
mov [ebx+REG_CS], dword app_code 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 [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
mov eax, [esi+0x0C] ;app_esp mov eax, [esi+0x0C] ;app_esp

View File

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

View File

@ -87,6 +87,8 @@ if lang eq ru
if preboot_blogesc if preboot_blogesc
boot_tasking db '‚ᥠ£®â®¢® ¤«ï § ¯ã᪠, ­ ¦¬¨âॠESC ¤«ï áâ àâ ',0 boot_tasking db '‚ᥠ£®â®¢® ¤«ï § ¯ã᪠, ­ ¦¬¨âॠESC ¤«ï áâ àâ ',0
end if end if
else if lang eq sp
include 'data32sp.inc'
else else
boot_initirq db 'Initialize IRQ',0 boot_initirq db 'Initialize IRQ',0
boot_picinit db 'Initialize PIC',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_unresolved db 'unresolved ',0
msg_module db 'in module ',0 msg_module db 'in module ',0
if ~ lang eq sp
msg_version db 'incompatible driver version',13,10,0 msg_version db 'incompatible driver version',13,10,0
msg_www db 'please visit www.kolibrios.org',13,10,0 msg_www db 'please visit www.kolibrios.org',13,10,0
end if
msg_CR db 13,10,0 msg_CR db 13,10,0
intel_str db "GenuineIntel",0 intel_str db "GenuineIntel",0
@ -155,7 +159,7 @@ firstapp db 'LAUNCHER',0
notifyapp db '@notify',0 notifyapp db '@notify',0
if lang eq ru if lang eq ru
ud_user_message db 'Žè¨¡ª : ­¥¯®¤¤¥à¦¨¢ ¥¬ ï ¨­áâàãªæ¨ï ¯à®æ¥áá®à ',0 ud_user_message db 'Žè¨¡ª : ­¥¯®¤¤¥à¦¨¢ ¥¬ ï ¨­áâàãªæ¨ï ¯à®æ¥áá®à ',0
else else if ~ lang eq sp
ud_user_message db 'Error: unsupported processor instruction',0 ud_user_message db 'Error: unsupported processor instruction',0
end if end if
@ -177,6 +181,10 @@ dll_list:
.bk dd dll_list .bk dd dll_list
.fd dd dll_list .fd dd dll_list
pcidev_list:
.bk dd pcidev_list
.fd dd pcidev_list
MAX_DEFAULT_DLL_ADDR = 0x80000000 MAX_DEFAULT_DLL_ADDR = 0x80000000
MIN_DEFAULT_DLL_ADDR = 0x70000000 MIN_DEFAULT_DLL_ADDR = 0x70000000
dll_cur_addr dd MIN_DEFAULT_DLL_ADDR 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_used_list rd 64*2
mem_hash_cnt rd 64 mem_hash_cnt rd 64
cpu_freq rq 1
heap_mutex MUTEX heap_mutex MUTEX
heap_size rd 1 heap_size rd 1
heap_free rd 1 heap_free rd 1
@ -382,7 +392,6 @@ default_io_map rd 1
LFBSize rd 1 LFBSize rd 1
stall_mcs rd 1
current_slot rd 1 current_slot rd 1
; status ; 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 more DiskMediaChanged, then optionally DiskDel. The driver must not call
two functions in parallel, including two calls to DiskMediaChanged. two functions in parallel, including two calls to DiskMediaChanged.
void* DiskAdd(DISKFUNC* functions, const char* name, void* userdata, int flags); void* stdcall DiskAdd(DISKFUNC* functions, const char* name, void* userdata,
; The pointer 'functions' must be valid at least until the disk will be deleted int flags); ; The pointer 'functions' must be valid at least until the disk
; (until DISKFUNC.close is called). will be deleted ; (until DISKFUNC.close is called). ; The pointer 'name' can
; The pointer 'name' can be invalid after this function returns. be invalid after this function returns. ; It should point to ASCIIZ-string
; It should point to ASCIIZ-string without leading '/' in latin lowercase and without leading '/' in latin lowercase and ; digits, like 'usbhd0'. ; The
; digits, like 'usbhd0'. value 'userdata' is any pointer-sized data, passed as is to all ; callbacks.
; The value 'userdata' is any pointer-sized data, passed as is to all
; callbacks.
DISK_NO_INSERT_NOTIFICATION = 1 DISK_NO_INSERT_NOTIFICATION = 1
; The bitfield 'flags' has currently only one bit defined. If it is set, the ; 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 ; driver will never call DiskMediaChanged(hDisk, true), so the kernel must scan
@ -29,13 +27,13 @@ struc DISKFUNC
{ {
.strucsize dd ? .strucsize dd ?
.close dd ? .close dd ?
; void close(void* userdata); ; void stdcall (*close)(void* userdata);
; Optional. ; Optional.
; The last function that is called for the given disk. The kernel calls it when ; 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 ; the kernel has finished all operations with the disk and it is safe to free
; all driver-specific data identified by 'userdata'. ; all driver-specific data identified by 'userdata'.
.closemedia dd ? .closemedia dd ?
; void closemedia(void* userdata); ; void stdcall (*closemedia)(void* userdata);
; Optional. ; Optional.
; The kernel calls this function when it finished all processing with the ; The kernel calls this function when it finished all processing with the
; current media. If media is removed, the driver should decline all requests ; 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 ; until this function is called. If media is removed, a new call to
; DiskMediaChanged(hDisk, true) is not allowed until this function is called. ; DiskMediaChanged(hDisk, true) is not allowed until this function is called.
.querymedia dd ? .querymedia dd ?
; int querymedia(void* userdata, DISKMEDIAINFO* info); ; int stdcall (*querymedia)(void* userdata, DISKMEDIAINFO* info);
; return value: 0 = success, otherwise = error ; return value: 0 = success, otherwise = error
.read dd ? .read dd ?
; int read(void* userdata, void* buffer, __int64 startsector, ; int stdcall (*read)(void* userdata, void* buffer, __int64 startsector,
; int* numsectors); ; int* numsectors);
; return value: 0 = success, otherwise = error ; return value: 0 = success, otherwise = error
.write dd ? .write dd ?
; int write(void* userdata, const void* buffer, __int64 startsector, ; int stdcall (*write)(void* userdata, const void* buffer, __int64 startsector,
; int* numsectors); ; int* numsectors);
; Optional. ; Optional.
; return value: 0 = success, otherwise = error ; return value: 0 = success, otherwise = error
.flush dd ? .flush dd ?
; int flush(void* userdata); ; int stdcall (*flush)(void* userdata);
; Optional. ; Optional.
; Flushes the hardware cache, if it exists. Note that a driver should not ; 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 ; implement a software cache for read/write, since they are called from the
; kernel cache manager. ; kernel cache manager.
.adjust_cache_size dd ? .adjust_cache_size dd ?
; unsigned int adjust_cache_size(unsigned int suggested_size); ; unsigned int stdcall (*adjust_cache_size)(unsigned int suggested_size);
; Optional. ; Optional.
; Returns the cache size for this device in bytes. 0 = disable cache. ; Returns the cache size for this device in bytes. 0 = disable cache.
} }

View File

@ -200,10 +200,10 @@
* ecx = 0xXYRRGGBB, £¤¥ * ecx = 0xXYRRGGBB, £¤¥
* RR, GG, BB § ¤ îâ 梥â ⥪áâ  * RR, GG, BB § ¤ îâ 梥â ⥪áâ 
* X=ABnn (¡¨âë): * X=ABnn (¡¨âë):
* nn § ¤ ¥â ¨á¯®«ì§ã¥¬ë© èà¨äâ: 0=á¨á⥬­ë© ¬®­®è¨à¨­­ë©, * nn § ¤ ¥â ¨á¯®«ì§ã¥¬ë© èà¨äâ: 0=á¨á⥬­ë© ¬®­®è¨à¨­­ë©,
1=á¨á⥬­ë© èà¨äâ ¯¥à¥¬¥­­®© è¨à¨­ë 1=á¨á⥬­ë© èà¨äâ ¯¥à¥¬¥­­®© è¨à¨­ë
* A=0 - ¢ë¢®¤¨âì esi ᨬ¢®«®¢, A=1 - ¢ë¢®¤¨âì ASCIIZ-áâபã * A=0 - ¢ë¢®¤¨âì esi ᨬ¢®«®¢, A=1 - ¢ë¢®¤¨âì ASCIIZ-áâபã
* B=1 - § ªà è¨¢ âì ä®­ 梥⮬ edi * B=1 - § ªà è¨¢ âì ä®­ 梥⮬ edi
* Y=Cnnn (¡¨âë): * Y=Cnnn (¡¨âë):
* C=1 ¯¥à¥­ ¯à ¢¨âì ¢ë¢®¤ ¢ ®¡« áâì ¯®«ì§®¢ â¥«ï, § ¤ ­® ¢ edi * C=1 ¯¥à¥­ ¯à ¢¨âì ¢ë¢®¤ ¢ ®¡« áâì ¯®«ì§®¢ â¥«ï, § ¤ ­® ¢ edi
* nnn - ­¥ ¨á¯®«ì§ã¥âáï ¢ ⥪ã饬 ¢¨¤¥, ¤®«¦­® ¡ëâì 0 (zero) * nnn - ­¥ ¨á¯®«ì§ã¥âáï ¢ ⥪ã饬 ¢¨¤¥, ¤®«¦­® ¡ëâì 0 (zero)
@ -3414,15 +3414,17 @@ IPC
* ebx = 3 - ­®¬¥à ¯®¤ä㭪樨 * ebx = 3 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ¡¨â®¢ ï ¬ áª : * eax = ¡¨â®¢ ï ¬ áª :
* ¡¨â 0 (¬ áª  1): «¥¢ë© Shift ­ ¦ â * ¡¨â 0 (¬ áª  1): «¥¢ë© Shift ­ ¦ â
* ¡¨â 1 (¬ áª  2): ¯à ¢ë© Shift ­ ¦ â * ¡¨â 1 (¬ áª  2): ¯à ¢ë© Shift ­ ¦ â
* ¡¨â 2 (¬ áª  4): «¥¢ë© Ctrl ­ ¦ â * ¡¨â 2 (¬ áª  4): «¥¢ë© Ctrl ­ ¦ â
* ¡¨â 3 (¬ áª  8): ¯à ¢ë© Ctrl ­ ¦ â * ¡¨â 3 (¬ áª  8): ¯à ¢ë© Ctrl ­ ¦ â
* ¡¨â 4 (¬ áª  0x10): «¥¢ë© Alt ­ ¦ â * ¡¨â 4 (¬ áª  0x10): «¥¢ë© Alt ­ ¦ â
* ¡¨â 5 (¬ áª  0x20): ¯à ¢ë© Alt ­ ¦ â * ¡¨â 5 (¬ áª  0x20): ¯à ¢ë© Alt ­ ¦ â
* ¡¨â 6 (¬ áª  0x40): CapsLock ¢ª«îçñ­ * ¡¨â 6 (¬ áª  0x40): CapsLock ¢ª«îçñ­
* ¡¨â 7 (¬ áª  0x80): NumLock ¢ª«îçñ­ * ¡¨â 7 (¬ áª  0x80): NumLock ¢ª«îçñ­
* ¡¨â 8 (¬ áª  0x100): ScrollLock ¢ª«îçñ­ * ¡¨â 8 (¬ áª  0x100): ScrollLock ¢ª«îçñ­
* ¡¨â 9 (¬ áª  0x200): «¥¢ë© Win ­ ¦ â
* ¡¨â 10 (¬ áª  0x400): ¯à ¢ë© Win ­ ¦ â
* ¯à®ç¨¥ ¡¨âë á¡à®è¥­ë * ¯à®ç¨¥ ¡¨âë á¡à®è¥­ë
----- <20>®¤äã­ªæ¨ï 4 - ãáâ ­®¢¨âì ®¡é¥á¨á⥬­ãî "£®àïçãî ª« ¢¨èã". ----- ----- <20>®¤äã­ªæ¨ï 4 - ãáâ ­®¢¨âì ®¡é¥á¨á⥬­ãî "£®àïçãî ª« ¢¨èã". -----
@ -4571,6 +4573,46 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* eax = 0 - ãᯥ譮 * eax = 0 - ãᯥ譮
* eax = 1 - ¡ãä¥à § ¯®«­¥­ * 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 - § ¢¥àè¨âì ¢ë¯®«­¥­¨¥ ¯®â®ª /¯à®æ¥áá  ========= ========== ”ã­ªæ¨ï -1 - § ¢¥àè¨âì ¢ë¯®«­¥­¨¥ ¯®â®ª /¯à®æ¥áá  =========
====================================================================== ======================================================================

View File

@ -197,19 +197,19 @@ Parameters:
* ecx = 0xXYRRGGBB, where * ecx = 0xXYRRGGBB, where
* RR, GG, BB specify text color * RR, GG, BB specify text color
* X=ABnn (bits): * X=ABnn (bits):
* nn specifies the used font: 0=system monospaced, * nn specifies the used font: 0=system monospaced,
1=system font of variable width 1=system font of variable width
* A=0 - output esi characters, A=1 - output ASCIIZ-string * A=0 - output esi characters, A=1 - output ASCIIZ-string
* B=1 - fill background with the color edi * B=1 - fill background with the color edi
* Y = Cnnn * Y = Cnnn
* C=1 redirect the output to the user area, specified in edi * C=1 redirect the output to the user area, specified in edi
* nnn - not used in the current, must be 0 (zero) * nnn - not used in the current, must be 0 (zero)
* edx = pointer to the beginning of the string * edx = pointer to the beginning of the string
* esi = for A=0 length of the string, must not exceed 255; * esi = for A=0 length of the string, must not exceed 255;
for A=1 is ignored for A=1 is ignored
* edi = color to fill background, if B=1 * edi = color to fill background, if B=1
* edi = pointer to user area, for redirect, if C=1 * edi = pointer to user area, for redirect, if C=1
Returned value: Returned value:
* function does not return value * function does not return value
Remarks: Remarks:
@ -1566,26 +1566,26 @@ Returned value:
Remarks: Remarks:
* The function is supported only for ATAPI devices (CD and DVD). * The function is supported only for ATAPI devices (CD and DVD).
* An example of usage of the function is the application CD_tray. * An example of usage of the function is the application CD_tray.
====================================================================== ======================================================================
======= Function 25 - put image area on the background layer. ======== ======= Function 25 - put image area on the background layer. ========
====================================================================== ======================================================================
Paramters: Paramters:
* eax = 25 - function number * eax = 25 - function number
* ebx = pointer to the previously allocated memory area, * ebx = pointer to the previously allocated memory area,
where placed the source images in a format BBGGRRTTBBGGRRTT... where placed the source images in a format BBGGRRTTBBGGRRTT...
* ecx = [size on axis x]*65536 + [size on axis y] * ecx = [size on axis x]*65536 + [size on axis y]
* edx = [coordinate on axis x]*65536 + [coordinate on axis y] * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
Returned value: Returned value:
* function does not return value * function does not return value
Remarks: Remarks:
* Coordinates of the image are coordinates of the upper left corner * Coordinates of the image are coordinates of the upper left corner
of the image relative to the screen. of the image relative to the screen.
* Size of the image in bytes is 4*xsize*ysize * Size of the image in bytes is 4*xsize*ysize
* TT - byte pointer of transparency, at current version: * TT - byte pointer of transparency, at current version:
1 to FF - opaque, 0 - transparent. 1 to FF - opaque, 0 - transparent.
* The function places the image directly to LFB. It is not for * The function places the image directly to LFB. It is not for
background image f.15. Options f.15 to f.25 does not make sense. background image f.15. Options f.15 to f.25 does not make sense.
====================================================================== ======================================================================
======== Function 26, subfunction 1 - get MPU MIDI base port. ======== ======== Function 26, subfunction 1 - get MPU MIDI base port. ========
@ -1788,7 +1788,7 @@ Returned value:
* eax = 0x000000XX - owner of pixel the slot window N * eax = 0x000000XX - owner of pixel the slot window N
If incorrect values ebx and ecx then function returns 0 If incorrect values ebx and ecx then function returns 0
* The function takes the value from the area [_WinMapAddress] * The function takes the value from the area [_WinMapAddress]
====================================================================== ======================================================================
======= Function 35 - read the color of a pixel on the screen. ======= ======= Function 35 - read the color of a pixel on the screen. =======
====================================================================== ======================================================================
@ -3394,15 +3394,17 @@ Parameters:
* ebx = 3 - subfunction number * ebx = 3 - subfunction number
Returned value: Returned value:
* eax = bit mask: * eax = bit mask:
* bit 0 (mask 1): left Shift is pressed * bit 0 (mask 1): left Shift is pressed
* bit 1 (mask 2): right Shift is pressed * bit 1 (mask 2): right Shift is pressed
* bit 2 (mask 4): left Ctrl is pressed * bit 2 (mask 4): left Ctrl is pressed
* bit 3 (mask 8): right Ctrl is pressed * bit 3 (mask 8): right Ctrl is pressed
* bit 4 (mask 0x10): left Alt is pressed * bit 4 (mask 0x10): left Alt is pressed
* bit 5 (mask 0x20): right Alt is pressed * bit 5 (mask 0x20): right Alt is pressed
* bit 6 (mask 0x40): CapsLock is on * bit 6 (mask 0x40): CapsLock is on
* bit 7 (mask 0x80): NumLock is on * bit 7 (mask 0x80): NumLock is on
* bit 8 (mask 0x100): ScrollLock 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 * other bits are cleared
-------------- Subfunction 4 - set system-wide hotkey. --------------- -------------- Subfunction 4 - set system-wide hotkey. ---------------
@ -4135,8 +4137,8 @@ Examples:
* '/hd0/2/menuet/pics/tanzania.bmp',0 * '/hd0/2/menuet/pics/tanzania.bmp',0
* '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0 * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
* '/sys/MySuperApp.ini',0 * '/sys/MySuperApp.ini',0
Also function supports relative names. If the path begins not Also function supports relative names. If the path begins not
with '/', it is considered relative to a current folder. To get or with '/', it is considered relative to a current folder. To get or
set a current folder, use the function 30. set a current folder, use the function 30.
Available subfunctions: Available subfunctions:
@ -4555,7 +4557,7 @@ Parameters:
B - blit into the background surface B - blit into the background surface
T - transparent blit T - transparent blit
* ecx = pointer to the function parametrs * ecx = pointer to the function parameters
destination offset and clipping destination offset and clipping
+0 signed dword: destination rectangle X offset from the window +0 signed dword: destination rectangle X offset from the window
top-left corner top-left corner
@ -4565,18 +4567,19 @@ Parameters:
+12 dword: destination rectangle height +12 dword: destination rectangle height
source offset and clipping source offset and clipping
+16 signed dword: source rectangle X offset from the bitmap top-left corner +16 signed dword: source rectangle X offset from the bitmap
+20 signed dword: source rectangle Y offset from the bitmap top-left corner top-left corner
+20 signed dword: source rectangle Y offset from the bitmap
top-left corner
+24 dword: source rectangle width +24 dword: source rectangle width
+28 dword: source rectangle height +28 dword: source rectangle height
+32: dword: size of the bitmap row in bytes +32: dword: bitmap data - must be 32bpp
+36: dword: bitmap data - must be 32bpp +36: dword: size of the bitmap row in bytes
Returned value: Returned value:
* function does not return value * function does not return value
====================================================================== ======================================================================
=============== Function -1 - terminate thread/process =============== =============== Function -1 - terminate thread/process ===============
====================================================================== ======================================================================

View File

@ -379,10 +379,10 @@ align 4
mov eax, esp mov eax, esp
push ebx push ebx
push ecx push ecx
push edx push edx
push esi push esi
push edi push edi
push 4 ;.out_size push 4 ;.out_size
@ -397,10 +397,10 @@ align 4
add esp, 6*4 add esp, 6*4
pop edi pop edi
pop esi pop esi
pop edx pop edx
pop ecx pop ecx
pop ebx pop ebx
test eax, eax test eax, eax
jz @F jz @F

View File

@ -6,30 +6,30 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;flags------------------------------------------------------------ ;flags------------------------------------------------------------
DEBUG equ 1 ;show messages at debug board DEBUG equ 1 ;show messages at debug board
use_cli_sti equ 1 ;driver become more stable (theoretically) use_cli_sti equ 1 ;driver become more stable (theoretically)
;constants-------------------------------------------------------- ;constants--------------------------------------------------------
API_VERSION equ 0 ;debug API_VERSION equ 0 ;debug
OS_BASE equ 0x80000000 OS_BASE equ 0x80000000
new_app_base equ 0x0 new_app_base equ 0x0
PROC_BASE equ (OS_BASE+0x080000) PROC_BASE equ (OS_BASE+0x080000)
SB16Buffer equ (OS_BASE+0x2A0000) SB16Buffer equ (OS_BASE+0x2A0000)
SB16_Status equ (OS_BASE+0x2B0000) SB16_Status equ (OS_BASE+0x2B0000)
DMAPage equ ((SB16Buffer-OS_BASE) shr 16) DMAPage equ ((SB16Buffer-OS_BASE) shr 16)
SB16Buffer0 equ SB16Buffer SB16Buffer0 equ SB16Buffer
SB16Buffer1 equ (SB16Buffer+16384) SB16Buffer1 equ (SB16Buffer+16384)
SB16Buffer2 equ (SB16Buffer+(2*16384)) SB16Buffer2 equ (SB16Buffer+(2*16384))
SB16Buffer3 equ (SB16Buffer+(3*16384)) SB16Buffer3 equ (SB16Buffer+(3*16384))
sb_irq_num equ 5 ;default values for SB16, may be overrided by autodetect sb_irq_num equ 5 ;default values for SB16, may be overrided by autodetect
sb_dma_num equ 5 ;default values for SB16, may be overrided by autodetect sb_dma_num equ 5 ;default values for SB16, may be overrided by autodetect
small_buffer equ 32768 small_buffer equ 32768
full_buffer equ 65536 full_buffer equ 65536
sb_buffer_size equ small_buffer ; FIX ring buffer overlapped events issue; full_buffer sb_buffer_size equ small_buffer ; FIX ring buffer overlapped events issue; full_buffer
__supported_buffer_sizes fix <small_buffer, full_buffer> __supported_buffer_sizes fix <small_buffer, full_buffer>
@ -38,20 +38,20 @@ display 13,10,'unsupported buffer size was selected, check config.inc',13,10
stop stop
end if end if
sb_out_rate equ 48000 sb_out_rate equ 48000
;time constant for cards older than SB16 ;time constant for cards older than SB16
sb_tc equ (256-(1000000/(sb_out_rate*2))) sb_tc equ (256-(1000000/(sb_out_rate*2)))
SRV_GETVERSION equ 0 SRV_GETVERSION equ 0
DEV_PLAY equ 1 DEV_PLAY equ 1
DEV_STOP equ 2 DEV_STOP equ 2
DEV_CALLBACK equ 3 DEV_CALLBACK equ 3
DEV_SET_BUFF equ 4 DEV_SET_BUFF equ 4
DEV_NOTIFY equ 5 DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6 DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7 DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8 DEV_GET_INFO equ 8
DRV_ENTRY equ 1 DRV_ENTRY equ 1
DRV_EXIT equ -1 DRV_EXIT equ -1

View File

@ -43,21 +43,21 @@ section '.flat' code readable align 16
proc START stdcall, state:dword proc START stdcall, state:dword
cmp [state], 1 cmp [state], 1
jne .exit jne .exit
.entry: .entry:
if DEBUG if DEBUG
mov esi, msgInit mov esi, msgInit
call SysMsgBoardStr call SysMsgBoardStr
end if end if
stdcall RegService, my_service, service_proc stdcall RegService, my_service, service_proc
ret ret
.fail: .fail:
.exit: .exit:
xor eax, eax xor eax, eax
ret ret
endp endp
handle equ IOCTL.handle handle equ IOCTL.handle
@ -70,21 +70,21 @@ out_size equ IOCTL.out_size
align 4 align 4
proc service_proc stdcall, ioctl:dword proc service_proc stdcall, ioctl:dword
mov ebx, [ioctl] mov ebx, [ioctl]
mov eax, [ebx+io_code] mov eax, [ebx+io_code]
cmp eax, SRV_GETVERSION cmp eax, SRV_GETVERSION
jne @F jne @F
mov eax, [ebx+output] mov eax, [ebx+output]
cmp [ebx+out_size], 4 cmp [ebx+out_size], 4
jne .fail jne .fail
mov [eax], dword API_VERSION mov [eax], dword API_VERSION
xor eax, eax xor eax, eax
ret ret
@@: @@:
.fail: .fail:
or eax, -1 or eax, -1
ret ret
endp endp
restore handle restore handle
@ -100,53 +100,53 @@ proc detect
last_bus dd ? last_bus dd ?
endl endl
xor eax, eax xor eax, eax
mov [bus], eax mov [bus], eax
inc eax inc eax
call PciApi call PciApi
cmp eax, -1 cmp eax, -1
je .err je .err
mov [last_bus], eax mov [last_bus], eax
.next_bus: .next_bus:
and [devfn], 0 and [devfn], 0
.next_dev: .next_dev:
stdcall PciRead32, [bus], [devfn], dword 0 stdcall PciRead32, [bus], [devfn], dword 0
test eax, eax test eax, eax
jz .next jz .next
cmp eax, -1 cmp eax, -1
je .next je .next
mov edi, devices mov edi, devices
@@: @@:
mov ebx, [edi] mov ebx, [edi]
test ebx, ebx test ebx, ebx
jz .next jz .next
cmp eax, ebx cmp eax, ebx
je .found je .found
add edi, STRIDE add edi, STRIDE
jmp @B jmp @B
.next: .next:
inc [devfn] inc [devfn]
cmp [devfn], 256 cmp [devfn], 256
jb .next_dev jb .next_dev
mov eax, [bus] mov eax, [bus]
inc eax inc eax
mov [bus], eax mov [bus], eax
cmp eax, [last_bus] cmp eax, [last_bus]
jna .next_bus jna .next_bus
xor eax, eax xor eax, eax
ret ret
.found: .found:
xor eax, eax xor eax, eax
inc eax inc eax
ret ret
.err: .err:
xor eax, eax xor eax, eax
ret ret
endp endp
DEVICE_ID equ 1234; pci device id DEVICE_ID equ 1234; pci device id

View File

@ -74,7 +74,7 @@ format_disk_fat16:
mov edx, eax mov edx, eax
@@: @@:
; 2. Zero all system areas on the disk. ; 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 and ecx, not 255
shr ecx, 1 shr ecx, 1
xor eax, eax xor eax, eax
@ -299,7 +299,7 @@ fat32bootsector_stub:
db 'KOLIBRI ' ; BS_OEMName db 'KOLIBRI ' ; BS_OEMName
dw 512 ; BPB_BytsPerSec dw 512 ; BPB_BytsPerSec
db 1 ; BPB_SecsPerClus db 1 ; BPB_SecsPerClus
dw 1 ; BPB_RsvdSecCnt dw 2 ; BPB_RsvdSecCnt
db 1 ; BPB_NumFATs db 1 ; BPB_NumFATs
dw 0 ; BPB_RootEntCnt dw 0 ; BPB_RootEntCnt
dw 0 ; BPB_TotSec16 dw 0 ; BPB_TotSec16

View File

@ -28,25 +28,25 @@ section '.flat' code readable align 16
; the start procedure (see the description above) ; the start procedure (see the description above)
START: START:
; 1. Detect device. Abort if not found. ; 1. Detect device. Abort if not found.
push esi push esi
call DetectDevice call DetectDevice
test esi, esi test esi, esi
jz .return0 jz .return0
; 2. Detect optimal mode unless the mode is given explicitly. Abort if failed. ; 2. Detect optimal mode unless the mode is given explicitly. Abort if failed.
if use_predefined_mode = 0 if use_predefined_mode = 0
call DetectMode call DetectMode
end if end if
cmp [width], 0 cmp [width], 0
jz .return0_cleanup jz .return0_cleanup
; 3. Set the detected mode. ; 3. Set the detected mode.
call SetMode call SetMode
; 4. Cleanup and return. ; 4. Cleanup and return.
.return0_cleanup: .return0_cleanup:
stdcall FreeKernelSpace, esi stdcall FreeKernelSpace, esi
.return0: .return0:
pop esi pop esi
xor eax, eax xor eax, eax
ret 4 ret 4
; check that there is Intel videocard ; check that there is Intel videocard
; if so, map MMIO registers and set internal variables ; if so, map MMIO registers and set internal variables
@ -54,412 +54,412 @@ end if
DetectDevice: DetectDevice:
; 1. Sanity check: check that we are dealing with Intel videocard. ; 1. Sanity check: check that we are dealing with Intel videocard.
; Integrated video device for Intel is always at PCI:0:2:0. ; Integrated video device for Intel is always at PCI:0:2:0.
xor esi, esi ; initialize return value to NULL xor esi, esi ; initialize return value to NULL
; 1a. Get PCI VendorID and DeviceID. ; 1a. Get PCI VendorID and DeviceID.
push esi push esi
push 10h push 10h
push esi push esi
call PciRead32 call PciRead32
; 1b. loword(eax) = ax = VendorID, hiword(eax) = DeviceID. ; 1b. loword(eax) = ax = VendorID, hiword(eax) = DeviceID.
; Test whether we have Intel chipset. ; Test whether we have Intel chipset.
cmp ax, 8086h cmp ax, 8086h
jnz .return jnz .return
; 1c. Say hi including DeviceID. ; 1c. Say hi including DeviceID.
shr eax, 10h shr eax, 10h
push edi push edi
pusha pusha
mov edi, pciid_text mov edi, pciid_text
call WriteWord call WriteWord
mov esi, hellomsg mov esi, hellomsg
call SysMsgBoardStr call SysMsgBoardStr
popa popa
; 1d. Test whether we know this DeviceID. ; 1d. Test whether we know this DeviceID.
; If this is the case, remember the position of the device in line of Intel cards; ; If this is the case, remember the position of the device in line of Intel cards;
; this knowledge will be useful later. ; this knowledge will be useful later.
; Tested on devices with id: 8086:0046, partially 8086:2A02. ; Tested on devices with id: 8086:0046, partially 8086:2A02.
mov ecx, pciids_num mov ecx, pciids_num
mov edi, pciids mov edi, pciids
repnz scasw repnz scasw
pop edi pop edi
jnz .return_unknown_pciid jnz .return_unknown_pciid
sub ecx, pciids_num - 1 sub ecx, pciids_num - 1
neg ecx neg ecx
mov [deviceType], ecx mov [deviceType], ecx
; 1e. Continue saying hi with positive intonation. ; 1e. Continue saying hi with positive intonation.
pusha pusha
mov esi, knownmsg mov esi, knownmsg
call SysMsgBoardStr call SysMsgBoardStr
popa popa
; 2. Prepare MMIO region to control the card. ; 2. Prepare MMIO region to control the card.
; 2a. Read MMIO physical address from PCI config space. ; 2a. Read MMIO physical address from PCI config space.
push 10h push 10h
cmp ecx, i9xx_start cmp ecx, i9xx_start
jae @f jae @f
mov byte [esp], 14h mov byte [esp], 14h
@@: @@:
push 10h push 10h
push esi push esi
call PciRead32 call PciRead32
; 2b. Mask out PCI region type, lower 4 bits. ; 2b. Mask out PCI region type, lower 4 bits.
and al, not 0xF and al, not 0xF
; 2c. Create virtual mapping of the physical memory. ; 2c. Create virtual mapping of the physical memory.
push 1Bh push 1Bh
push 100000h push 100000h
push eax push eax
call MapIoMem call MapIoMem
; 3. Return. ; 3. Return.
xchg esi, eax xchg esi, eax
.return: .return:
ret ret
; 1f. If we do not know DeviceID, continue saying hi with negative intonation. ; 1f. If we do not know DeviceID, continue saying hi with negative intonation.
.return_unknown_pciid: .return_unknown_pciid:
pusha pusha
mov esi, unknownmsg mov esi, unknownmsg
call SysMsgBoardStr call SysMsgBoardStr
popa popa
ret ret
; Convert word in ax to hexadecimal text in edi, advance edi. ; Convert word in ax to hexadecimal text in edi, advance edi.
WriteWord: WriteWord:
; 1. Convert high byte. ; 1. Convert high byte.
push eax push eax
mov al, ah mov al, ah
call WriteByte call WriteByte
pop eax pop eax
; 2. Convert low byte. ; 2. Convert low byte.
; Fall through to WriteByte; ret from WriteByte is ret from WriteWord too. ; Fall through to WriteByte; ret from WriteByte is ret from WriteWord too.
; Convert byte in al to hexadecimal text in edi, advance edi. ; Convert byte in al to hexadecimal text in edi, advance edi.
WriteByte: WriteByte:
; 1. Convert high nibble. ; 1. Convert high nibble.
push eax push eax
shr al, 4 shr al, 4
call WriteNibble call WriteNibble
pop eax pop eax
; 2. Convert low nibble. ; 2. Convert low nibble.
and al, 0xF and al, 0xF
; Fall through to WriteNibble; ret from WriteNibble is ret from WriteByte too. ; Fall through to WriteNibble; ret from WriteNibble is ret from WriteByte too.
; Convert nibble in al to hexadecimal text in edi, advance edi. ; Convert nibble in al to hexadecimal text in edi, advance edi.
WriteNibble: WriteNibble:
; Obvious, isn't it? ; Obvious, isn't it?
cmp al, 10 cmp al, 10
sbb al, 69h sbb al, 69h
das das
stosb stosb
ret ret
if use_predefined_mode = 0 if use_predefined_mode = 0
; detect resolution of the flat panel ; detect resolution of the flat panel
DetectMode: DetectMode:
push esi edi push esi edi
; 1. Get the location of block of GMBUS* registers. ; 1. Get the location of block of GMBUS* registers.
; Starting with Ironlake, GMBUS* registers were moved. ; Starting with Ironlake, GMBUS* registers were moved.
add esi, 5100h add esi, 5100h
cmp [deviceType], ironlake_start cmp [deviceType], ironlake_start
jb @f jb @f
add esi, 0xC0000 add esi, 0xC0000
@@: @@:
; 2. Initialize GMBUS engine. ; 2. Initialize GMBUS engine.
mov edi, edid mov edi, edid
mov ecx, 0x10000 mov ecx, 0x10000
@@: @@:
test byte [esi+8+1], 80h test byte [esi+8+1], 80h
loopnz @b loopnz @b
jnz .fail jnz .fail
mov dword [esi], 3 mov dword [esi], 3
test byte [esi+8+1], 4 test byte [esi+8+1], 4
jz .noreset jz .noreset
call ResetGMBus call ResetGMBus
jnz .fail jnz .fail
.noreset: .noreset:
; 3. Send read command. ; 3. Send read command.
and dword [esi+20h], 0 and dword [esi+20h], 0
mov dword [esi+4], 4E8000A1h mov dword [esi+4], 4E8000A1h
; 4. Wait for data, writing to the buffer as data arrive. ; 4. Wait for data, writing to the buffer as data arrive.
.getdata: .getdata:
mov ecx, 0x10000 mov ecx, 0x10000
@@: @@:
test byte [esi+8+1], 8 test byte [esi+8+1], 8
loopz @b loopz @b
test byte [esi+8+1], 4 test byte [esi+8+1], 4
jz .dataok jz .dataok
call ResetGMBus call ResetGMBus
jmp .fail jmp .fail
.dataok: .dataok:
mov eax, [esi+0Ch] mov eax, [esi+0Ch]
stosd stosd
cmp edi, edid+80h cmp edi, edid+80h
jb .getdata jb .getdata
; 5. Wait for bus idle. ; 5. Wait for bus idle.
mov ecx, 0x10000 mov ecx, 0x10000
@@: @@:
test byte [esi+8+1], 2 test byte [esi+8+1], 2
loopnz @b loopnz @b
; 6. We got EDID; dump it if DEBUG. ; 6. We got EDID; dump it if DEBUG.
if DEBUG if DEBUG
pusha pusha
xor ecx, ecx xor ecx, ecx
mov esi, edid mov esi, edid
mov edi, edid_text mov edi, edid_text
.dumploop: .dumploop:
lodsb lodsb
call WriteByte call WriteByte
mov al, ' ' mov al, ' '
stosb stosb
inc cl inc cl
test cl, 15 test cl, 15
jnz @f jnz @f
mov byte [edi-1], 13 mov byte [edi-1], 13
mov al, 10 mov al, 10
stosb stosb
@@: @@:
test cl, cl test cl, cl
jns .dumploop jns .dumploop
mov esi, edidmsg mov esi, edidmsg
call SysMsgBoardStr call SysMsgBoardStr
popa popa
end if end if
; 7. Test whether EDID is good. ; 7. Test whether EDID is good.
; 7a. Signature: 00 FF FF FF FF FF FF 00. ; 7a. Signature: 00 FF FF FF FF FF FF 00.
mov esi, edid mov esi, edid
cmp dword [esi], 0xFFFFFF00 cmp dword [esi], 0xFFFFFF00
jnz .fail jnz .fail
cmp dword [esi+4], 0x00FFFFFF cmp dword [esi+4], 0x00FFFFFF
jnz .fail jnz .fail
; 7b. Checksum must be zero. ; 7b. Checksum must be zero.
xor edx, edx xor edx, edx
mov ecx, 80h mov ecx, 80h
@@: @@:
lodsb lodsb
add dl, al add dl, al
loop @b loop @b
jnz .fail jnz .fail
; 8. Get width and height from EDID. ; 8. Get width and height from EDID.
xor eax, eax xor eax, eax
mov ah, [esi-80h+3Ah] mov ah, [esi-80h+3Ah]
shr ah, 4 shr ah, 4
mov al, [esi-80h+38h] mov al, [esi-80h+38h]
mov [width], eax mov [width], eax
mov ah, [esi-80h+3Dh] mov ah, [esi-80h+3Dh]
shr ah, 4 shr ah, 4
mov al, [esi-80h+3Bh] mov al, [esi-80h+3Bh]
mov [height], eax mov [height], eax
; 9. Return. ; 9. Return.
.fail: .fail:
pop edi esi pop edi esi
ret ret
; reset bus, clear all errors ; reset bus, clear all errors
ResetGMBus: ResetGMBus:
; look into the PRM ; look into the PRM
mov dword [esi+4], 80000000h mov dword [esi+4], 80000000h
mov dword [esi+4], 0 mov dword [esi+4], 0
mov ecx, 0x10000 mov ecx, 0x10000
@@: @@:
test byte [esi+8+1], 2 test byte [esi+8+1], 2
loopnz @b loopnz @b
ret ret
end if end if
; set resolution [width]*[height] ; set resolution [width]*[height]
SetMode: SetMode:
; 1. Program the registers of videocard. ; 1. Program the registers of videocard.
; look into the PRM ; look into the PRM
cli cli
; or byte [esi+7000Ah], 0Ch ; PIPEACONF: disable Display+Cursor Planes ; or byte [esi+7000Ah], 0Ch ; PIPEACONF: disable Display+Cursor Planes
; or byte [esi+7100Ah], 0Ch ; PIPEBCONF: disable Display+Cursor Planes ; or byte [esi+7100Ah], 0Ch ; PIPEBCONF: disable Display+Cursor Planes
xor eax, eax xor eax, eax
xor edx, edx xor edx, edx
cmp [deviceType], i965_start cmp [deviceType], i965_start
jb @f jb @f
mov dl, 9Ch - 84h mov dl, 9Ch - 84h
@@: @@:
; or byte [esi+71403h], 80h ; VGACNTRL: VGA Display Disable ; or byte [esi+71403h], 80h ; VGACNTRL: VGA Display Disable
and byte [esi+70080h], not 27h ; CURACNTR: disable cursor A and byte [esi+70080h], not 27h ; CURACNTR: disable cursor A
mov dword [esi+70084h], eax ; CURABASE: force write to CURA* regs mov dword [esi+70084h], eax ; CURABASE: force write to CURA* regs
and byte [esi+700C0h], not 27h ; CURBCNTR: disable cursor B and byte [esi+700C0h], not 27h ; CURBCNTR: disable cursor B
mov dword [esi+700C4h], eax ; CURBBASE: force write to CURB* regs mov dword [esi+700C4h], eax ; CURBBASE: force write to CURB* regs
and byte [esi+70183h], not 80h ; DSPACNTR: disable Primary A Plane and byte [esi+70183h], not 80h ; DSPACNTR: disable Primary A Plane
mov dword [esi+edx+70184h], eax ; DSPALINOFF/DSPASURF: force write to DSPA* regs mov dword [esi+edx+70184h], eax ; DSPALINOFF/DSPASURF: force write to DSPA* regs
and byte [esi+71183h], not 80h ; DSPBCNTR: disable Primary B Plane and byte [esi+71183h], not 80h ; DSPBCNTR: disable Primary B Plane
mov dword [esi+edx+71184h], eax ; DSPBLINOFF/DSPBSURF: force write to DSPB* regs mov dword [esi+edx+71184h], eax ; DSPBLINOFF/DSPBSURF: force write to DSPB* regs
if 1 if 1
cmp [deviceType], ironlake_start cmp [deviceType], ironlake_start
jae .disable_pipes jae .disable_pipes
mov edx, 10000h mov edx, 10000h
or byte [esi+70024h], 2 ; PIPEASTAT: clear VBLANK status or byte [esi+70024h], 2 ; PIPEASTAT: clear VBLANK status
or byte [esi+71024h], 2 ; PIPEBSTAT: clear VBLANK status or byte [esi+71024h], 2 ; PIPEBSTAT: clear VBLANK status
.wait_vblank_preironlake1: .wait_vblank_preironlake1:
mov ecx, 1000h mov ecx, 1000h
loop $ loop $
test byte [esi+7000Bh], 80h ; PIPEACONF: pipe A active? test byte [esi+7000Bh], 80h ; PIPEACONF: pipe A active?
jz @f jz @f
test byte [esi+70024h], 2 ; PIPEASTAT: got VBLANK? test byte [esi+70024h], 2 ; PIPEASTAT: got VBLANK?
jz .wait_vblank_preironlake2 jz .wait_vblank_preironlake2
@@: @@:
test byte [esi+7100Bh], 80h ; PIPEBCONF: pipe B active? test byte [esi+7100Bh], 80h ; PIPEBCONF: pipe B active?
jz .disable_pipes jz .disable_pipes
test byte [esi+71024h], 2 ; PIPEBSTAT: got VBLANK? test byte [esi+71024h], 2 ; PIPEBSTAT: got VBLANK?
jnz .disable_pipes jnz .disable_pipes
.wait_vblank_preironlake2: .wait_vblank_preironlake2:
dec edx dec edx
jnz .wait_vblank_preironlake1 jnz .wait_vblank_preironlake1
jmp .not_disabled jmp .not_disabled
.disable_pipes: .disable_pipes:
end if end if
and byte [esi+7000Bh], not 80h ; PIPEACONF: disable pipe and byte [esi+7000Bh], not 80h ; PIPEACONF: disable pipe
and byte [esi+7100Bh], not 80h ; PIPEBCONF: disable pipe and byte [esi+7100Bh], not 80h ; PIPEBCONF: disable pipe
if 1 if 1
mov edx, 10000h mov edx, 10000h
@@: @@:
mov ecx, 1000h mov ecx, 1000h
loop $ loop $
test byte [esi+7000Bh], 40h ; PIPEACONF: wait until pipe disabled test byte [esi+7000Bh], 40h ; PIPEACONF: wait until pipe disabled
jz @f jz @f
dec edx dec edx
jnz @b jnz @b
.not_disabled: .not_disabled:
sti sti
jmp .return jmp .return
@@: @@:
test byte [esi+7100Bh], 40h ; PIPEBCONF: wait until pipe disabled test byte [esi+7100Bh], 40h ; PIPEBCONF: wait until pipe disabled
jz @f jz @f
mov ecx, 1000h mov ecx, 1000h
loop $ loop $
dec edx dec edx
jnz @b jnz @b
jmp .not_disabled jmp .not_disabled
@@: @@:
else else
; alternative way of waiting for pipe stop, works too ; alternative way of waiting for pipe stop, works too
mov edx, 1000h mov edx, 1000h
.dis1: .dis1:
push dword [esi+71000h] push dword [esi+71000h]
push dword [esi+70000h] push dword [esi+70000h]
mov ecx, 10000h mov ecx, 10000h
loop $ loop $
pop eax pop eax
xor eax, [esi+70000h] xor eax, [esi+70000h]
and eax, 1FFFh and eax, 1FFFh
pop eax pop eax
jnz .notdis1 jnz .notdis1
xor eax, [esi+71000h] xor eax, [esi+71000h]
and eax, 1FFFh and eax, 1FFFh
jz .disabled jz .disabled
.notdis1: .notdis1:
dec edx dec edx
jnz .dis1 jnz .dis1
.not_disabled: .not_disabled:
sti sti
jmp .return jmp .return
.disabled: .disabled:
end if end if
lea eax, [esi+61183h] lea eax, [esi+61183h]
cmp [deviceType], ironlake_start cmp [deviceType], ironlake_start
jb @f jb @f
add eax, 0xE0000 - 0x60000 add eax, 0xE0000 - 0x60000
@@: @@:
lea edx, [esi+60000h] lea edx, [esi+60000h]
test byte [eax], 40h test byte [eax], 40h
jz @f jz @f
add edx, 1000h add edx, 1000h
@@: @@:
mov eax, [width] mov eax, [width]
dec eax dec eax
shl eax, 16 shl eax, 16
mov ax, word [height] mov ax, word [height]
dec eax dec eax
mov dword [edx+1Ch], eax ; PIPEASRC: set source image size mov dword [edx+1Ch], eax ; PIPEASRC: set source image size
ror eax, 16 ror eax, 16
mov dword [edx+10190h], eax ; for old cards mov dword [edx+10190h], eax ; for old cards
mov ecx, [width] mov ecx, [width]
add ecx, 15 add ecx, 15
and ecx, not 15 and ecx, not 15
shl ecx, 2 shl ecx, 2
mov dword [edx+10188h], ecx ; DSPASTRIDE: set scanline length mov dword [edx+10188h], ecx ; DSPASTRIDE: set scanline length
and byte [esi+61233h], not 80h ; PFIT_CONTROL: disable panel fitting and byte [esi+61233h], not 80h ; PFIT_CONTROL: disable panel fitting
or byte [edx+1000Bh], 80h ; PIPEACONF: enable pipe or byte [edx+1000Bh], 80h ; PIPEACONF: enable pipe
; and byte [edx+1000Ah], not 0Ch ; PIPEACONF: enable Display+Cursor Planes ; and byte [edx+1000Ah], not 0Ch ; PIPEACONF: enable Display+Cursor Planes
or byte [edx+10183h], 80h ; DSPACNTR: enable Display Plane A or byte [edx+10183h], 80h ; DSPACNTR: enable Display Plane A
sti sti
; 2. Notify the kernel that resolution has changed. ; 2. Notify the kernel that resolution has changed.
call GetDisplay call GetDisplay
mov edx, [width] mov edx, [width]
mov dword [eax+8], edx mov dword [eax+8], edx
mov edx, [height] mov edx, [height]
mov dword [eax+0Ch], edx mov dword [eax+0Ch], edx
mov [eax+18h], ecx mov [eax+18h], ecx
mov eax, [width] mov eax, [width]
dec eax dec eax
dec edx dec edx
call SetScreen call SetScreen
.return: .return:
ret ret
align 4 align 4
hellomsg db 'Intel videocard detected, PciId=8086:' hellomsg db 'Intel videocard detected, PciId=8086:'
pciid_text db '0000' pciid_text db '0000'
db ', which is ', 0 db ', which is ', 0
knownmsg db 'known',13,10,0 knownmsg db 'known',13,10,0
unknownmsg db 'unknown',13,10,0 unknownmsg db 'unknown',13,10,0
if DEBUG if DEBUG
edidmsg db 'EDID successfully read:',13,10 edidmsg db 'EDID successfully read:',13,10
edid_text rb 8*(16*3+1) edid_text rb 8*(16*3+1)
db 0 db 0
end if end if
version: version:
dd 0x50005 dd 0x50005
width dd predefined_width width dd predefined_width
height dd predefined_height height dd predefined_height
pciids: pciids:
dw 0x3577 ; i830m dw 0x3577 ; i830m
dw 0x2562 ; 845g dw 0x2562 ; 845g
dw 0x3582 ; i855gm dw 0x3582 ; i855gm
i865_start = ($ - pciids) / 2 i865_start = ($ - pciids) / 2
dw 0x2572 ; i865g dw 0x2572 ; i865g
i9xx_start = ($ - pciids) / 2 i9xx_start = ($ - pciids) / 2
dw 0x2582 ; i915g dw 0x2582 ; i915g
dw 0x258a ; e7221g (i915g) dw 0x258a ; e7221g (i915g)
dw 0x2592 ; i915gm dw 0x2592 ; i915gm
dw 0x2772 ; i945g dw 0x2772 ; i945g
dw 0x27a2 ; i945gm dw 0x27a2 ; i945gm
dw 0x27ae ; i945gme dw 0x27ae ; i945gme
i965_start = ($ - pciids) / 2 i965_start = ($ - pciids) / 2
dw 0x2972 ; i946qz (i965g) dw 0x2972 ; i946qz (i965g)
dw 0x2982 ; g35g (i965g) dw 0x2982 ; g35g (i965g)
dw 0x2992 ; i965q (i965g) dw 0x2992 ; i965q (i965g)
dw 0x29a2 ; i965g dw 0x29a2 ; i965g
dw 0x29b2 ; q35g dw 0x29b2 ; q35g
dw 0x29c2 ; g33g dw 0x29c2 ; g33g
dw 0x29d2 ; q33g dw 0x29d2 ; q33g
dw 0x2a02 ; i965gm dw 0x2a02 ; i965gm
dw 0x2a12 ; i965gm dw 0x2a12 ; i965gm
dw 0x2a42 ; gm45 dw 0x2a42 ; gm45
dw 0x2e02 ; g45 dw 0x2e02 ; g45
dw 0x2e12 ; g45 dw 0x2e12 ; g45
dw 0x2e22 ; g45 dw 0x2e22 ; g45
dw 0x2e32 ; g45 dw 0x2e32 ; g45
dw 0x2e42 ; g45 dw 0x2e42 ; g45
dw 0x2e92 ; g45 dw 0x2e92 ; g45
dw 0xa001 ; pineview dw 0xa001 ; pineview
dw 0xa011 ; pineview dw 0xa011 ; pineview
ironlake_start = ($ - pciids) / 2 ironlake_start = ($ - pciids) / 2
dw 0x0042 ; ironlake_d dw 0x0042 ; ironlake_d
dw 0x0046 ; ironlake_m dw 0x0046 ; ironlake_m
dw 0x0102 ; sandybridge_d dw 0x0102 ; sandybridge_d
dw 0x0112 ; sandybridge_d dw 0x0112 ; sandybridge_d
dw 0x0122 ; sandybridge_d dw 0x0122 ; sandybridge_d
dw 0x0106 ; sandybridge_m dw 0x0106 ; sandybridge_m
dw 0x0116 ; sandybridge_m dw 0x0116 ; sandybridge_m
dw 0x0126 ; sandybridge_m dw 0x0126 ; sandybridge_m
dw 0x010A ; sandybridge_d dw 0x010A ; sandybridge_d
pciids_num = ($ - pciids) / 2 pciids_num = ($ - pciids) / 2
align 4 align 4
deviceType dd ? deviceType dd ?
edid rb 0x80 edid rb 0x80

View File

@ -10,27 +10,27 @@
$Revision$ $Revision$
EXT2_BAD_INO = 1 EXT2_BAD_INO = 1
EXT2_ROOT_INO = 2 EXT2_ROOT_INO = 2
EXT2_ACL_IDX_INO = 3 EXT2_ACL_IDX_INO = 3
EXT2_ACL_DATA_INO = 4 EXT2_ACL_DATA_INO = 4
EXT2_BOOT_LOADER_INO = 5 EXT2_BOOT_LOADER_INO = 5
EXT2_UNDEL_DIR_INO = 6 EXT2_UNDEL_DIR_INO = 6
;флаги, указываемый в inode файла ;флаги, указываемый в inode файла
EXT2_S_IFREG = 0x8000 EXT2_S_IFREG = 0x8000
EXT2_S_IFDIR = 0x4000 EXT2_S_IFDIR = 0x4000
EXT2_S_IFMT = 0xF000 ;маска для типа файла EXT2_S_IFMT = 0xF000 ;маска для типа файла
;флаги, указываемые в linked list родительской папки ;флаги, указываемые в linked list родительской папки
EXT2_FT_REG_FILE = 1 ;это файл, запись в родительском каталоге EXT2_FT_REG_FILE = 1 ;это файл, запись в родительском каталоге
EXT2_FT_DIR = 2 ;это папка EXT2_FT_DIR = 2 ;это папка
;флаги используемые KolibriOS ;флаги используемые KolibriOS
FS_FT_HIDDEN = 2 FS_FT_HIDDEN = 2
FS_FT_DIR = 0x10 ;это папка FS_FT_DIR = 0x10 ;это папка
FS_FT_ASCII = 0 ;имя в ascii FS_FT_ASCII = 0 ;имя в ascii
FS_FT_UNICODE = 1 ;имя в unicode FS_FT_UNICODE = 1 ;имя в unicode
EXT2_FEATURE_INCOMPAT_FILETYPE = 0x0002 ;тип файла должен указываться в директории EXT2_FEATURE_INCOMPAT_FILETYPE = 0x0002 ;тип файла должен указываться в директории
EXT4_FEATURE_INCOMPAT_EXTENTS = 0x0040 ;экстенты EXT4_FEATURE_INCOMPAT_EXTENTS = 0x0040 ;экстенты
@ -269,7 +269,7 @@ ext2_setup:
;================================================================== ;==================================================================
;read ext2 block form FS to memory ;read ext2 block form FS to memory
;in: eax = i_block (address of block in ext2 terms) ;in: eax = i_block (address of block in ext2 terms)
; ebx = pointer to return memory ; ebx = pointer to return memory
;out: eax - error code (0 = no_error) ;out: eax - error code (0 = no_error)
ext2_get_block: ext2_get_block:
push ebx ecx push ebx ecx
@ -370,7 +370,7 @@ ext4_block_recursive_search:
;=================================================================== ;===================================================================
;получает адрес ext2 блока из inode с определнным номером ;получает адрес ext2 блока из inode с определнным номером
;in: ecx = номер блока в inode (0..) ;in: ecx = номер блока в inode (0..)
; ebp = адрес inode ; ebp = адрес inode
;out: ecx = адрес очередного блока ;out: ecx = адрес очередного блока
; eax - error code ; eax - error code
ext2_get_inode_block: ext2_get_inode_block:
@ -430,7 +430,7 @@ ext2_get_inode_block:
jnz .fail jnz .fail
mov eax, ecx mov eax, ecx
@@: @@:
xor edx, edx xor edx, edx
div [ext2_data.count_pointer_in_block] div [ext2_data.count_pointer_in_block]
@ -450,7 +450,7 @@ ext2_get_inode_block:
mov ebx, [ext2_data.ext2_temp_block] mov ebx, [ext2_data.ext2_temp_block]
call ext2_get_block call ext2_get_block
test eax, eax test eax, eax
jz @F ;если не было ошибки jnz @F ;если не было ошибки
mov ecx, [ebx + ecx*4] ;заносим результат mov ecx, [ebx + ecx*4] ;заносим результат
@@: @@:
@ -464,8 +464,8 @@ ext2_get_inode_block:
;=================================================================== ;===================================================================
;get content inode by num ;get content inode by num
;in: eax = inode_num ;in: eax = inode_num
; ebx = address of inode content ; ebx = address of inode content
;out: eax - error code ;out: eax - error code
ext2_get_inode: ext2_get_inode:
pushad pushad
@ -496,7 +496,7 @@ ext2_get_inode:
mov ecx, [ext2_data.log_block_size] mov ecx, [ext2_data.log_block_size]
shl eax, cl shl eax, cl
add eax, [PARTITION_START] ; а старт раздела - в терминах hdd (512) add eax, [PARTITION_START] ; а старт раздела - в терминах hdd (512)
;eax - указывает на таблицу inode-ов на hdd ;eax - указывает на таблицу inode-ов на hdd
mov esi, eax ;сохраним его пока в esi mov esi, eax ;сохраним его пока в esi
@ -565,7 +565,7 @@ ext2_HdReadFolder:
rep movsd rep movsd
pop ecx pop ecx
@@: @@:
cmp [ebp + EXT2_INODE_STRUC.i_blocks], 0 ;папка пуста cmp [ebp + EXT2_INODE_STRUC.i_size], 0 ;папка пуста
je .error_empty_dir je .error_empty_dir
push edx ;адрес результата [edi + 28] push edx ;адрес результата [edi + 28]
@ -580,7 +580,7 @@ ext2_HdReadFolder:
mov edi, edx mov edi, edx
mov ecx, 32/4 mov ecx, 32/4
rep stosd ; fill header zero rep stosd ; fill header zero
mov edi, esp ; edi - указатель на локальные переменные mov edi, esp ; edi - указатель на локальные переменные
add edx, 32 ; edx = current mem for return add edx, 32 ; edx = current mem for return
@ -608,7 +608,7 @@ ext2_HdReadFolder:
jz @F jz @F
inc dword [edi + 4] ; EXT2_files_in_folder inc dword [edi + 4] ; EXT2_files_in_folder
dec ecx dec ecx
@@: @@:
movzx ebx, [esi + EXT2_DIR_STRUC.rec_len] movzx ebx, [esi + EXT2_DIR_STRUC.rec_len]
cmp ebx, 12 ; минимальная длина записи cmp ebx, 12 ; минимальная длина записи
@ -616,14 +616,14 @@ ext2_HdReadFolder:
test ebx, 0x3 ; длина записи должна делиться на 4 test ebx, 0x3 ; длина записи должна делиться на 4
jnz .error_bad_len jnz .error_bad_len
sub [ebp + EXT2_INODE_STRUC.i_size], ebx ;вычитаем напрямую из структуры inode
add esi, ebx ; к следующей записи add esi, ebx ; к следующей записи
cmp esi, [edi + 24] ; сравниваем с концом блока cmp esi, [edi + 24] ; сравниваем с концом блока
jb .find_wanted_start jb .find_wanted_start
push .find_wanted_start push .find_wanted_start
.end_block: ;вылетели из цикла .end_block: ;вылетели из цикла
mov ebx, [ext2_data.count_block_in_block] cmp [ebp + EXT2_INODE_STRUC.i_size], 0
sub [ebp + EXT2_INODE_STRUC.i_blocks], ebx ;вычитаем напрямую из структуры inode
jle .end_dir jle .end_dir
inc dword [edi] ;получаем новый блок inc dword [edi] ;получаем новый блок
@ -643,7 +643,7 @@ ext2_HdReadFolder:
mov esi, ebx mov esi, ebx
add ebx, [ext2_data.block_size] add ebx, [ext2_data.block_size]
mov [edi + 24], ebx ;запомним конец блока mov [edi + 24], ebx ;запомним конец блока
ret ; опять в цикл ret ; опять в цикл
.wanted_end: .wanted_end:
loop .find_wanted_cycle ; ecx 0 => -1 нужно посчитать сколько файлов loop .find_wanted_cycle ; ecx 0 => -1 нужно посчитать сколько файлов
@ -651,7 +651,7 @@ ext2_HdReadFolder:
;дошли до первого "нужного" файла ;дошли до первого "нужного" файла
.find_wanted_end: .find_wanted_end:
mov ecx, [edi + 20] mov ecx, [edi + 20]
.wanted_start: ; ищем first_wanted+count .wanted_start: ; ищем first_wanted+count
jecxz .wanted_end jecxz .wanted_end
cmp [esi + EXT2_DIR_STRUC.inode], 0 ; if (inode = 0) => not used cmp [esi + EXT2_DIR_STRUC.inode], 0 ; if (inode = 0) => not used
jz .empty_rec jz .empty_rec
@ -674,7 +674,7 @@ ext2_HdReadFolder:
lea edi, [edx + 8] lea edi, [edx + 8]
mov eax, [ebx + EXT2_INODE_STRUC.i_ctime] ; переведем время в ntfs формат mov eax, [ebx + EXT2_INODE_STRUC.i_ctime] ; переведем время в ntfs формат
xor edx, edx xor edx, edx
add eax, 3054539008 ;(369 * 365 + 89) * 24 * 3600 add eax, 3054539008 ;(369 * 365 + 89) * 24 * 3600
adc edx, 2 adc edx, 2
@ -693,18 +693,18 @@ ext2_HdReadFolder:
call ntfs_datetime_to_bdfe.sec call ntfs_datetime_to_bdfe.sec
pop edx ; пока достаем только буфер pop edx ; пока достаем только буфер
test [ebx + EXT2_INODE_STRUC.i_mode], EXT2_S_IFDIR ; для папки размер test [ebx + EXT2_INODE_STRUC.i_mode], EXT2_S_IFDIR ; для папки размер
jnz @F ; не возвращаем jnz @F ; не возвращаем
mov eax, [ebx + EXT2_INODE_STRUC.i_size] ;low size mov eax, [ebx + EXT2_INODE_STRUC.i_size] ;low size
stosd stosd
mov eax, [ebx + EXT2_INODE_STRUC.i_dir_acl] ;high size mov eax, [ebx + EXT2_INODE_STRUC.i_dir_acl] ;high size
stosd stosd
xor dword [edx], FS_FT_DIR ;помечаем, что это файл(2 раза xor) xor dword [edx], FS_FT_DIR ;помечаем, что это файл(2 раза xor)
@@: @@:
xor dword [edx], FS_FT_DIR ;помечаем, что это файл xor dword [edx], FS_FT_DIR ;помечаем, что это файл
;теперь скопируем имя, сконвертировав из UTF-8 в CP866 ;теперь скопируем имя, сконвертировав из UTF-8 в CP866
push ecx ;edi и esi уже сохранены в стеке push ecx ;edi и esi уже сохранены в стеке
movzx ecx, [esi + EXT2_DIR_STRUC.name_len] movzx ecx, [esi + EXT2_DIR_STRUC.name_len]
lea edi, [edx + 40] lea edi, [edx + 40]
@ -716,17 +716,18 @@ ext2_HdReadFolder:
cmp byte [edx + 40], '.' ; в linux файл, начинающийся с точки - скрытый cmp byte [edx + 40], '.' ; в linux файл, начинающийся с точки - скрытый
jne @F jne @F
or dword [edx], FS_FT_HIDDEN or dword [edx], FS_FT_HIDDEN
@@: @@:
add edx, 40 + 264 ; go to next record add edx, 40 + 264 ; go to next record
dec ecx ; если запись пустая ecx не надо уменьшать dec ecx ; если запись пустая ecx не надо уменьшать
.empty_rec: .empty_rec:
movzx ebx, [esi + EXT2_DIR_STRUC.rec_len] movzx ebx, [esi + EXT2_DIR_STRUC.rec_len]
cmp ebx, 12 ; минимальная длина записи cmp ebx, 12 ; минимальная длина записи
jb .error_bad_len jb .error_bad_len
test ebx, 0x3 ; длина записи должна делиться на 4 test ebx, 0x3 ; длина записи должна делиться на 4
jnz .error_bad_len jnz .error_bad_len
sub [ebp + EXT2_INODE_STRUC.i_size], ebx ;вычитаем напрямую из структуры inode
add esi, ebx add esi, ebx
cmp esi, [edi + 24] ;дошли ли до конца блока? cmp esi, [edi + 24] ;дошли ли до конца блока?
jb .wanted_start jb .wanted_start
@ -895,15 +896,13 @@ ext2_HdRead:
jae .size_great_great jae .size_great_great
.size_great_less: .size_great_less:
push 1 push 1 ;читаем по границе размера
; or [EXT2_files_in_folder], 1 ;читаем по границе размера
mov ecx, [ebp + EXT2_INODE_STRUC.i_size] mov ecx, [ebp + EXT2_INODE_STRUC.i_size]
sub ecx, [esi] ;(размер - старт) = сколько читать sub ecx, [esi] ;(размер - старт) = сколько читать
jmp @F jmp @F
.size_great_great: .size_great_great:
push 0 push 0 ;читаем столько сколько запросили
; and [EXT2_files_in_folder], 0 ;читаем столько сколько запросили
@@: @@:
;здесь мы точно знаем сколько байт читать - ecx ;здесь мы точно знаем сколько байт читать - ecx
@ -919,8 +918,8 @@ ext2_HdRead:
mov eax, [esi] mov eax, [esi]
div [ext2_data.block_size] div [ext2_data.block_size]
push eax ;номер блока запоминаем push eax ;счетчик блоков ложим в стек
push ecx push ecx
mov ecx, eax mov ecx, eax
call ext2_get_inode_block call ext2_get_inode_block
@ -949,12 +948,12 @@ ext2_HdRead:
.zero_start: .zero_start:
mov eax, ecx mov eax, ecx
push 0 ;счетчик блоков push 0 ;счетчик блоков ложим в стек
;теперь в eax кол-во оставшихся байт для чтения ;теперь в eax кол-во оставшихся байт для чтения
.calc_blocks_count: .calc_blocks_count:
mov ebx, edi ;чтение блока прям в ->ebx mov ebx, edi ;чтение блока прям в ->ebx
xor edx, edx xor edx, edx
div [ext2_data.block_size] ;кол-во байт в последнем блоке (остаток) в edx div [ext2_data.block_size] ;кол-во байт в последнем блоке (остаток) в edx
mov edi, eax ;кол-во целых блоков в edi mov edi, eax ;кол-во целых блоков в edi
@@: @@:
test edi, edi test edi, edi
@ -982,7 +981,7 @@ ext2_HdRead:
inc ecx inc ecx
call ext2_get_inode_block call ext2_get_inode_block
test eax, eax test eax, eax
jz .error_at_finish_block jnz .error_at_finish_block
mov edi, ebx mov edi, ebx
mov eax, ecx mov eax, ecx
@ -991,12 +990,16 @@ ext2_HdRead:
test eax, eax test eax, eax
jnz .error_at_finish_block jnz .error_at_finish_block
mov ecx, edx mov ecx, edx
mov esi, ebx mov esi, ebx
rep movsb ;кусок last блока rep movsb ;кусок last блока
jmp @F
.end_read: .end_read:
pop ebx pop ecx ;счетчик блоков, который хранился в стеке
pop eax @@:
pop ebx ;количество считанных байт
pop eax ; 1 или 0 - достигли ли конца файла
test eax, eax test eax, eax
jz @F jz @F
@ -1009,7 +1012,6 @@ ext2_HdRead:
.only_one_block: .only_one_block:
mov esi, ebx mov esi, ebx
rep movsb ;кусок last блока rep movsb ;кусок last блока
pop eax
jmp .end_read jmp .end_read
.error_at_first_block: .error_at_first_block:
@ -1094,23 +1096,24 @@ ext2_find_lfn:
push [ebp + EXT2_INODE_STRUC.i_blocks] push [ebp + EXT2_INODE_STRUC.i_blocks]
xor ecx, ecx xor ecx, ecx
.folder_block_cycle: .folder_block_cycle:
push ecx
call ext2_get_inode_block call ext2_get_inode_block
test eax, eax test eax, eax
jnz .error_get_inode_block jnz .error_get_inode_block
mov eax, ecx mov eax, ecx
mov ebx, [ext2_data.ext2_save_block] ;ebx = cur dir record mov ebx, [ext2_data.ext2_save_block] ;ebx = cur dir record
call ext2_get_block call ext2_get_block
test eax, eax test eax, eax
jnz .error_get_block jnz .error_get_block
push esi push esi
call ext2_test_block_by_name call ext2_test_block_by_name
pop edi pop edi ecx
cmp edi, esi ;нашли имя? cmp edi, esi ;нашли имя?
je .next_folder_block ;не нашли -> к след. блоку je .next_folder_block ;не нашли -> к след. блоку
cmp byte [esi], 0 ;дошли до "конца" пути -> возваращаемся cmp byte [esi], 0 ;дошли до "конца" пути -> возваращаемся
jz .get_inode_ret jz .get_inode_ret
@ -1132,11 +1135,11 @@ ext2_find_lfn:
sub eax, [ext2_data.count_block_in_block] sub eax, [ext2_data.count_block_in_block]
jle .not_found jle .not_found
push eax
inc ecx inc ecx
jmp .folder_block_cycle jmp .folder_block_cycle
.not_found: .not_found:
pop ebx
mov eax, ERROR_FILE_NOT_FOUND mov eax, ERROR_FILE_NOT_FOUND
ret ret
@ -1152,6 +1155,7 @@ ext2_find_lfn:
.error_get_inode_block: .error_get_inode_block:
.error_get_block: .error_get_block:
pop ecx
.error_get_inode: .error_get_inode:
pop ebx pop ebx
.error_empty_root: .error_empty_root:

View File

@ -2257,15 +2257,17 @@ fs_FloppyDelete:
popa popa
; delete FAT chain ; delete FAT chain
pop eax pop eax
test eax, eax
jz .done
@@: @@:
cmp eax, 2
jb .done
cmp eax, 0xFF8
jae .done
lea eax, [FLOPPY_FAT + eax*2] lea eax, [FLOPPY_FAT + eax*2]
push dword [eax] push dword [eax]
and word [eax], 0 and word [eax], 0
pop eax pop eax
and eax, 0xFFF and eax, 0xFFF
jnz @b jmp @b
.done: .done:
call save_flp_fat call save_flp_fat
pop edi 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 iglobal
if lang eq sp
include 'fs/fs-sp.inc'
else
dir0: dir0:
db 'HARDDISK ' db 'HARDDISK '
db 'RAMDISK ' db 'RAMDISK '
@ -33,6 +37,7 @@ dir1:
db 'THIRD ' db 'THIRD '
db 'FOURTH ' db 'FOURTH '
db 0 db 0
end if
not_select_IDE db 0 not_select_IDE db 0

View File

@ -103,6 +103,17 @@ fs_additional_handlers:
dd 0 dd 0
endg 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: file_system_lfn:
; in: ebx->fileinfo block ; in: ebx->fileinfo block
; operation codes: ; 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) ; esi - event data (=0 => skip)
;scratched: ebx,ecx,esi,edi ;scratched: ebx,ecx,esi,edi
call NotDummyTest ; not returned for fail !!! call NotDummyTest ; not returned for fail !!!
mov [check_idle_semaphore], 5
or esi, esi or esi, esi
jz @f jz @f
lea edi, [ebx+EVENT.code] lea edi, [ebx+EVENT.code]
@ -307,6 +308,23 @@ wait_event: ;; EXPORT use
jmp wait_finish jmp wait_finish
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 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 get_event_ex: ;; f68:14
;info: ;info:
; Îæèäàíèå ëþáîãî ñîáûòèÿ â î÷åðåäè EventList òåêóùåãî ñëîòà ; Îæèäàíèå ëþáîãî ñîáûòèÿ â î÷åðåäè EventList òåêóùåãî ñëîòà
@ -441,7 +459,7 @@ align 4
;-------------------------------------- ;--------------------------------------
align 4 align 4
.result: .result:
setae byte[esp+32] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32]==72 setae byte[esp+32+4] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32+4]==72
;-------------------------------------- ;--------------------------------------
align 4 align 4
.retf: .retf:
@ -467,9 +485,11 @@ sys_waitforevent: ;; f10
;-------------------------------------- ;--------------------------------------
align 4 align 4
sys_wait_event_timeout: ;; f23 sys_wait_event_timeout: ;; f23
call unprotect_from_terminate
mov edx, get_event_for_app; wait_test mov edx, get_event_for_app; wait_test
call Wait_events_ex ; ebx - timeout call Wait_events_ex ; ebx - timeout
mov [esp+32], eax mov [esp+32], eax
call protect_from_terminate
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
@ -593,4 +613,4 @@ align 4
jb @b jb @b
jmp .loop jmp .loop
;end. ;end.
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------

View File

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

View File

@ -381,6 +381,16 @@ align 4
push esi edx ecx ebx push esi edx ecx ebx
mov eax, esp mov eax, esp
mov bl, [edi + WDATA.fl_wstate] 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 call window._.set_window_box
add esp, sizeof.BOX add esp, sizeof.BOX

View File

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

View File

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

View File

@ -137,7 +137,7 @@ struct APPDATA
ipc_size dd ? ipc_size dd ?
event_mask dd ? event_mask dd ?
debugger_slot dd ? debugger_slot dd ?
dd ? terminate_protection dd ?
keyboard_mode db ? keyboard_mode db ?
rb 3 rb 3
dir_table dd ? 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,$