Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1409 → Rev 1410

/kernel/trunk/detect/sear_par.inc
23,11 → 23,16
mov [known_part],1
search_partitions_ide0_1:
call set_PARTITION_variables
cmp [problem_partition],0
jne search_partitions_ide1
test [problem_partition],2
jnz search_partitions_ide1 ; not found part
test [problem_partition],1
jnz @F ; not found known_part
;cmp [problem_partition],0
;jne search_partitions_ide1
inc byte [DRIVE_DATA+2]
call partition_data_transfer
add [transfer_adress],100
@@:
inc [known_part]
jmp search_partitions_ide0_1
 
40,11 → 45,16
mov [known_part],1
search_partitions_ide1_1:
call set_PARTITION_variables
cmp [problem_partition],0
jne search_partitions_ide2
test [problem_partition],2
jnz search_partitions_ide2
test [problem_partition],1
jnz @F
;cmp [problem_partition],0
;jne search_partitions_ide2
inc byte [DRIVE_DATA+3]
call partition_data_transfer
add [transfer_adress],100
@@:
inc [known_part]
jmp search_partitions_ide1_1
 
57,11 → 67,16
mov [known_part],1
search_partitions_ide2_1:
call set_PARTITION_variables
cmp [problem_partition],0
jne search_partitions_ide3
test [problem_partition],2
jnz search_partitions_ide3
test [problem_partition],1
jnz @F
;cmp [problem_partition],0
;jne search_partitions_ide3
inc byte [DRIVE_DATA+4]
call partition_data_transfer
add [transfer_adress],100
@@:
inc [known_part]
jmp search_partitions_ide2_1
 
74,11 → 89,16
mov [known_part],1
search_partitions_ide3_1:
call set_PARTITION_variables
cmp [problem_partition],0
jne end_search_partitions_ide
test [problem_partition],2
jnz end_search_partitions_ide
test [problem_partition],1
jnz @F
;cmp [problem_partition],0
;jne end_search_partitions_ide
inc byte [DRIVE_DATA+5]
call partition_data_transfer
add [transfer_adress],100
@@:
inc [known_part]
jmp search_partitions_ide3_1
 
94,12 → 114,17
mov [known_part], 1
search_partitions_bd:
call set_PARTITION_variables
cmp [problem_partition], 0
jne end_search_partitions_bd
test [problem_partition],2
jnz end_search_partitions_bd
test [problem_partition],1
jnz @F
;cmp [problem_partition], 0
;jne end_search_partitions_bd
mov eax, [hdpos]
inc [BiosDiskPartitions+(eax-80h)*4]
call partition_data_transfer
add [transfer_adress], 100
@@:
inc [known_part]
jmp search_partitions_bd
end_search_partitions_bd:
130,24 → 155,3
 
end_search_partitions:
 
;PARTITION_START dd 0x3f
;PARTITION_END dd 0
;SECTORS_PER_FAT dd 0x1f3a
;NUMBER_OF_FATS dd 0x2
;SECTORS_PER_CLUSTER dd 0x8
;BYTES_PER_SECTOR dd 0x200 ; Note: if BPS <> 512 need lots of changes
;ROOT_CLUSTER dd 2 ; first rootdir cluster
;FAT_START dd 0 ; start of fat table
;ROOT_START dd 0 ; start of rootdir (only fat16)
;ROOT_SECTORS dd 0 ; count of rootdir sectors (only fat16)
;DATA_START dd 0 ; start of data area (=first cluster 2)
;LAST_CLUSTER dd 0 ; last availabe cluster
;ADR_FSINFO dd 0 ; used only by fat32
;
;fatRESERVED dd 0x0FFFFFF6
;fatBAD dd 0x0FFFFFF7
;fatEND dd 0x0FFFFFF8
;fatMASK dd 0x0FFFFFFF
;
;fat_type db 0 ; 0=none, 16=fat16, 32=fat32
 
/kernel/trunk/fs/ext2.inc
41,6 → 41,8
FS_FT_ASCII = 0 ;имя в ascii
FS_FT_UNICODE = 1 ;имя в unicode
 
