ATA operation with sector above 128G is error, not operation modulo 128G

git-svn-id: svn://kolibrios.org@1709 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2010-11-24 13:44:30 +00:00
parent c910c0615f
commit e4c65f154e

View File

@ -49,6 +49,12 @@ hd_read:
; Read through BIOS? ; Read through BIOS?
cmp [hdpos], 0x80 cmp [hdpos], 0x80
jae .bios jae .bios
; hd_read_{dma,pio} use old ATA with 28 bit for sector number
cmp eax, 0x10000000
jb @f
inc [hd_error]
jmp return_01
@@:
; DMA read is permitted if [allow_dma_access]=1 or 2 ; DMA read is permitted if [allow_dma_access]=1 or 2
cmp [allow_dma_access], 2 cmp [allow_dma_access], 2
ja .nodma ja .nodma
@ -235,6 +241,8 @@ hd_write:
align 4 align 4
cache_write_pio: cache_write_pio:
cmp dword[esi],0x10000000
jae .bad
; call disable_ide_int ; call disable_ide_int
call wait_for_hd_idle call wait_for_hd_idle
@ -295,6 +303,9 @@ cache_write_pio:
pop esi ecx pop esi ecx
ret ret
.bad:
inc [hd_error]
ret
save_hd_wait_timeout: save_hd_wait_timeout:
@ -686,6 +697,9 @@ write_cache_sector:
write_cache_chain: write_cache_chain:
cmp [hdpos], 0x80 cmp [hdpos], 0x80
jae bd_write_cache_chain jae bd_write_cache_chain
mov eax,[cache_chain_ptr]
cmp dword[eax],0x10000000
jae .bad
push esi push esi
mov eax, IDE_descriptor_table mov eax, IDE_descriptor_table
mov edx,eax mov edx,eax
@ -779,6 +793,9 @@ write_cache_chain:
jnz hd_write_error_dma jnz hd_write_error_dma
pop esi pop esi
ret ret
.bad:
inc [hd_error]
ret
uglobal uglobal
IDEContrRegsBaseAddr dw ? IDEContrRegsBaseAddr dw ?