EXT2_FEATURE_INCOMPAT_FILETYPE = 0x0002
 
uglobal
EXT2_files_in_folder dd ? ;всего файлов в папке
EXT2_read_in_folder dd ? ;сколько файлов "считали"
80,12 → 82,13
 
 
ext2_test_superblock:
cmp [fs_type], 0x83
jne .no
 
mov eax, [PARTITION_START]
add eax, 2 ;superblock start at 1024b
call hd_read
 
cmp [fs_type], 0x83
jne .no
cmp dword [ebx+24], 3 ;s_block_size 0,1,2,3
ja .no
cmp word [ebx+56], 0xEF53 ;s_magic
92,6 → 95,11
jne .no
cmp word [ebx+58], 1 ;s_state (EXT_VALID_FS=1)
jne .no
mov eax, [ebx+96]
test eax, EXT2_FEATURE_INCOMPAT_FILETYPE
jz .no
test eax, not EXT2_FEATURE_INCOMPAT_FILETYPE
jnz .no
 
; OK, this is correct EXT2 superblock
clc
155,11 → 163,8
mov ebx, eax
mov eax, EXT2_ROOT_INO
call ext2_get_inode ; read root inode
jmp return_from_part_set
 
popad
call free_hd_channel
and [hd1_status], 0
ret
;==================================================================
;in: eax = i_block
; ebx = pointer to return memory
270,21 → 275,22
add eax, [PARTITION_START] ; а старт раздела - в терминах hdd (512)
 
;eax - указывает на таблицу inode-ов на hdd
mov ecx, eax ;сохраним его пока в ecx
mov esi, eax ;сохраним его пока в esi
 
; прибавим локальный адрес inode-а
pop eax ; index
mul [ext2_data.inode_size] ; (index * inode_size)
mov ecx, [ext2_data.inode_size]
mul ecx ; (index * inode_size)
mov ebp, 512
div ebp ;поделим на размер блока
 
add eax, ecx ;нашли адрес блока для чтения
add eax, esi ;нашли адрес блока для чтения
mov ebx, [ext2_data.ext2_temp_block]
call hd_read
 
mov esi, edx ;добавим "остаток"
add esi, ebx ;к адресу
mov ecx, [ext2_data.inode_size]
; mov ecx, [ext2_data.inode_size]
rep movsb ;копируем inode
popad
ret
/kernel/trunk/fs/part_set.inc
9,6 → 9,7
 
 
;*************************************************************
;* 13.02.2010 Find all partition and check supported FS
;* 12.07.2007 Check all 4 entry of MBR and EMBR
;* 29.04.2006 Elimination of hangup after the
;* expiration hd_wait_timeout - Mario79
26,7 → 27,7
;******************************************************
PARTITION_START dd 0x3f
PARTITION_END dd 0
fs_type db 0 ; 0=none, 1=NTFS, 2=EXT2/3, 16=FAT16, 32=FAT32
fs_type db 0 ; 1=NTFS, 2=EXT2/3, 16=FAT16, 32=FAT32
align 4
 
fs_dependent_data_start:
150,7 → 151,7
 
set_PARTITION_variables:
set_FAT32_variables: ;deprecated
mov [problem_partition],0
and [problem_partition], 0
call reserve_hd1
call reserve_hd_channel
 
160,7 → 161,7
je problem_hd
 
xor ecx,ecx ; partition count
or edx,-1 ; flag for partition
;or edx,-1 ; flag for partition
xor eax,eax ; address MBR
xor ebp,ebp ; extended partition start
 
178,6 → 179,7
 
cmp word [ebx+0x1fe],0xaa55 ; is it valid boot sector?
jnz end_partition_chain
push eax ; push only one time
cmp dword [ebx+0x1be+0xc],0 ; skip over empty partition
jnz test_primary_partition_0
cmp dword [ebx+0x1be+0xc+16],0
186,13 → 188,12
jnz test_primary_partition_2
cmp dword [ebx+0x1be+0xc+16+16+16],0
jnz test_primary_partition_3
pop eax
jmp end_partition_chain
 
test_primary_partition_0:
push eax
mov al,[ebx+0x1be+4] ; get primary partition type
call scan_partition_types
pop eax
jnz test_primary_partition_1 ; no. skip over
 
inc ecx
199,22 → 200,24
cmp ecx,[known_part] ; is it wanted partition?
jnz test_primary_partition_1 ; no
 
mov edx, eax ; start sector
add edx, [ebx+0x1be+8] ; add relative start
push edx
add edx, [ebx+0x1be+12] ; add length
dec edx ; PARTITION_END is inclusive
mov [PARTITION_END], edx ; note that this can be changed
pop eax
;mov edx, eax ; start sector
add eax, [ebx+0x1be+8] ; add relative start
;mov [PARTITON_START],edx
;push edx
mov edx, [ebx+0x1be+12] ; length
;add edx, eax ; add length
;dec edx ; PARTITION_END is inclusive
;mov [PARTITION_END], edx ; note that this can be changed
; when file system data will be available
mov dl, [ebx+0x1be+4]
mov [fs_type], dl ; save for FS recognizer (separate FAT vs NTFS)
pop edx
mov cl, [ebx+0x1be+4] ; fs_type
;mov [fs_type], dl ; save for FS recognizer (separate FAT vs NTFS)
;pop edx
jmp hd_and_partition_ok
 
test_primary_partition_1:
push eax
mov al,[ebx+0x1be+4+16] ; get primary partition type
call scan_partition_types
pop eax
jnz test_primary_partition_2 ; no. skip over
 
inc ecx
221,21 → 224,25
cmp ecx,[known_part] ; is it wanted partition?
jnz test_primary_partition_2 ; no
 
mov edx, eax
add edx, [ebx+0x1be+8+16]
push edx
add edx, [ebx+0x1be+12+16]
dec edx
mov [PARTITION_END], edx
mov dl, [ebx+0x1be+4+16]
mov [fs_type], dl
pop edx
pop eax
add eax, [ebx+0x1be+8+16]
mov edx, [ebx+0x1be+12+16]
mov cl, [ebx+0x1be+4+16]
jmp hd_and_partition_ok
 
;mov edx, eax
;add edx, [ebx+0x1be+8+16]
;push edx
;add edx, [ebx+0x1be+12+16]
;dec edx
;mov [PARTITION_END], edx
;mov al, [ebx+0x1be+4+16]
;mov [fs_type], dl
;pop edx
 
test_primary_partition_2:
push eax
mov al,[ebx+0x1be+4+16+16] ; get primary partition type
call scan_partition_types
pop eax
jnz test_primary_partition_3 ; no. skip over
 
inc ecx
242,21 → 249,24
cmp ecx,[known_part] ; is it wanted partition?
jnz test_primary_partition_3 ; no
 
mov edx, eax
add edx, [ebx+0x1be+8+16+16]
push edx
add edx, [ebx+0x1be+12+16+16]
dec edx
mov [PARTITION_END], edx
mov dl, [ebx+0x1be+4+16+16]
mov [fs_type], dl
pop edx
pop eax
add eax, [ebx+0x1be+8+16+16]
mov edx, [ebx+0x1be+12+16+16]
mov cl, [ebx+0x1be+4+16+16]
jmp hd_and_partition_ok
;mov edx, eax
;add edx, [ebx+0x1be+8+16+16]
;push edx
;add edx, [ebx+0x1be+12+16+16]
;dec edx
;mov [PARTITION_END], edx
;mov al, [ebx+0x1be+4+16+16]
;mov [fs_type], dl
;pop edx
 
test_primary_partition_3:
push eax
mov al,[ebx+0x1be+4+16+16+16] ; get primary partition type
call scan_partition_types
pop eax
jnz test_ext_partition_0 ; no. skip over
 
inc ecx
263,21 → 273,26
cmp ecx,[known_part] ; is it wanted partition?
jnz test_ext_partition_0 ; no
 
mov edx, eax
add edx, [ebx+0x1be+8+16+16+16]
push edx
add edx, [ebx+0x1be+12+16+16+16]
dec edx
mov [PARTITION_END], edx
mov dl, [ebx+0x1be+4+16+16+16]
mov [fs_type], dl
pop edx
pop eax
add eax, [ebx+0x1be+8+16+16+16]
mov edx, [ebx+0x1be+12+16+16+16]
mov cl, [ebx+0x1be+4+16+16+16]
jmp hd_and_partition_ok
 
;mov edx, eax
;add edx, [ebx+0x1be+8+16+16+16]
;push edx
;add edx, [ebx+0x1be+12+16+16+16]
;dec edx
;mov [PARTITION_END], edx
;mov al, [ebx+0x1be+4+16+16+16]
;mov [fs_type], dl
;pop edx
 
test_ext_partition_0:
push eax
pop eax ; ¯à®áâ® ¢ëª¨¤ë¢ ¥¬ ¨§ á⥪ 
mov al,[ebx+0x1be+4] ; get extended partition type
call scan_extended_types
pop eax
jnz test_ext_partition_1
 
mov eax,[ebx+0x1be+8] ; add relative start
285,10 → 300,8
jnz new_mbr ; yes. read it
 
test_ext_partition_1:
push eax
mov al,[ebx+0x1be+4+16] ; get extended partition type
call scan_extended_types
pop eax
jnz test_ext_partition_2
 
mov eax,[ebx+0x1be+8+16] ; add relative start
296,10 → 309,8
jnz new_mbr ; yes. read it
 
test_ext_partition_2:
push eax
mov al,[ebx+0x1be+4+16+16] ; get extended partition type
call scan_extended_types
pop eax
jnz test_ext_partition_3
 
mov eax,[ebx+0x1be+8+16+16] ; add relative start
307,10 → 318,8
jnz new_mbr ; yes. read it
 
test_ext_partition_3:
push eax
mov al,[ebx+0x1be+4+16+16+16] ; get extended partition type
call scan_extended_types
pop eax
jnz end_partition_chain ; no. end chain
 
mov eax,[ebx+0x1be+8+16+16+16] ; get start of extended partition
318,12 → 327,16
jnz new_mbr ; yes. read it
 
end_partition_chain:
mov [partition_count],ecx
;mov [partition_count],ecx
 
cmp edx,-1 ; found wanted partition?
jnz hd_and_partition_ok ; yes. install it
jmp problem_partition_or_fat
;cmp edx,-1 ; found wanted partition?
;jnz hd_and_partition_ok ; yes. install it
;jmp problem_partition_or_fat
problem_hd:
or [problem_partition], 2
jmp return_from_part_set
 
 
scan_partition_types:
push ecx
mov edi,partition_types
343,25 → 356,32
ret
 
problem_fat_dec_count: ; bootsector is missing or another problem
dec [partition_count] ; remove it from partition_count
; dec [partition_count] ; remove it from partition_count
 
problem_partition_or_fat:
problem_hd:
or [problem_partition],1
 
return_from_part_set:
popad
 
mov [fs_type],0
;mov [fs_type],0
call free_hd_channel
mov [hd1_status],0 ; free
mov [problem_partition],1
ret
 
hd_and_partition_ok:
mov eax,edx
 
;eax = PARTITION_START edx=PARTITION_LENGTH cl=fs_type
mov [fs_type], cl
;mov eax,edx
mov [PARTITION_START],eax
mov edx, [PARTITION_END]
sub edx, eax
inc edx ; edx = length of partition
add edx, eax
dec edx
mov [PARTITION_END], edx
 
; mov edx, [PARTITION_END]
; sub edx, eax
; inc edx ; edx = length of partition § ç¥¬ ®­® ­ ¬??
 
; mov [hd_setup],1
mov ebx,buffer
call hd_read ; read boot sector of partition
506,3 → 526,4
call free_hd_channel
mov [hd1_status],0 ; free
ret