forked from KolibriOS/kolibrios
sync with trunk
git-svn-id: svn://kolibrios.org@1376 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -12,7 +12,7 @@ $Revision$
|
|||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>D (ATAPI)
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>D (ATAPI)
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79,<Lrz>
|
||||||
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
MaxRetr equ 10
|
MaxRetr equ 10
|
||||||
@@ -20,46 +20,7 @@ MaxRetr equ 10
|
|||||||
; (<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
; (<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
BSYWaitTime equ 1000 ;2
|
BSYWaitTime equ 1000 ;2
|
||||||
NoTickWaitTime equ 0xfffff
|
NoTickWaitTime equ 0xfffff
|
||||||
|
CDBlockSize equ 2048
|
||||||
;*************************************************
|
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
|
||||||
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
|
||||||
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
|
||||||
;* CDSectorAddress - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CDDataBuf. *
|
|
||||||
;*************************************************
|
|
||||||
ReadCD:
|
|
||||||
pusha
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
mov [CDBlockSize],2048 ;2352
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
call clear_packet_buffer
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Read CD
|
|
||||||
mov [PacketCommand],byte 0x28 ;0xBE
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
mov AX,word [CDSectorAddress+2]
|
|
||||||
xchg AL,AH
|
|
||||||
mov word [PacketCommand+2],AX
|
|
||||||
mov AX,word [CDSectorAddress]
|
|
||||||
xchg AL,AH
|
|
||||||
mov word [PacketCommand+4],AX
|
|
||||||
; mov eax,[CDSectorAddress]
|
|
||||||
; mov [PacketCommand+2],eax
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
mov [PacketCommand+8],byte 1
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
; mov [PacketCommand+9],byte 0xF8
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
call SendPacketDatCommand
|
|
||||||
popa
|
|
||||||
ret
|
|
||||||
|
|
||||||
;********************************************
|
;********************************************
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
@@ -73,8 +34,9 @@ ReadCDWRetr:
|
|||||||
mov eax,[CDSectorAddress]
|
mov eax,[CDSectorAddress]
|
||||||
mov ebx,[CDDataBuf_pointer]
|
mov ebx,[CDDataBuf_pointer]
|
||||||
call cd_calculate_cache
|
call cd_calculate_cache
|
||||||
|
xor edi,edi
|
||||||
add esi,8
|
add esi,8
|
||||||
mov edi,1
|
inc edi
|
||||||
.hdreadcache:
|
.hdreadcache:
|
||||||
; cmp dword [esi+4],0 ; empty
|
; cmp dword [esi+4],0 ; empty
|
||||||
; je .nohdcache
|
; je .nohdcache
|
||||||
@@ -128,9 +90,49 @@ ReadCDWRetr_1:
|
|||||||
mov ECX,MaxRetr
|
mov ECX,MaxRetr
|
||||||
@@NextRetr:
|
@@NextRetr:
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
call ReadCD
|
;*************************************************
|
||||||
cmp [DevErrorCode],0
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
je @@End_4
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||||
|
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||||
|
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||||
|
;* CDSectorAddress - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||||
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CDDataBuf. *
|
||||||
|
;*************************************************
|
||||||
|
;ReadCD:
|
||||||
|
push ecx
|
||||||
|
; pusha
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
; mov [CDBlockSize],2048 ;2352
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
call clear_packet_buffer
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Read CD
|
||||||
|
mov [PacketCommand],byte 0x28 ;0xBE
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
mov AX,word [CDSectorAddress+2]
|
||||||
|
xchg AL,AH
|
||||||
|
mov word [PacketCommand+2],AX
|
||||||
|
mov AX,word [CDSectorAddress]
|
||||||
|
xchg AL,AH
|
||||||
|
mov word [PacketCommand+4],AX
|
||||||
|
; mov eax,[CDSectorAddress]
|
||||||
|
; mov [PacketCommand+2],eax
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
mov [PacketCommand+8],byte 1
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
; mov [PacketCommand+9],byte 0xF8
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
call SendPacketDatCommand
|
||||||
|
pop ecx
|
||||||
|
; ret
|
||||||
|
|
||||||
|
; cmp [DevErrorCode],0
|
||||||
|
test eax,eax
|
||||||
|
jz @@End_4
|
||||||
|
|
||||||
or ecx,ecx ;{SPraid.simba} (for cd load)
|
or ecx,ecx ;{SPraid.simba} (for cd load)
|
||||||
jz @@End_4
|
jz @@End_4
|
||||||
@@ -141,8 +143,8 @@ ReadCDWRetr_1:
|
|||||||
mov eax,NoTickWaitTime
|
mov eax,NoTickWaitTime
|
||||||
.wait:
|
.wait:
|
||||||
dec eax
|
dec eax
|
||||||
cmp eax,0
|
; test eax,eax
|
||||||
je @@NextRetr
|
jz @@NextRetr
|
||||||
jmp .wait
|
jmp .wait
|
||||||
@@:
|
@@:
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 2,5 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 2,5 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -154,6 +156,7 @@ ReadCDWRetr_1:
|
|||||||
; ja @@Wait
|
; ja @@Wait
|
||||||
loop @@NextRetr
|
loop @@NextRetr
|
||||||
@@End_4:
|
@@End_4:
|
||||||
|
mov dword [DevErrorCode],eax
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -163,14 +166,15 @@ ReadCDWRetr_1:
|
|||||||
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
MaxCDWaitTime equ 1000 ;200 ;10 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
|
MaxCDWaitTime equ 1000 ;200 ;10 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
uglobal
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
PacketCommand: rb 12 ;DB 12 DUP (?)
|
PacketCommand: rb 12 ;DB 12 DUP (?)
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
;CDDataBuf DB 4096 DUP (0)
|
;CDDataBuf DB 4096 DUP (0)
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
CDBlockSize DW ?
|
;CDBlockSize DW ?
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
CDSectorAddress: DD ?
|
CDSectorAddress: DD ?
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -179,7 +183,7 @@ TickCounter_1 DD 0
|
|||||||
WURStartTime DD 0
|
WURStartTime DD 0
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
CDDataBuf_pointer dd 0
|
CDDataBuf_pointer dd 0
|
||||||
|
endg
|
||||||
;****************************************************
|
;****************************************************
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATAPI <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATAPI <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, *
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
@@ -190,24 +194,26 @@ CDDataBuf_pointer dd 0
|
|||||||
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||||
;* PacketCommand - 12-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
;* PacketCommand - 12-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||||
;* CDBlockSize - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
;* CDBlockSize - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||||
|
; return eax DevErrorCode
|
||||||
;****************************************************
|
;****************************************************
|
||||||
SendPacketDatCommand:
|
SendPacketDatCommand:
|
||||||
pushad
|
xor eax,eax
|
||||||
mov [DevErrorCode],0
|
; mov byte [DevErrorCode],al
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHS
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHS
|
||||||
mov [ATAAddressMode],0
|
mov byte [ATAAddressMode],al
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATA-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATA-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov [ATAFeatures],0
|
mov byte [ATAFeatures],al
|
||||||
mov [ATASectorCount],0
|
mov byte [ATASectorCount],al
|
||||||
mov [ATASectorNumber],0
|
mov byte [ATASectorNumber],al
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov AX,[CDBlockSize]
|
mov [ATAHead],al
|
||||||
mov [ATACylinder],AX
|
; mov AX,[CDBlockSize]
|
||||||
mov [ATAHead],0
|
mov [ATACylinder],CDBlockSize
|
||||||
mov [ATACommand],0A0h
|
mov [ATACommand],0A0h
|
||||||
call SendCommandToHDD_1
|
call SendCommandToHDD_1
|
||||||
cmp [DevErrorCode],0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
test eax,eax
|
||||||
jne @@End_8 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; cmp [DevErrorCode],0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
jnz @@End_8 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -218,8 +224,8 @@ SendPacketDatCommand:
|
|||||||
cmp [timer_ticks_enable],0
|
cmp [timer_ticks_enable],0
|
||||||
jne @f
|
jne @f
|
||||||
dec ecx
|
dec ecx
|
||||||
cmp ecx,0
|
; test ecx,ecx
|
||||||
je @@Err1_1
|
jz @@Err1_1
|
||||||
jmp .test
|
jmp .test
|
||||||
@@:
|
@@:
|
||||||
call change_task
|
call change_task
|
||||||
@@ -261,8 +267,8 @@ SendPacketDatCommand:
|
|||||||
cmp [timer_ticks_enable],0
|
cmp [timer_ticks_enable],0
|
||||||
jne @f
|
jne @f
|
||||||
dec ecx
|
dec ecx
|
||||||
cmp ecx,0
|
; test ecx,ecx
|
||||||
je @@Err1_1
|
jz @@Err1_1
|
||||||
jmp .test_1
|
jmp .test_1
|
||||||
@@:
|
@@:
|
||||||
call change_task
|
call change_task
|
||||||
@@ -286,7 +292,7 @@ SendPacketDatCommand:
|
|||||||
mov DX,[ATABasePortAddr] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1x0h
|
mov DX,[ATABasePortAddr] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1x0h
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
xor ecx,ecx
|
xor ecx,ecx
|
||||||
mov CX,[CDBlockSize]
|
mov CX,CDBlockSize
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> 16-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> 16-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
shr CX,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 2
|
shr CX,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 2
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -295,20 +301,28 @@ SendPacketDatCommand:
|
|||||||
rep insw
|
rep insw
|
||||||
sti
|
sti
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
jmp @@End_8
|
@@End_8:
|
||||||
|
xor eax,eax
|
||||||
|
ret
|
||||||
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@Err1_1:
|
@@Err1_1:
|
||||||
mov [DevErrorCode],1
|
xor eax,eax
|
||||||
jmp @@End_8
|
inc eax
|
||||||
@@Err6_temp:
|
|
||||||
mov [DevErrorCode],7
|
|
||||||
jmp @@End_8
|
|
||||||
@@Err6:
|
|
||||||
mov [DevErrorCode],6
|
|
||||||
@@End_8:
|
|
||||||
popad
|
|
||||||
ret
|
ret
|
||||||
|
; mov [DevErrorCode],1
|
||||||
|
; ret
|
||||||
|
@@Err6_temp:
|
||||||
|
mov eax,7
|
||||||
|
ret
|
||||||
|
; mov [DevErrorCode],7
|
||||||
|
; ret
|
||||||
|
@@Err6:
|
||||||
|
mov eax,6
|
||||||
|
ret
|
||||||
|
; mov [DevErrorCode],6
|
||||||
|
;@@End_8:
|
||||||
|
; ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -323,19 +337,21 @@ SendPacketDatCommand:
|
|||||||
;***********************************************
|
;***********************************************
|
||||||
SendPacketNoDatCommand:
|
SendPacketNoDatCommand:
|
||||||
pushad
|
pushad
|
||||||
mov [DevErrorCode],0
|
xor eax,eax
|
||||||
|
; mov byte [DevErrorCode],al
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHS
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHS
|
||||||
mov [ATAAddressMode],0
|
mov byte [ATAAddressMode],al
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATA-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATA-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov [ATAFeatures],0
|
mov byte [ATAFeatures],al
|
||||||
mov [ATASectorCount],0
|
mov byte [ATASectorCount],al
|
||||||
mov [ATASectorNumber],0
|
mov byte [ATASectorNumber],al
|
||||||
mov [ATACylinder],0
|
mov word [ATACylinder],ax
|
||||||
mov [ATAHead],0
|
mov byte [ATAHead],al
|
||||||
mov [ATACommand],0A0h
|
mov [ATACommand],0A0h
|
||||||
call SendCommandToHDD_1
|
call SendCommandToHDD_1
|
||||||
cmp [DevErrorCode],0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; cmp [DevErrorCode],0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
jne @@End_9 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
test eax,eax
|
||||||
|
jnz @@End_9 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov DX,[ATABasePortAddr]
|
mov DX,[ATABasePortAddr]
|
||||||
@@ -372,7 +388,7 @@ SendPacketNoDatCommand:
|
|||||||
out DX,AX
|
out DX,AX
|
||||||
; sti
|
; sti
|
||||||
cmp [ignore_CD_eject_wait],1
|
cmp [ignore_CD_eject_wait],1
|
||||||
je @@End_9
|
je @@clear_DEC
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov DX,[ATABasePortAddr]
|
mov DX,[ATABasePortAddr]
|
||||||
add DX,7 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD>7h
|
add DX,7 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD>7h
|
||||||
@@ -391,15 +407,19 @@ SendPacketNoDatCommand:
|
|||||||
jnz @@Err6_1
|
jnz @@Err6_1
|
||||||
test AL,40h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DRDY
|
test AL,40h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DRDY
|
||||||
jz @@WaitDevice1_1
|
jz @@WaitDevice1_1
|
||||||
jmp @@End_9
|
@@clear_DEC:
|
||||||
|
and [DevErrorCode],0
|
||||||
|
popad
|
||||||
|
ret
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@Err1_3:
|
@@Err1_3:
|
||||||
mov [DevErrorCode],1
|
xor eax,eax
|
||||||
|
inc eax
|
||||||
jmp @@End_9
|
jmp @@End_9
|
||||||
@@Err6_1:
|
@@Err6_1:
|
||||||
mov [DevErrorCode],6
|
mov eax,6
|
||||||
@@End_9:
|
@@End_9:
|
||||||
|
mov [DevErrorCode],eax
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -420,11 +440,11 @@ SendPacketNoDatCommand:
|
|||||||
;* <EFBFBD> ATABasePortAddr - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD; *
|
;* <EFBFBD> ATABasePortAddr - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD; *
|
||||||
;* <EFBFBD> DevErrorCode - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
;* <EFBFBD> DevErrorCode - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> DevErrorCode <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> DevErrorCode <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> eax *
|
||||||
;****************************************************
|
;****************************************************
|
||||||
SendCommandToHDD_1:
|
SendCommandToHDD_1:
|
||||||
pushad
|
; pushad
|
||||||
mov [DevErrorCode],0
|
; mov [DevErrorCode],0 not need
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
cmp [ATAAddressMode],1
|
cmp [ATAAddressMode],1
|
||||||
ja @@Err2_4
|
ja @@Err2_4
|
||||||
@@ -459,8 +479,8 @@ SendCommandToHDD_1:
|
|||||||
cmp [timer_ticks_enable],0
|
cmp [timer_ticks_enable],0
|
||||||
jne @f
|
jne @f
|
||||||
dec ecx
|
dec ecx
|
||||||
cmp ecx,0
|
; test ecx,ecx
|
||||||
je @@Err1_4
|
jz @@Err1_4
|
||||||
jmp .test
|
jmp .test
|
||||||
@@:
|
@@:
|
||||||
call change_task
|
call change_task
|
||||||
@@ -514,28 +534,35 @@ SendCommandToHDD_1:
|
|||||||
out DX,AL
|
out DX,AL
|
||||||
sti
|
sti
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov [DevErrorCode],0
|
; mov [DevErrorCode],0
|
||||||
jmp @@End_10
|
@@End_10:
|
||||||
|
xor eax,eax
|
||||||
|
ret
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@Err1_4:
|
@@Err1_4:
|
||||||
mov [DevErrorCode],1
|
xor eax,eax
|
||||||
jmp @@End_10
|
inc eax
|
||||||
@@Err2_4:
|
; mov [DevErrorCode],1
|
||||||
mov [DevErrorCode],2
|
|
||||||
jmp @@End_10
|
|
||||||
@@Err3_4:
|
|
||||||
mov [DevErrorCode],3
|
|
||||||
jmp @@End_10
|
|
||||||
@@Err4_4:
|
|
||||||
mov [DevErrorCode],4
|
|
||||||
jmp @@End_10
|
|
||||||
@@Err5_4:
|
|
||||||
mov [DevErrorCode],5
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
@@End_10:
|
|
||||||
; sti
|
|
||||||
popad
|
|
||||||
ret
|
ret
|
||||||
|
@@Err2_4:
|
||||||
|
mov eax,2
|
||||||
|
; mov [DevErrorCode],2
|
||||||
|
ret
|
||||||
|
@@Err3_4:
|
||||||
|
mov eax,3
|
||||||
|
; mov [DevErrorCode],3
|
||||||
|
ret
|
||||||
|
@@Err4_4:
|
||||||
|
mov eax,4
|
||||||
|
; mov [DevErrorCode],4
|
||||||
|
ret
|
||||||
|
@@Err5_4:
|
||||||
|
mov eax,5
|
||||||
|
; mov [DevErrorCode],5
|
||||||
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
ret
|
||||||
|
; sti
|
||||||
|
; popad
|
||||||
|
|
||||||
;*************************************************
|
;*************************************************
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
@@ -563,8 +590,8 @@ WaitUnitReady:
|
|||||||
cmp [DevErrorCode],0
|
cmp [DevErrorCode],0
|
||||||
je @@End_11
|
je @@End_11
|
||||||
dec ecx
|
dec ecx
|
||||||
cmp ecx,0
|
; cmp ecx,0
|
||||||
je .Error
|
jz .Error
|
||||||
jmp @@SendCommand
|
jmp @@SendCommand
|
||||||
@@:
|
@@:
|
||||||
call change_task
|
call change_task
|
||||||
@@ -815,14 +842,14 @@ check_ATAPI_device_event:
|
|||||||
call EjectMedium
|
call EjectMedium
|
||||||
mov [ignore_CD_eject_wait],0
|
mov [ignore_CD_eject_wait],0
|
||||||
ret
|
ret
|
||||||
|
iglobal
|
||||||
timer_ATAPI_check dd 0
|
timer_ATAPI_check dd 0
|
||||||
ATAPI_IDE0_lock db 0
|
ATAPI_IDE0_lock db 0
|
||||||
ATAPI_IDE1_lock db 0
|
ATAPI_IDE1_lock db 0
|
||||||
ATAPI_IDE2_lock db 0
|
ATAPI_IDE2_lock db 0
|
||||||
ATAPI_IDE3_lock db 0
|
ATAPI_IDE3_lock db 0
|
||||||
ignore_CD_eject_wait db 0
|
ignore_CD_eject_wait db 0
|
||||||
|
endg
|
||||||
;*************************************************
|
;*************************************************
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
@@ -896,7 +923,7 @@ Read_TOC:
|
|||||||
|
|
||||||
clear_packet_buffer:
|
clear_packet_buffer:
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov [PacketCommand],dword 0
|
and [PacketCommand],dword 0
|
||||||
mov [PacketCommand+4],dword 0
|
and [PacketCommand+4],dword 0
|
||||||
mov [PacketCommand+8],dword 0
|
and [PacketCommand+8],dword 0
|
||||||
ret
|
ret
|
||||||
|
@@ -42,7 +42,7 @@ printplain:
|
|||||||
@@:
|
@@:
|
||||||
call putchar
|
call putchar
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, 0
|
test al,al
|
||||||
jnz @b
|
jnz @b
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
@@ -30,6 +30,8 @@ $Revision$
|
|||||||
; Description
|
; Description
|
||||||
; entry point for system PCI calls
|
; entry point for system PCI calls
|
||||||
;***************************************************************************
|
;***************************************************************************
|
||||||
|
;mmio_pci_addr equ 0x400 ; set actual PCI address here to activate user-MMIO
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
|
||||||
@@ -74,9 +76,18 @@ pci_fn_3:
|
|||||||
cmp al,10
|
cmp al,10
|
||||||
jz pci_write_reg ;dword
|
jz pci_write_reg ;dword
|
||||||
|
|
||||||
|
if defined mmio_pci_addr
|
||||||
|
cmp al,11 ; user-level MMIO functions
|
||||||
|
jz pci_mmio_init
|
||||||
|
cmp al,12
|
||||||
|
jz pci_mmio_map
|
||||||
|
cmp al,13
|
||||||
|
jz pci_mmio_unmap
|
||||||
|
end if
|
||||||
|
|
||||||
no_pci_access_for_applications:
|
no_pci_access_for_applications:
|
||||||
|
|
||||||
mov eax,-1
|
or eax,-1
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -366,19 +377,150 @@ pci_write_reg_err:
|
|||||||
dec eax
|
dec eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
if defined mmio_pci_addr ; must be set above
|
||||||
|
;***************************************************************************
|
||||||
|
; Function
|
||||||
|
; pci_mmio_init
|
||||||
|
;
|
||||||
|
; Description
|
||||||
|
; IN: bx = device's PCI bus address (bbbbbbbbdddddfff)
|
||||||
|
; Returns eax = user heap space available (bytes)
|
||||||
|
; Error codes
|
||||||
|
; eax = -1 : PCI user access blocked,
|
||||||
|
; eax = -2 : device not registered for uMMIO service
|
||||||
|
; eax = -3 : user heap initialization failure
|
||||||
|
;***************************************************************************
|
||||||
|
pci_mmio_init:
|
||||||
|
cmp bx, mmio_pci_addr
|
||||||
|
jz @f
|
||||||
|
mov eax,-2
|
||||||
|
ret
|
||||||
|
@@:
|
||||||
|
call init_heap ; (if not initialized yet)
|
||||||
|
or eax,eax
|
||||||
|
jz @f
|
||||||
|
ret
|
||||||
|
@@:
|
||||||
|
mov eax,-3
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;***************************************************************************
|
||||||
|
; Function
|
||||||
|
; pci_mmio_map
|
||||||
|
;
|
||||||
|
; Description
|
||||||
|
; maps a block of PCI memory to user-accessible linear address
|
||||||
|
;
|
||||||
|
; WARNING! This VERY EXPERIMENTAL service is for one chosen PCI device only!
|
||||||
|
; The target device address should be set in kernel var mmio_pci_addr
|
||||||
|
;
|
||||||
|
; IN: ah = BAR#;
|
||||||
|
; IN: ebx = block size (bytes);
|
||||||
|
; IN: ecx = offset in MMIO block (in 4K-pages, to avoid misaligned pages);
|
||||||
|
;
|
||||||
|
; Returns eax = MMIO block's linear address in the userspace (if no error)
|
||||||
|
;
|
||||||
|
;
|
||||||
|
; Error codes
|
||||||
|
; eax = -1 : user access to PCI blocked,
|
||||||
|
; eax = -2 : an invalid BAR register referred
|
||||||
|
; eax = -3 : no i/o space on that BAR
|
||||||
|
; eax = -4 : a port i/o BAR register referred
|
||||||
|
; eax = -5 : dynamic userspace allocation problem
|
||||||
|
;***************************************************************************
|
||||||
|
|
||||||
|
pci_mmio_map:
|
||||||
|
and edx,0x0ffff
|
||||||
|
cmp ah,6
|
||||||
|
jc .bar_0_5
|
||||||
|
jz .bar_rom
|
||||||
|
mov eax,-2
|
||||||
|
ret
|
||||||
|
.bar_rom:
|
||||||
|
mov ah, 8 ; bar6 = Expansion ROM base address
|
||||||
|
.bar_0_5:
|
||||||
|
push ecx
|
||||||
|
add ebx, 4095
|
||||||
|
and ebx,-4096
|
||||||
|
push ebx
|
||||||
|
mov bl, ah ; bl = BAR# (0..5), however bl=8 for BAR6
|
||||||
|
shl bl, 1
|
||||||
|
shl bl, 1
|
||||||
|
add bl, 0x10 ; now bl = BAR offset in PCI config. space
|
||||||
|
mov ax, mmio_pci_addr
|
||||||
|
mov bh, al ; bh = dddddfff
|
||||||
|
mov al, 2 ; al : DW to read
|
||||||
|
call pci_read_reg
|
||||||
|
or eax, eax
|
||||||
|
jnz @f
|
||||||
|
mov eax,-3 ; empty I/O space
|
||||||
|
jmp mmio_ret_fail
|
||||||
|
@@:
|
||||||
|
test eax, 1
|
||||||
|
jz @f
|
||||||
|
mov eax,-4 ; damned ports (not MMIO space)
|
||||||
|
jmp mmio_ret_fail
|
||||||
|
@@:
|
||||||
|
pop ecx ; ecx = block size, bytes (expanded to whole page)
|
||||||
|
mov ebx, ecx ; user_alloc destroys eax, ecx, edx, but saves ebx
|
||||||
|
push eax ; store MMIO physical address + keep 2DWords in the stack
|
||||||
|
stdcall user_alloc, ecx
|
||||||
|
or eax, eax
|
||||||
|
jnz mmio_map_over
|
||||||
|
mov eax,-5 ; problem with page allocation
|
||||||
|
|
||||||
|
mmio_ret_fail:
|
||||||
|
pop ecx
|
||||||
|
pop edx
|
||||||
|
ret
|
||||||
|
|
||||||
|
mmio_map_over:
|
||||||
|
mov ecx, ebx ; ecx = size (bytes, expanded to whole page)
|
||||||
|
shr ecx, 12 ; ecx = number of pages
|
||||||
|
mov ebx, eax ; ebx = linear address
|
||||||
|
pop eax ; eax = MMIO start
|
||||||
|
pop edx ; edx = MMIO shift (pages)
|
||||||
|
shl edx, 12 ; edx = MMIO shift (bytes)
|
||||||
|
add eax, edx ; eax = uMMIO physical address
|
||||||
|
or eax, PG_SHARED
|
||||||
|
or eax, PG_UW
|
||||||
|
or eax, PG_NOCACHE
|
||||||
|
mov edi, ebx
|
||||||
|
call commit_pages
|
||||||
|
mov eax, edi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;***************************************************************************
|
||||||
|
; Function
|
||||||
|
; pci_mmio_unmap_page
|
||||||
|
;
|
||||||
|
; Description
|
||||||
|
; unmaps the linear space previously tied to a PCI memory block
|
||||||
|
;
|
||||||
|
; IN: ebx = linear address of space previously allocated by pci_mmio_map
|
||||||
|
; returns eax = 1 if successfully unmapped
|
||||||
|
;
|
||||||
|
; Error codes
|
||||||
|
; eax = -1 if no user PCI access allowed,
|
||||||
|
; eax = 0 if unmapping failed
|
||||||
|
;***************************************************************************
|
||||||
|
|
||||||
|
pci_mmio_unmap:
|
||||||
|
stdcall user_free, ebx
|
||||||
|
ret
|
||||||
|
|
||||||
|
end if
|
||||||
|
|
||||||
|
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
|
uglobal
|
||||||
|
align 4
|
||||||
; VendID (2), DevID (2), Revision = 0 (1), Class Code (3), FNum (1), Bus (1)
|
; VendID (2), DevID (2), Revision = 0 (1), Class Code (3), FNum (1), Bus (1)
|
||||||
pci_emu_dat: times 30*10 db 0
|
pci_emu_dat: times 30*10 db 0
|
||||||
|
endg
|
||||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
align 4
|
align 4
|
||||||
sys_pcibios:
|
sys_pcibios:
|
||||||
xchg ebx, eax
|
|
||||||
xchg ecx, eax
|
|
||||||
xchg edx, eax
|
|
||||||
xchg esi, eax
|
|
||||||
xchg edi, eax
|
|
||||||
cmp [pci_access_enabled], 1
|
cmp [pci_access_enabled], 1
|
||||||
jne .unsupported_func
|
jne .unsupported_func
|
||||||
cmp [pci_bios_entry], 0
|
cmp [pci_bios_entry], 0
|
||||||
@@ -470,14 +612,14 @@ sys_pcibios:
|
|||||||
.not_WRITE_CONFIG:
|
.not_WRITE_CONFIG:
|
||||||
.unsupported_func:
|
.unsupported_func:
|
||||||
mov ah, 0x81 ; FUNC_NOT_SUPPORTED
|
mov ah, 0x81 ; FUNC_NOT_SUPPORTED
|
||||||
.return:mov dword[esp + 8 ], edi
|
.return:mov dword[esp + 4 ], edi
|
||||||
mov dword[esp + 12], esi
|
mov dword[esp + 8], esi
|
||||||
.return_abcd:
|
.return_abcd:
|
||||||
mov dword[esp + 28], edx
|
mov dword[esp + 24], edx
|
||||||
.return_abc:
|
.return_abc:
|
||||||
mov dword[esp + 32], ecx
|
mov dword[esp + 28], ecx
|
||||||
.return_ab:
|
.return_ab:
|
||||||
mov dword[esp + 24], ebx
|
mov dword[esp + 20], ebx
|
||||||
.return_a:
|
.return_a:
|
||||||
mov dword[esp + 36], eax
|
mov dword[esp + 32], eax
|
||||||
ret
|
ret
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -309,15 +309,13 @@ draw_data equ (OS_BASE+0x0338000);
|
|||||||
BgrDrawMode equ (OS_BASE+0x033BFF4)
|
BgrDrawMode equ (OS_BASE+0x033BFF4)
|
||||||
BgrDataWidth equ (OS_BASE+0x033BFF8)
|
BgrDataWidth equ (OS_BASE+0x033BFF8)
|
||||||
BgrDataHeight equ (OS_BASE+0x033BFFC)
|
BgrDataHeight equ (OS_BASE+0x033BFFC)
|
||||||
WinMapAddress equ (OS_BASE+0x033C000)
|
|
||||||
display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000
|
|
||||||
|
|
||||||
virtual at (OS_BASE+0x047CF80)
|
sys_pgmap equ (OS_BASE+0x033C000)
|
||||||
|
|
||||||
|
virtual at (OS_BASE+0x05FFF80)
|
||||||
tss TSS
|
tss TSS
|
||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
sys_pgmap equ (OS_BASE+0x047F000)
|
|
||||||
|
|
||||||
HEAP_BASE equ (OS_BASE+0x0800000)
|
HEAP_BASE equ (OS_BASE+0x0800000)
|
||||||
HEAP_MIN_SIZE equ 0x01000000
|
HEAP_MIN_SIZE equ 0x01000000
|
||||||
|
|
||||||
@@ -439,7 +437,8 @@ APP_OBJ_OFFSET equ 48
|
|||||||
APP_EV_OFFSET equ 40
|
APP_EV_OFFSET equ 40
|
||||||
|
|
||||||
struc CURSOR
|
struc CURSOR
|
||||||
{;common object header
|
{
|
||||||
|
;common object header
|
||||||
.magic dd ? ;'CURS'
|
.magic dd ? ;'CURS'
|
||||||
.destroy dd ? ;internal destructor
|
.destroy dd ? ;internal destructor
|
||||||
.fd dd ? ;next object in list
|
.fd dd ? ;next object in list
|
||||||
@@ -450,12 +449,17 @@ struc CURSOR
|
|||||||
.base dd ? ;allocated memory
|
.base dd ? ;allocated memory
|
||||||
.hot_x dd ? ;hotspot coords
|
.hot_x dd ? ;hotspot coords
|
||||||
.hot_y dd ?
|
.hot_y dd ?
|
||||||
|
|
||||||
|
.list_next dd ? ;next cursor in cursor list
|
||||||
|
.list_prev dd ? ;prev cursor in cursor list
|
||||||
|
.dev_obj dd ? ;device depended data
|
||||||
|
|
||||||
|
.sizeof:
|
||||||
}
|
}
|
||||||
virtual at 0
|
virtual at 0
|
||||||
CURSOR CURSOR
|
CURSOR CURSOR
|
||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
CURSOR_SIZE equ 32
|
|
||||||
|
|
||||||
struc EVENT
|
struc EVENT
|
||||||
{
|
{
|
||||||
@@ -511,6 +515,77 @@ virtual at 0
|
|||||||
SMAP SMAP
|
SMAP SMAP
|
||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
|
struc DLLDESCR
|
||||||
|
{
|
||||||
|
.bk dd ?
|
||||||
|
.fd dd ? ;+4
|
||||||
|
.data dd ? ;+8
|
||||||
|
.size dd ? ;+12
|
||||||
|
.timestamp dq ?
|
||||||
|
.refcount dd ?
|
||||||
|
.defaultbase dd ?
|
||||||
|
.coff_hdr dd ?
|
||||||
|
.symbols_ptr dd ?
|
||||||
|
.symbols_num dd ?
|
||||||
|
.symbols_lim dd ?
|
||||||
|
.exports dd ? ;export table
|
||||||
|
.name:
|
||||||
|
.sizeof:
|
||||||
|
}
|
||||||
|
|
||||||
|
struc HDLL
|
||||||
|
{
|
||||||
|
.fd dd ? ;next object in list
|
||||||
|
.bk dd ? ;prev object in list
|
||||||
|
.pid dd ? ;owner id
|
||||||
|
|
||||||
|
.base dd ? ;mapped base
|
||||||
|
.size dd ? ;mapped size
|
||||||
|
.refcount dd ? ;reference counter for this process and this lib
|
||||||
|
.parent dd ? ;DLLDESCR
|
||||||
|
.sizeof:
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual at 0
|
||||||
|
DLLDESCR DLLDESCR
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
virtual at 0
|
||||||
|
HDLL HDLL
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
struc display_t
|
||||||
|
{
|
||||||
|
.x dd ?
|
||||||
|
.y dd ?
|
||||||
|
.width dd ?
|
||||||
|
.height dd ?
|
||||||
|
.bpp dd ?
|
||||||
|
.vrefresh dd ?
|
||||||
|
.pitch dd ?
|
||||||
|
.lfb dd ?
|
||||||
|
|
||||||
|
.modes dd ?
|
||||||
|
.ddev dd ?
|
||||||
|
.connector dd ?
|
||||||
|
.crtc dd ?
|
||||||
|
|
||||||
|
.cr_list.next dd ?
|
||||||
|
.cr_list.prev dd ?
|
||||||
|
|
||||||
|
.cursor dd ?
|
||||||
|
|
||||||
|
.init_cursor dd ?
|
||||||
|
.select_cursor dd ?
|
||||||
|
.show_cursor dd ?
|
||||||
|
.move_cursor dd ?
|
||||||
|
.restore_cursor dd ?
|
||||||
|
.disable_mouse dd ?
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual at 0
|
||||||
|
display_t display_t
|
||||||
|
end virtual
|
||||||
|
|
||||||
struc HEAP_DATA
|
struc HEAP_DATA
|
||||||
{
|
{
|
||||||
@@ -595,18 +670,20 @@ struc PG_DATA
|
|||||||
;}
|
;}
|
||||||
|
|
||||||
struc SRV
|
struc SRV
|
||||||
{ .srv_name rb 16 ;ASCIIZ string
|
{
|
||||||
|
.srv_name rb 16 ;ASCIIZ string
|
||||||
.magic dd ? ;+0x10 ;'SRV '
|
.magic dd ? ;+0x10 ;'SRV '
|
||||||
.size dd ? ;+0x14 ;size of structure SRV
|
.size dd ? ;+0x14 ;size of structure SRV
|
||||||
.fd dd ? ;+0x18 ;next SRV descriptor
|
.fd dd ? ;+0x18 ;next SRV descriptor
|
||||||
.bk dd ? ;+0x1C ;prev SRV descriptor
|
.bk dd ? ;+0x1C ;prev SRV descriptor
|
||||||
.base dd ? ;+0x20 ;service base address
|
.base dd ? ;+0x20 ;service base address
|
||||||
.entry dd ? ;+0x24 ;service START function
|
.entry dd ? ;+0x24 ;service START function
|
||||||
.srv_proc dd ? ;+0x28 ;main service handler
|
.srv_proc dd ? ;+0x28 ;user mode service handler
|
||||||
|
.srv_proc_ex dd ? ;+0x2C ;kernel mode service handler
|
||||||
|
.sizeof:
|
||||||
}
|
}
|
||||||
|
|
||||||
SRV_FD_OFFSET equ 0x18
|
SRV_FD_OFFSET equ 0x18
|
||||||
SRV_SIZE equ 44
|
|
||||||
|
|
||||||
DRV_ENTRY equ 1
|
DRV_ENTRY equ 1
|
||||||
DRV_EXIT equ -1
|
DRV_EXIT equ -1
|
||||||
|
@@ -12,11 +12,11 @@
|
|||||||
|
|
||||||
$Revision$
|
$Revision$
|
||||||
|
|
||||||
|
iglobal
|
||||||
conf_path_sect: db 'path',0
|
conf_path_sect: db 'path',0
|
||||||
|
|
||||||
conf_fname db '/sys/sys.conf',0
|
conf_fname db '/sys/sys.conf',0
|
||||||
|
endg
|
||||||
; set soke kernel configuration
|
; set soke kernel configuration
|
||||||
proc set_kernel_conf
|
proc set_kernel_conf
|
||||||
locals
|
locals
|
||||||
@@ -64,7 +64,7 @@ proc set_kernel_conf
|
|||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
iglobal
|
||||||
ugui db 'gui',0
|
ugui db 'gui',0
|
||||||
ugui_mouse_speed db 'mouse_speed',0
|
ugui_mouse_speed db 'mouse_speed',0
|
||||||
ugui_mouse_speed_def db '2',0
|
ugui_mouse_speed_def db '2',0
|
||||||
@@ -74,8 +74,63 @@ ugui_mouse_delay_def db '0x00A',0
|
|||||||
udev db 'dev',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
|
||||||
|
;set up netvork configuration
|
||||||
|
proc set_network_conf
|
||||||
|
locals
|
||||||
|
par db 30 dup(?)
|
||||||
|
endl
|
||||||
|
pushad
|
||||||
|
|
||||||
|
;[net]
|
||||||
|
;active
|
||||||
|
lea eax,[par]
|
||||||
|
invoke ini.get_int,conf_fname, unet, unet_active, 0
|
||||||
|
or eax,eax
|
||||||
|
jz .do_not_set_net
|
||||||
|
mov eax, [stack_config]
|
||||||
|
and eax, 0xFFFFFF80
|
||||||
|
add eax, 3
|
||||||
|
mov [stack_config], eax
|
||||||
|
call ash_eth_enable
|
||||||
|
|
||||||
|
;addr
|
||||||
|
lea eax,[par]
|
||||||
|
push eax
|
||||||
|
invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def
|
||||||
|
pop eax
|
||||||
|
stdcall do_inet_adr,eax
|
||||||
|
mov [stack_ip], eax
|
||||||
|
|
||||||
|
;mask
|
||||||
|
lea eax,[par]
|
||||||
|
push eax
|
||||||
|
invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def
|
||||||
|
pop eax
|
||||||
|
stdcall do_inet_adr,eax
|
||||||
|
mov [subnet_mask], eax
|
||||||
|
|
||||||
|
;gate
|
||||||
|
lea eax,[par]
|
||||||
|
push eax
|
||||||
|
invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def
|
||||||
|
pop eax
|
||||||
|
stdcall do_inet_adr,eax
|
||||||
|
mov [gateway_ip], eax
|
||||||
|
.do_not_set_net:
|
||||||
|
popad
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
endp
|
||||||
|
iglobal
|
||||||
|
unet db 'net',0
|
||||||
|
unet_active db 'active',0
|
||||||
|
unet_addr db 'addr',0
|
||||||
|
unet_mask db 'mask',0
|
||||||
|
unet_gate db 'gate',0
|
||||||
|
unet_def db 0
|
||||||
|
endg
|
||||||
; convert string to DWord
|
; convert string to DWord
|
||||||
proc strtoint stdcall,strs
|
proc strtoint stdcall,strs
|
||||||
pushad
|
pushad
|
||||||
|
@@ -10,10 +10,12 @@ $Revision$
|
|||||||
|
|
||||||
; diamond, 2006
|
; diamond, 2006
|
||||||
sys_debug_services:
|
sys_debug_services:
|
||||||
cmp eax, 9
|
cmp ebx, 9
|
||||||
ja @f
|
ja @f
|
||||||
jmp dword [sys_debug_services_table+eax*4]
|
jmp dword [sys_debug_services_table+ebx*4]
|
||||||
@@: ret
|
@@: ret
|
||||||
|
iglobal
|
||||||
|
align 4
|
||||||
sys_debug_services_table:
|
sys_debug_services_table:
|
||||||
dd debug_set_event_data
|
dd debug_set_event_data
|
||||||
dd debug_getcontext
|
dd debug_getcontext
|
||||||
@@ -25,21 +27,21 @@ sys_debug_services_table:
|
|||||||
dd debug_write_process_memory
|
dd debug_write_process_memory
|
||||||
dd debug_terminate
|
dd debug_terminate
|
||||||
dd debug_set_drx
|
dd debug_set_drx
|
||||||
|
endg
|
||||||
debug_set_event_data:
|
debug_set_event_data:
|
||||||
; in: ebx = pointer
|
; in: ecx = pointer
|
||||||
; destroys eax
|
; destroys eax
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
mov [eax+APPDATA.dbg_event_mem], ebx
|
mov [eax+APPDATA.dbg_event_mem], ecx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
get_debuggee_slot:
|
get_debuggee_slot:
|
||||||
; in: ebx=PID
|
; in: ecx=PID
|
||||||
; out: CF=1 if error
|
; out: CF=1 if error
|
||||||
; CF=0 and eax=slot*0x20 if ok
|
; CF=0 and eax=slot*0x20 if ok
|
||||||
; out: interrupts disabled
|
; out: interrupts disabled
|
||||||
cli
|
cli
|
||||||
mov eax, ebx
|
mov eax, ecx
|
||||||
call pid_to_slot
|
call pid_to_slot
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .ret_bad
|
jz .ret_bad
|
||||||
@@ -56,7 +58,7 @@ get_debuggee_slot:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
debug_detach:
|
debug_detach:
|
||||||
; in: ebx=pid
|
; in: ecx=pid
|
||||||
; destroys eax,ebx
|
; destroys eax,ebx
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .ret
|
jc .ret
|
||||||
@@ -67,54 +69,55 @@ debug_detach:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
debug_terminate:
|
debug_terminate:
|
||||||
; in: ebx=pid
|
; in: ecx=pid
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc debug_detach.ret
|
jc debug_detach.ret
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
shr ecx, 5
|
shr ecx, 5
|
||||||
push 2
|
; push 2
|
||||||
pop ebx
|
; pop ebx
|
||||||
jmp sys_system
|
mov edx,esi
|
||||||
|
jmp sysfn_terminate
|
||||||
|
|
||||||
debug_suspend:
|
debug_suspend:
|
||||||
; in: ebx=pid
|
; in: ecx=pid
|
||||||
; destroys eax,ebx
|
; destroys eax,ecx
|
||||||
cli
|
cli
|
||||||
mov eax, ebx
|
mov eax, ecx
|
||||||
call pid_to_slot
|
call pid_to_slot
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
jz .ret
|
jz .ret
|
||||||
mov bl, [CURRENT_TASK+eax+TASKDATA.state] ; process state
|
mov cl, [CURRENT_TASK+eax+TASKDATA.state] ; process state
|
||||||
test bl, bl
|
test cl, cl
|
||||||
jz .1
|
jz .1
|
||||||
cmp bl, 5
|
cmp cl, 5
|
||||||
jnz .ret
|
jnz .ret
|
||||||
mov bl, 2
|
mov cl, 2
|
||||||
.2: mov [CURRENT_TASK+eax+TASKDATA.state], bl
|
.2: mov [CURRENT_TASK+eax+TASKDATA.state], cl
|
||||||
.ret:
|
.ret:
|
||||||
sti
|
sti
|
||||||
ret
|
ret
|
||||||
.1:
|
.1:
|
||||||
inc ebx
|
inc ecx
|
||||||
jmp .2
|
jmp .2
|
||||||
|
|
||||||
do_resume:
|
do_resume:
|
||||||
mov bl, [CURRENT_TASK+eax+TASKDATA.state]
|
mov cl, [CURRENT_TASK+eax+TASKDATA.state]
|
||||||
cmp bl, 1
|
cmp cl, 1
|
||||||
jz .1
|
jz .1
|
||||||
cmp bl, 2
|
cmp cl, 2
|
||||||
jnz .ret
|
jnz .ret
|
||||||
mov bl, 5
|
mov cl, 5
|
||||||
.2: mov [CURRENT_TASK+eax+TASKDATA.state], bl
|
.2: mov [CURRENT_TASK+eax+TASKDATA.state], cl
|
||||||
.ret: ret
|
.ret: ret
|
||||||
.1: dec ebx
|
.1: dec ecx
|
||||||
jmp .2
|
jmp .2
|
||||||
|
|
||||||
debug_resume:
|
debug_resume:
|
||||||
; in: ebx=pid
|
; in: ecx=pid
|
||||||
; destroys eax,ebx
|
; destroys eax,ebx
|
||||||
cli
|
cli
|
||||||
mov eax, ebx
|
mov eax, ecx
|
||||||
call pid_to_slot
|
call pid_to_slot
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
jz .ret
|
jz .ret
|
||||||
@@ -124,23 +127,24 @@ debug_resume:
|
|||||||
|
|
||||||
debug_getcontext:
|
debug_getcontext:
|
||||||
; in:
|
; in:
|
||||||
; ebx=pid
|
; ecx=pid
|
||||||
; ecx=sizeof(CONTEXT)
|
; edx=sizeof(CONTEXT)
|
||||||
; edx->CONTEXT
|
; esi->CONTEXT
|
||||||
; destroys eax,ecx,edx,esi,edi
|
; destroys eax,ecx,edx,esi,edi
|
||||||
cmp ecx, 28h
|
cmp edx, 28h
|
||||||
jnz .ret
|
jnz .ret
|
||||||
push ebx
|
; push ecx
|
||||||
mov ebx, edx
|
; mov ecx, esi
|
||||||
call check_region
|
call check_region
|
||||||
pop ebx
|
; pop ecx
|
||||||
dec eax
|
dec eax
|
||||||
jnz .ret
|
jnz .ret
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .ret
|
jc .ret
|
||||||
|
mov edi, esi
|
||||||
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack]
|
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack]
|
||||||
lea esi, [eax+RING0_STACK_SIZE]
|
lea esi, [eax+RING0_STACK_SIZE]
|
||||||
mov edi, edx
|
|
||||||
.ring0:
|
.ring0:
|
||||||
; note that following code assumes that all interrupt/exception handlers
|
; note that following code assumes that all interrupt/exception handlers
|
||||||
; saves ring-3 context by pushad in this order
|
; saves ring-3 context by pushad in this order
|
||||||
@@ -174,23 +178,24 @@ debug_getcontext:
|
|||||||
|
|
||||||
debug_setcontext:
|
debug_setcontext:
|
||||||
; in:
|
; in:
|
||||||
; ebx=pid
|
; ecx=pid
|
||||||
; ecx=sizeof(CONTEXT)
|
; edx=sizeof(CONTEXT)
|
||||||
; edx->CONTEXT
|
; esi->CONTEXT
|
||||||
; destroys eax,ecx,edx,esi,edi
|
; destroys eax,ecx,edx,esi,edi
|
||||||
cmp ecx, 28h
|
cmp edx, 28h
|
||||||
jnz .ret
|
jnz .ret
|
||||||
push ebx
|
; push ebx
|
||||||
mov ebx, edx
|
; mov ebx, edx
|
||||||
call check_region
|
call check_region
|
||||||
pop ebx
|
; pop ebx
|
||||||
dec eax
|
dec eax
|
||||||
jnz .ret
|
jnz .ret
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .stiret
|
jc .stiret
|
||||||
|
; mov esi, edx
|
||||||
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack]
|
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack]
|
||||||
lea edi, [eax+RING0_STACK_SIZE]
|
lea edi, [eax+RING0_STACK_SIZE]
|
||||||
mov esi, edx
|
|
||||||
.ring0:
|
.ring0:
|
||||||
sub edi, 8+12+20h
|
sub edi, 8+12+20h
|
||||||
mov eax, [esi+24h] ;edi
|
mov eax, [esi+24h] ;edi
|
||||||
@@ -227,67 +232,75 @@ debug_set_drx:
|
|||||||
lea eax, [eax*8+SLOT_BASE+APPDATA.dbg_regs]
|
lea eax, [eax*8+SLOT_BASE+APPDATA.dbg_regs]
|
||||||
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
|
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
|
||||||
; [eax+10]=dr7
|
; [eax+10]=dr7
|
||||||
cmp edx, OS_BASE
|
cmp esi, OS_BASE
|
||||||
jae .errret
|
jae .errret
|
||||||
cmp cl, 3
|
cmp dl, 3
|
||||||
ja .errret
|
ja .errret
|
||||||
mov ebx, dr7
|
mov ecx, dr7
|
||||||
shr ebx, cl
|
;fix me
|
||||||
shr ebx, cl
|
xchg ecx,edx
|
||||||
test ebx, 2 ; bit 1+2*index = G0..G3, global break enable
|
shr edx, cl
|
||||||
|
shr edx, cl
|
||||||
|
xchg ecx,edx
|
||||||
|
|
||||||
|
test ecx, 2 ; bit 1+2*index = G0..G3, global break enable
|
||||||
jnz .errret2
|
jnz .errret2
|
||||||
test ch, ch
|
test dh, dh
|
||||||
jns .new
|
jns .new
|
||||||
; clear breakpoint
|
; clear breakpoint
|
||||||
movzx ecx, cl
|
movzx edx, dl
|
||||||
add ecx, ecx
|
add edx, edx
|
||||||
and dword [eax+ecx*2], 0 ; clear DR<i>
|
and dword [eax+edx*2], 0 ; clear DR<i>
|
||||||
btr dword [eax+10h], ecx ; clear L<i> bit
|
btr dword [eax+10h], edx ; clear L<i> bit
|
||||||
test byte [eax+10h], 55h
|
test byte [eax+10h], 55h
|
||||||
jnz .okret
|
jnz .okret
|
||||||
; imul eax, ebp, tss_step/32
|
; imul eax, ebp, tss_step/32
|
||||||
; and byte [eax + tss_data + TSS._trap], not 1
|
; and byte [eax + tss_data + TSS._trap], not 1
|
||||||
and [ebp*8 + SLOT_BASE+APPDATA.dbg_state], not 1
|
and [ebp*8 + SLOT_BASE+APPDATA.dbg_state], not 1
|
||||||
.okret:
|
.okret:
|
||||||
and dword [esp+36], 0
|
and dword [esp+32], 0
|
||||||
sti
|
sti
|
||||||
ret
|
ret
|
||||||
.errret:
|
.errret:
|
||||||
sti
|
sti
|
||||||
mov dword [esp+36], 1
|
mov dword [esp+32], 1
|
||||||
ret
|
ret
|
||||||
.errret2:
|
.errret2:
|
||||||
sti
|
sti
|
||||||
mov dword [esp+36], 2
|
mov dword [esp+32], 2
|
||||||
ret
|
ret
|
||||||
.new:
|
.new:
|
||||||
; add new breakpoint
|
; add new breakpoint
|
||||||
; cl=index; ch=flags; edx=address
|
; dl=index; dh=flags; esi=address
|
||||||
test ch, 0xF0
|
test dh, 0xF0
|
||||||
jnz .errret
|
jnz .errret
|
||||||
mov bl, ch
|
mov cl, dh
|
||||||
and bl, 3
|
and cl, 3
|
||||||
cmp bl, 2
|
cmp cl, 2
|
||||||
jz .errret
|
jz .errret
|
||||||
mov bl, ch
|
mov cl, dh
|
||||||
shr bl, 2
|
shr cl, 2
|
||||||
cmp bl, 2
|
cmp cl, 2
|
||||||
jz .errret
|
jz .errret
|
||||||
test dl, bl
|
|
||||||
|
mov ebx,esi
|
||||||
|
test bl, dl
|
||||||
|
|
||||||
jnz .errret
|
jnz .errret
|
||||||
or byte [eax+10h+1], 3 ; set GE and LE flags
|
or byte [eax+10h+1], 3 ; set GE and LE flags
|
||||||
movzx ebx, ch
|
|
||||||
movzx ecx, cl
|
movzx edx, dh
|
||||||
|
movzx ecx, dl
|
||||||
add ecx, ecx
|
add ecx, ecx
|
||||||
bts dword [eax+10h], ecx ; set L<i> flag
|
bts dword [eax+10h], ecx ; set L<i> flag
|
||||||
add ecx, ecx
|
add ecx, ecx
|
||||||
mov [eax+ecx], edx ; set DR<i>
|
mov [eax+ecx], ebx;esi ; set DR<i>
|
||||||
shl ebx, cl
|
|
||||||
mov edx, 0xF
|
|
||||||
shl edx, cl
|
shl edx, cl
|
||||||
not edx
|
mov ebx, 0xF
|
||||||
and [eax+10h+2], dx
|
shl ebx, cl
|
||||||
or [eax+10h+2], bx ; set R/W and LEN fields
|
not ebx
|
||||||
|
and [eax+10h+2], bx
|
||||||
|
or [eax+10h+2], dx ; set R/W and LEN fields
|
||||||
; imul eax, ebp, tss_step/32
|
; imul eax, ebp, tss_step/32
|
||||||
; or byte [eax + tss_data + TSS._trap], 1
|
; or byte [eax + tss_data + TSS._trap], 1
|
||||||
or [ebp*8 + SLOT_BASE+APPDATA.dbg_state], 1
|
or [ebp*8 + SLOT_BASE+APPDATA.dbg_state], 1
|
||||||
@@ -295,51 +308,51 @@ debug_set_drx:
|
|||||||
|
|
||||||
debug_read_process_memory:
|
debug_read_process_memory:
|
||||||
; in:
|
; in:
|
||||||
; ebx=pid
|
; ecx=pid
|
||||||
; ecx=length
|
; edx=length
|
||||||
; esi->buffer in debugger
|
; edi->buffer in debugger
|
||||||
; edx=address in debuggee
|
; esi=address in debuggee
|
||||||
; out: [esp+36]=sizeof(read)
|
; out: [esp+36]=sizeof(read)
|
||||||
; destroys all
|
; destroys all
|
||||||
push ebx
|
; push ebx
|
||||||
mov ebx, esi
|
; mov ebx, esi
|
||||||
call check_region
|
call check_region
|
||||||
pop ebx
|
; pop ebx
|
||||||
dec eax
|
dec eax
|
||||||
jnz .err
|
jnz .err
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .err
|
jc .err
|
||||||
shr eax, 5
|
shr eax, 5
|
||||||
mov ebx, esi
|
; mov ebx, esi
|
||||||
call read_process_memory
|
call read_process_memory
|
||||||
sti
|
sti
|
||||||
mov dword [esp+36], eax
|
mov dword [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.err:
|
.err:
|
||||||
or dword [esp+36], -1
|
or dword [esp+32], -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
debug_write_process_memory:
|
debug_write_process_memory:
|
||||||
; in:
|
; in:
|
||||||
; ebx=pid
|
; ecx=pid
|
||||||
; ecx=length
|
; edx=length
|
||||||
; esi->buffer in debugger
|
; edi->buffer in debugger
|
||||||
; edx=address in debuggee
|
; esi=address in debuggee
|
||||||
; out: [esp+36]=sizeof(write)
|
; out: [esp+36]=sizeof(write)
|
||||||
; destroys all
|
; destroys all
|
||||||
push ebx
|
; push ebx
|
||||||
mov ebx, esi
|
; mov ebx, esi
|
||||||
call check_region
|
call check_region
|
||||||
pop ebx
|
; pop ebx
|
||||||
dec eax
|
dec eax
|
||||||
jnz debug_read_process_memory.err
|
jnz debug_read_process_memory.err
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc debug_read_process_memory.err
|
jc debug_read_process_memory.err
|
||||||
shr eax, 5
|
shr eax, 5
|
||||||
mov ebx, esi
|
; mov ebx, esi
|
||||||
call write_process_memory
|
call write_process_memory
|
||||||
sti
|
sti
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
debugger_notify:
|
debugger_notify:
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -315,7 +315,7 @@ proc srv_handler stdcall, ioctl:dword
|
|||||||
cmp [edi+SRV.magic], ' SRV'
|
cmp [edi+SRV.magic], ' SRV'
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
cmp [edi+SRV.size], SRV_SIZE
|
cmp [edi+SRV.size], SRV.sizeof
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
stdcall [edi+SRV.srv_proc], esi
|
stdcall [edi+SRV.srv_proc], esi
|
||||||
@@ -333,24 +333,24 @@ proc srv_handler stdcall, ioctl:dword
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
; param
|
; param
|
||||||
; ebx= io_control
|
; ecx= io_control
|
||||||
;
|
;
|
||||||
; retval
|
; retval
|
||||||
; eax= error code
|
; eax= error code
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
srv_handlerEx:
|
srv_handlerEx:
|
||||||
cmp ebx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
mov eax, [ebx+handle]
|
mov eax, [ecx+handle]
|
||||||
cmp [eax+SRV.magic], ' SRV'
|
cmp [eax+SRV.magic], ' SRV'
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
cmp [eax+SRV.size], SRV_SIZE
|
cmp [eax+SRV.size], SRV.sizeof
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
stdcall [eax+SRV.srv_proc], ebx
|
stdcall [eax+SRV.srv_proc], ecx
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
or eax, -1
|
or eax, -1
|
||||||
@@ -402,8 +402,8 @@ proc reg_service stdcall, name:dword, handler:dword
|
|||||||
cmp [handler], eax
|
cmp [handler], eax
|
||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
mov eax, SRV_SIZE
|
mov eax, SRV.sizeof
|
||||||
call malloc ;call alloc_service
|
call malloc
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
@@ -411,13 +411,15 @@ proc reg_service stdcall, name:dword, handler:dword
|
|||||||
push edi
|
push edi
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov esi, [name]
|
mov esi, [name]
|
||||||
mov ecx, 16/4
|
movsd
|
||||||
rep movsd
|
movsd
|
||||||
|
movsd
|
||||||
|
movsd
|
||||||
pop edi
|
pop edi
|
||||||
pop esi
|
pop esi
|
||||||
|
|
||||||
mov [eax+SRV.magic], ' SRV'
|
mov [eax+SRV.magic], ' SRV'
|
||||||
mov [eax+SRV.size], SRV_SIZE
|
mov [eax+SRV.size], SRV.sizeof
|
||||||
|
|
||||||
mov ebx, srv.fd-SRV_FD_OFFSET
|
mov ebx, srv.fd-SRV_FD_OFFSET
|
||||||
mov edx, [ebx+SRV.fd]
|
mov edx, [ebx+SRV.fd]
|
||||||
@@ -472,8 +474,8 @@ proc get_coff_sym stdcall, pSym:dword,count:dword, sz_sym:dword
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
.ok:
|
.ok:
|
||||||
mov ebx, [pSym]
|
mov eax, [pSym]
|
||||||
mov eax, [ebx+8]
|
mov eax, [eax+8]
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@@ -611,7 +613,10 @@ proc load_file stdcall, file_name:dword
|
|||||||
jz .cleanup
|
jz .cleanup
|
||||||
|
|
||||||
mov [file2], eax
|
mov [file2], eax
|
||||||
|
pushfd
|
||||||
|
cli
|
||||||
stdcall unpack, [file], eax
|
stdcall unpack, [file], eax
|
||||||
|
popfd
|
||||||
stdcall kernel_free, [file]
|
stdcall kernel_free, [file]
|
||||||
mov eax, [file2]
|
mov eax, [file2]
|
||||||
mov ebx, [file_size]
|
mov ebx, [file_size]
|
||||||
@@ -676,7 +681,7 @@ proc get_proc_ex stdcall, proc_name:dword, imports:dword
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc fix_coff_symbols stdcall, sec:dword, symbols:dword,\
|
proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\
|
||||||
sym_count:dword, strings:dword, imports:dword
|
sym_count:dword, strings:dword, imports:dword
|
||||||
locals
|
locals
|
||||||
retval dd ?
|
retval dd ?
|
||||||
@@ -738,7 +743,8 @@ proc fix_coff_symbols stdcall, sec:dword, symbols:dword,\
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc fix_coff_relocs stdcall, coff:dword, sec:dword, sym:dword
|
proc fix_coff_relocs stdcall uses ebx esi, coff:dword, sym:dword, \
|
||||||
|
delta:dword
|
||||||
locals
|
locals
|
||||||
n_sec dd ?
|
n_sec dd ?
|
||||||
endl
|
endl
|
||||||
@@ -746,15 +752,15 @@ proc fix_coff_relocs stdcall, coff:dword, sec:dword, sym:dword
|
|||||||
mov eax, [coff]
|
mov eax, [coff]
|
||||||
movzx ebx, [eax+CFH.nSections]
|
movzx ebx, [eax+CFH.nSections]
|
||||||
mov [n_sec], ebx
|
mov [n_sec], ebx
|
||||||
|
lea esi, [eax+20]
|
||||||
.fix_sec:
|
.fix_sec:
|
||||||
mov esi, [sec]
|
|
||||||
mov edi, [esi+CFS.PtrReloc]
|
mov edi, [esi+CFS.PtrReloc]
|
||||||
add edi, [coff]
|
add edi, [coff]
|
||||||
|
|
||||||
movzx ecx, [esi+CFS.NumReloc]
|
movzx ecx, [esi+CFS.NumReloc]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .next
|
jz .next
|
||||||
.next_reloc:
|
.reloc_loop:
|
||||||
mov ebx, [edi+CRELOC.SymIndex]
|
mov ebx, [edi+CRELOC.SymIndex]
|
||||||
add ebx,ebx
|
add ebx,ebx
|
||||||
lea ebx,[ebx+ebx*8]
|
lea ebx,[ebx+ebx*8]
|
||||||
@@ -777,12 +783,51 @@ proc fix_coff_relocs stdcall, coff:dword, sec:dword, sym:dword
|
|||||||
mov eax, [edi+CRELOC.VirtualAddress]
|
mov eax, [edi+CRELOC.VirtualAddress]
|
||||||
add eax, [esi+CFS.VirtualAddress]
|
add eax, [esi+CFS.VirtualAddress]
|
||||||
.fix:
|
.fix:
|
||||||
|
add eax, [delta]
|
||||||
add [eax], edx
|
add [eax], edx
|
||||||
|
.next_reloc:
|
||||||
add edi, 10
|
add edi, 10
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .next_reloc
|
jnz .reloc_loop
|
||||||
.next:
|
.next:
|
||||||
add [sec], COFF_SECTION_SIZE
|
add esi, COFF_SECTION_SIZE
|
||||||
|
dec [n_sec]
|
||||||
|
jnz .fix_sec
|
||||||
|
.exit:
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
proc rebase_coff stdcall uses ebx esi, coff:dword, sym:dword, \
|
||||||
|
delta:dword
|
||||||
|
locals
|
||||||
|
n_sec dd ?
|
||||||
|
endl
|
||||||
|
|
||||||
|
mov eax, [coff]
|
||||||
|
movzx ebx, [eax+CFH.nSections]
|
||||||
|
mov [n_sec], ebx
|
||||||
|
lea esi, [eax+20]
|
||||||
|
mov edx, [delta]
|
||||||
|
.fix_sec:
|
||||||
|
mov edi, [esi+CFS.PtrReloc]
|
||||||
|
add edi, [coff]
|
||||||
|
|
||||||
|
movzx ecx, [esi+CFS.NumReloc]
|
||||||
|
test ecx, ecx
|
||||||
|
jz .next
|
||||||
|
.reloc_loop:
|
||||||
|
cmp [edi+CRELOC.Type], 6
|
||||||
|
jne .next_reloc
|
||||||
|
.dir_32:
|
||||||
|
mov eax, [edi+CRELOC.VirtualAddress]
|
||||||
|
add eax, [esi+CFS.VirtualAddress]
|
||||||
|
add [eax+edx], edx
|
||||||
|
.next_reloc:
|
||||||
|
add edi, 10
|
||||||
|
dec ecx
|
||||||
|
jnz .reloc_loop
|
||||||
|
.next:
|
||||||
|
add esi, COFF_SECTION_SIZE
|
||||||
dec [n_sec]
|
dec [n_sec]
|
||||||
jnz .fix_sec
|
jnz .fix_sec
|
||||||
.exit:
|
.exit:
|
||||||
@@ -900,10 +945,8 @@ proc load_driver stdcall, driver_name:dword
|
|||||||
jz .link_fail
|
jz .link_fail
|
||||||
|
|
||||||
mov ebx, [coff]
|
mov ebx, [coff]
|
||||||
add ebx, 20
|
stdcall fix_coff_relocs, ebx, [sym], 0
|
||||||
stdcall fix_coff_relocs, [coff], ebx, [sym]
|
|
||||||
|
|
||||||
mov ebx, [coff]
|
|
||||||
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szVersion
|
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szVersion
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .link_fail
|
jz .link_fail
|
||||||
@@ -975,124 +1018,537 @@ proc load_driver stdcall, driver_name:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
; in: edx -> COFF_SECTION struct
|
||||||
|
; out: eax = alignment as mask for bits to drop
|
||||||
|
coff_get_align:
|
||||||
|
; Rules:
|
||||||
|
; - if alignment is not given, use default = 4K;
|
||||||
|
; - if alignment is given and is no more than 4K, use it;
|
||||||
|
; - if alignment is more than 4K, revert to 4K.
|
||||||
|
push ecx
|
||||||
|
mov cl, byte [edx+CFS.Characteristics+2]
|
||||||
|
mov eax, 1
|
||||||
|
shr cl, 4
|
||||||
|
dec cl
|
||||||
|
js .default
|
||||||
|
cmp cl, 12
|
||||||
|
jbe @f
|
||||||
|
.default:
|
||||||
|
mov cl, 12
|
||||||
|
@@:
|
||||||
|
shl eax, cl
|
||||||
|
pop ecx
|
||||||
|
dec eax
|
||||||
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc load_library stdcall, file_name:dword
|
proc load_library stdcall, file_name:dword
|
||||||
locals
|
locals
|
||||||
|
fullname rb 260
|
||||||
|
fileinfo rb 40
|
||||||
coff dd ?
|
coff dd ?
|
||||||
sym dd ?
|
|
||||||
strings dd ?
|
|
||||||
img_size dd ?
|
|
||||||
img_base dd ?
|
img_base dd ?
|
||||||
exports dd ?
|
|
||||||
endl
|
endl
|
||||||
|
|
||||||
cli
|
cli
|
||||||
|
|
||||||
stdcall load_file, [file_name]
|
; resolve file name
|
||||||
test eax, eax
|
mov ebx, [file_name]
|
||||||
|
lea edi, [fullname+1]
|
||||||
|
mov byte [edi-1], '/'
|
||||||
|
stdcall get_full_file_name, edi, 259
|
||||||
|
test al, al
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
|
; scan for required DLL in list of already loaded for this process,
|
||||||
|
; ignore timestamp
|
||||||
|
mov esi, [CURRENT_TASK]
|
||||||
|
shl esi, 8
|
||||||
|
lea edi, [fullname]
|
||||||
|
mov ebx, [esi+SLOT_BASE+APPDATA.dlls_list_ptr]
|
||||||
|
test ebx, ebx
|
||||||
|
jz .not_in_process
|
||||||
|
mov esi, [ebx+HDLL.fd]
|
||||||
|
.scan_in_process:
|
||||||
|
cmp esi, ebx
|
||||||
|
jz .not_in_process
|
||||||
|
mov eax, [esi+HDLL.parent]
|
||||||
|
add eax, DLLDESCR.name
|
||||||
|
stdcall strncmp, eax, edi, -1
|
||||||
|
test eax, eax
|
||||||
|
jnz .next_in_process
|
||||||
|
; simple variant: load DLL which is already loaded in this process
|
||||||
|
; just increment reference counters and return address of exports table
|
||||||
|
inc [esi+HDLL.refcount]
|
||||||
|
mov ecx, [esi+HDLL.parent]
|
||||||
|
inc [ecx+DLLDESCR.refcount]
|
||||||
|
mov eax, [ecx+DLLDESCR.exports]
|
||||||
|
sub eax, [ecx+DLLDESCR.defaultbase]
|
||||||
|
add eax, [esi+HDLL.base]
|
||||||
|
ret
|
||||||
|
.next_in_process:
|
||||||
|
mov esi, [esi+HDLL.fd]
|
||||||
|
jmp .scan_in_process
|
||||||
|
.not_in_process:
|
||||||
|
|
||||||
|
; scan in full list, compare timestamp
|
||||||
|
lea eax, [fileinfo]
|
||||||
|
stdcall get_fileinfo, edi, eax
|
||||||
|
test eax, eax
|
||||||
|
jnz .fail
|
||||||
|
mov esi, [dll_list.fd]
|
||||||
|
.scan_for_dlls:
|
||||||
|
cmp esi, dll_list
|
||||||
|
jz .load_new
|
||||||
|
lea eax, [esi+DLLDESCR.name]
|
||||||
|
stdcall strncmp, eax, edi, -1
|
||||||
|
test eax, eax
|
||||||
|
jnz .continue_scan
|
||||||
|
.test_prev_dll:
|
||||||
|
mov eax, dword [fileinfo+24] ; last modified time
|
||||||
|
mov edx, dword [fileinfo+28] ; last modified date
|
||||||
|
cmp dword [esi+DLLDESCR.timestamp], eax
|
||||||
|
jnz .continue_scan
|
||||||
|
cmp dword [esi+DLLDESCR.timestamp+4], edx
|
||||||
|
jz .dll_already_loaded
|
||||||
|
.continue_scan:
|
||||||
|
mov esi, [esi+DLLDESCR.fd]
|
||||||
|
jmp .scan_for_dlls
|
||||||
|
|
||||||
|
; new DLL
|
||||||
|
.load_new:
|
||||||
|
; load file
|
||||||
|
stdcall load_file, edi
|
||||||
|
test eax, eax
|
||||||
|
jz .fail
|
||||||
mov [coff], eax
|
mov [coff], eax
|
||||||
movzx ecx, [eax+CFH.nSections]
|
mov dword [fileinfo+32], ebx
|
||||||
|
|
||||||
|
; allocate DLLDESCR struct; size is DLLDESCR.sizeof plus size of DLL name
|
||||||
|
mov esi, edi
|
||||||
|
mov ecx, -1
|
||||||
|
xor eax, eax
|
||||||
|
repnz scasb
|
||||||
|
not ecx
|
||||||
|
lea eax, [ecx+DLLDESCR.sizeof]
|
||||||
|
push ecx
|
||||||
|
call malloc
|
||||||
|
pop ecx
|
||||||
|
test eax, eax
|
||||||
|
jz .fail_and_free_coff
|
||||||
|
; save timestamp
|
||||||
|
lea edi, [eax+DLLDESCR.name]
|
||||||
|
rep movsb
|
||||||
|
mov esi, eax
|
||||||
|
mov eax, dword [fileinfo+24]
|
||||||
|
mov dword [esi+DLLDESCR.timestamp], eax
|
||||||
|
mov eax, dword [fileinfo+28]
|
||||||
|
mov dword [esi+DLLDESCR.timestamp+4], eax
|
||||||
|
; initialize DLLDESCR struct
|
||||||
|
and dword [esi+DLLDESCR.refcount], 0 ; no HDLLs yet; later it will be incremented
|
||||||
|
mov [esi+DLLDESCR.fd], dll_list
|
||||||
|
mov eax, [dll_list.bk]
|
||||||
|
mov [dll_list.bk], esi
|
||||||
|
mov [esi+DLLDESCR.bk], eax
|
||||||
|
mov [eax+DLLDESCR.fd], esi
|
||||||
|
|
||||||
|
; calculate size of loaded DLL
|
||||||
|
mov edx, [coff]
|
||||||
|
movzx ecx, [edx+CFH.nSections]
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
|
|
||||||
lea edx, [eax+20]
|
add edx, 20
|
||||||
@@:
|
@@:
|
||||||
|
call coff_get_align
|
||||||
|
add ebx, eax
|
||||||
|
not eax
|
||||||
|
and ebx, eax
|
||||||
add ebx, [edx+CFS.SizeOfRawData]
|
add ebx, [edx+CFS.SizeOfRawData]
|
||||||
add ebx, 15
|
|
||||||
and ebx, not 15
|
|
||||||
add edx, COFF_SECTION_SIZE
|
add edx, COFF_SECTION_SIZE
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz @B
|
jnz @B
|
||||||
mov [img_size], ebx
|
; it must be nonzero and not too big
|
||||||
|
mov [esi+DLLDESCR.size], ebx
|
||||||
call init_heap
|
test ebx, ebx
|
||||||
stdcall user_alloc, [img_size]
|
jz .fail_and_free_dll
|
||||||
|
cmp ebx, MAX_DEFAULT_DLL_ADDR-MIN_DEFAULT_DLL_ADDR
|
||||||
|
ja .fail_and_free_dll
|
||||||
|
; allocate memory for kernel-side image
|
||||||
|
stdcall kernel_alloc, ebx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail_and_free_dll
|
||||||
mov [img_base], eax
|
mov [esi+DLLDESCR.data], eax
|
||||||
|
; calculate preferred base address
|
||||||
|
add ebx, 0x1FFF
|
||||||
|
and ebx, not 0xFFF
|
||||||
|
mov ecx, [dll_cur_addr]
|
||||||
|
lea edx, [ecx+ebx]
|
||||||
|
cmp edx, MAX_DEFAULT_DLL_ADDR
|
||||||
|
jb @f
|
||||||
|
mov ecx, MIN_DEFAULT_DLL_ADDR
|
||||||
|
lea edx, [ecx+ebx]
|
||||||
|
@@:
|
||||||
|
mov [esi+DLLDESCR.defaultbase], ecx
|
||||||
|
mov [dll_cur_addr], edx
|
||||||
|
|
||||||
|
; copy sections and set correct values for VirtualAddress'es in headers
|
||||||
|
push esi
|
||||||
mov edx, [coff]
|
mov edx, [coff]
|
||||||
movzx ebx, [edx+CFH.nSections]
|
movzx ebx, [edx+CFH.nSections]
|
||||||
mov edi, [img_base]
|
mov edi, eax
|
||||||
lea eax, [edx+20]
|
add edx, 20
|
||||||
|
cld
|
||||||
@@:
|
@@:
|
||||||
mov [eax+CFS.VirtualAddress], edi
|
call coff_get_align
|
||||||
mov esi, [eax+CFS.PtrRawData]
|
add ecx, eax
|
||||||
|
add edi, eax
|
||||||
|
not eax
|
||||||
|
and ecx, eax
|
||||||
|
and edi, eax
|
||||||
|
mov [edx+CFS.VirtualAddress], ecx
|
||||||
|
add ecx, [edx+CFS.SizeOfRawData]
|
||||||
|
mov esi, [edx+CFS.PtrRawData]
|
||||||
|
push ecx
|
||||||
|
mov ecx, [edx+CFS.SizeOfRawData]
|
||||||
test esi, esi
|
test esi, esi
|
||||||
jnz .copy
|
jnz .copy
|
||||||
add edi, [eax+CFS.SizeOfRawData]
|
xor eax, eax
|
||||||
|
rep stosb
|
||||||
jmp .next
|
jmp .next
|
||||||
.copy:
|
.copy:
|
||||||
add esi, edx
|
add esi, [coff]
|
||||||
mov ecx, [eax+CFS.SizeOfRawData]
|
|
||||||
cld
|
|
||||||
rep movsb
|
rep movsb
|
||||||
.next:
|
.next:
|
||||||
add edi, 15 ;-new_app_base
|
pop ecx
|
||||||
and edi, -16
|
add edx, COFF_SECTION_SIZE
|
||||||
add eax, COFF_SECTION_SIZE
|
|
||||||
dec ebx
|
dec ebx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
pop esi
|
||||||
|
|
||||||
mov ebx, [edx+CFH.pSymTable]
|
; save some additional data from COFF file
|
||||||
add ebx, edx
|
; later we will use COFF header, headers for sections and symbol table
|
||||||
mov [sym], ebx
|
; and also relocations table for all sections
|
||||||
mov ecx, [edx+CFH.nSymbols]
|
|
||||||
add ecx,ecx
|
|
||||||
lea ecx,[ecx+ecx*8] ;ecx*=18 = nSymbols*CSYM_SIZE
|
|
||||||
add ecx, [sym]
|
|
||||||
mov [strings], ecx
|
|
||||||
|
|
||||||
lea eax, [edx+20]
|
|
||||||
|
|
||||||
stdcall fix_coff_symbols, eax, [sym], [edx+CFH.nSymbols],\
|
|
||||||
[strings], dword 0
|
|
||||||
test eax, eax
|
|
||||||
jnz @F
|
|
||||||
|
|
||||||
@@:
|
|
||||||
mov edx, [coff]
|
mov edx, [coff]
|
||||||
movzx ebx, [edx+CFH.nSections]
|
mov ebx, [edx+CFH.pSymTable]
|
||||||
mov edi, new_app_base
|
mov edi, dword [fileinfo+32]
|
||||||
lea eax, [edx+20]
|
sub edi, ebx
|
||||||
@@:
|
jc .fail_and_free_data
|
||||||
add [eax+CFS.VirtualAddress], edi ;patch user space offset
|
mov [esi+DLLDESCR.symbols_lim], edi
|
||||||
add eax, COFF_SECTION_SIZE
|
add ebx, edx
|
||||||
dec ebx
|
movzx ecx, [edx+CFH.nSections]
|
||||||
jnz @B
|
lea ecx, [ecx*5]
|
||||||
|
lea edi, [edi+ecx*8+20]
|
||||||
add edx, 20
|
add edx, 20
|
||||||
stdcall fix_coff_relocs, [coff], edx, [sym]
|
@@:
|
||||||
|
movzx eax, [edx+CFS.NumReloc]
|
||||||
|
lea eax, [eax*5]
|
||||||
|
lea edi, [edi+eax*2]
|
||||||
|
add edx, COFF_SECTION_SIZE
|
||||||
|
sub ecx, 5
|
||||||
|
jnz @b
|
||||||
|
stdcall kernel_alloc, edi
|
||||||
|
test eax, eax
|
||||||
|
jz .fail_and_free_data
|
||||||
|
mov edx, [coff]
|
||||||
|
movzx ecx, [edx+CFH.nSections]
|
||||||
|
lea ecx, [ecx*5]
|
||||||
|
lea ecx, [ecx*2+5]
|
||||||
|
mov [esi+DLLDESCR.coff_hdr], eax
|
||||||
|
push esi
|
||||||
|
mov esi, edx
|
||||||
|
mov edi, eax
|
||||||
|
rep movsd
|
||||||
|
pop esi
|
||||||
|
mov [esi+DLLDESCR.symbols_ptr], edi
|
||||||
|
push esi
|
||||||
|
mov ecx, [edx+CFH.nSymbols]
|
||||||
|
mov [esi+DLLDESCR.symbols_num], ecx
|
||||||
|
mov ecx, [esi+DLLDESCR.symbols_lim]
|
||||||
|
mov esi, ebx
|
||||||
|
rep movsb
|
||||||
|
pop esi
|
||||||
|
mov ebx, [esi+DLLDESCR.coff_hdr]
|
||||||
|
push esi
|
||||||
|
movzx eax, [edx+CFH.nSections]
|
||||||
|
lea edx, [ebx+20]
|
||||||
|
@@:
|
||||||
|
movzx ecx, [edx+CFS.NumReloc]
|
||||||
|
lea ecx, [ecx*5]
|
||||||
|
mov esi, [edx+CFS.PtrReloc]
|
||||||
|
mov [edx+CFS.PtrReloc], edi
|
||||||
|
sub [edx+CFS.PtrReloc], ebx
|
||||||
|
add esi, [coff]
|
||||||
|
shr ecx, 1
|
||||||
|
rep movsd
|
||||||
|
adc ecx, ecx
|
||||||
|
rep movsw
|
||||||
|
add edx, COFF_SECTION_SIZE
|
||||||
|
dec eax
|
||||||
|
jnz @b
|
||||||
|
pop esi
|
||||||
|
|
||||||
mov ebx, [coff]
|
; fixup symbols
|
||||||
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szEXPORTS
|
mov edx, ebx
|
||||||
|
mov eax, [ebx+CFH.nSymbols]
|
||||||
|
add edx, 20
|
||||||
|
mov ecx, [esi+DLLDESCR.symbols_num]
|
||||||
|
lea ecx, [ecx*9]
|
||||||
|
add ecx, ecx
|
||||||
|
add ecx, [esi+DLLDESCR.symbols_ptr]
|
||||||
|
|
||||||
|
stdcall fix_coff_symbols, edx, [esi+DLLDESCR.symbols_ptr], eax,\
|
||||||
|
ecx, 0
|
||||||
|
; test eax, eax
|
||||||
|
; jnz @F
|
||||||
|
;
|
||||||
|
;@@:
|
||||||
|
|
||||||
|
stdcall get_coff_sym,[esi+DLLDESCR.symbols_ptr],[ebx+CFH.nSymbols],szEXPORTS
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @F
|
jnz @F
|
||||||
|
|
||||||
mov ebx, [coff]
|
stdcall get_coff_sym,[esi+DLLDESCR.symbols_ptr],[ebx+CFH.nSymbols],sz_EXPORTS
|
||||||
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],sz_EXPORTS
|
|
||||||
@@:
|
@@:
|
||||||
mov [exports], eax
|
mov [esi+DLLDESCR.exports], eax
|
||||||
|
|
||||||
|
; fix relocs in the hidden copy in kernel memory to default address
|
||||||
|
; it is first fix; usually this will be enough, but second fix
|
||||||
|
; can be necessary if real load address will not equal assumption
|
||||||
|
mov eax, [esi+DLLDESCR.data]
|
||||||
|
sub eax, [esi+DLLDESCR.defaultbase]
|
||||||
|
stdcall fix_coff_relocs, ebx, [esi+DLLDESCR.symbols_ptr], eax
|
||||||
|
|
||||||
stdcall kernel_free, [coff]
|
stdcall kernel_free, [coff]
|
||||||
mov eax, [exports]
|
|
||||||
|
.dll_already_loaded:
|
||||||
|
inc [esi+DLLDESCR.refcount]
|
||||||
|
push esi
|
||||||
|
call init_heap
|
||||||
|
pop esi
|
||||||
|
|
||||||
|
mov edi, [esi+DLLDESCR.size]
|
||||||
|
stdcall user_alloc_at, [esi+DLLDESCR.defaultbase], edi
|
||||||
|
test eax, eax
|
||||||
|
jnz @f
|
||||||
|
stdcall user_alloc, edi
|
||||||
|
test eax, eax
|
||||||
|
jz .fail_and_dereference
|
||||||
|
@@:
|
||||||
|
mov [img_base], eax
|
||||||
|
mov eax, HDLL.sizeof
|
||||||
|
call malloc
|
||||||
|
test eax, eax
|
||||||
|
jz .fail_and_free_user
|
||||||
|
mov ebx, [CURRENT_TASK]
|
||||||
|
shl ebx, 5
|
||||||
|
mov edx, [CURRENT_TASK+ebx+TASKDATA.pid]
|
||||||
|
mov [eax+HDLL.pid], edx
|
||||||
|
push eax
|
||||||
|
call init_dlls_in_thread
|
||||||
|
pop ebx
|
||||||
|
test eax, eax
|
||||||
|
jz .fail_and_free_user
|
||||||
|
mov edx, [eax+HDLL.fd]
|
||||||
|
mov [ebx+HDLL.fd], edx
|
||||||
|
mov [ebx+HDLL.bk], eax
|
||||||
|
mov [eax+HDLL.fd], ebx
|
||||||
|
mov [edx+HDLL.bk], ebx
|
||||||
|
mov eax, ebx
|
||||||
|
mov ebx, [img_base]
|
||||||
|
mov [eax+HDLL.base], ebx
|
||||||
|
mov [eax+HDLL.size], edi
|
||||||
|
mov [eax+HDLL.refcount], 1
|
||||||
|
mov [eax+HDLL.parent], esi
|
||||||
|
mov edx, ebx
|
||||||
|
shr edx, 12
|
||||||
|
or dword [page_tabs+(edx-1)*4], DONT_FREE_BLOCK
|
||||||
|
; copy entries of page table from kernel-side image to usermode
|
||||||
|
; use copy-on-write for user-mode image, so map as readonly
|
||||||
|
xor edi, edi
|
||||||
|
mov ecx, [esi+DLLDESCR.data]
|
||||||
|
shr ecx, 12
|
||||||
|
.map_pages_loop:
|
||||||
|
mov eax, [page_tabs+ecx*4]
|
||||||
|
and eax, not 0xFFF
|
||||||
|
or al, PG_USER
|
||||||
|
xchg eax, [page_tabs+edx*4]
|
||||||
|
test al, 1
|
||||||
|
jz @f
|
||||||
|
call free_page
|
||||||
|
@@:
|
||||||
|
invlpg [ebx+edi]
|
||||||
|
inc ecx
|
||||||
|
inc edx
|
||||||
|
add edi, 0x1000
|
||||||
|
cmp edi, [esi+DLLDESCR.size]
|
||||||
|
jb .map_pages_loop
|
||||||
|
|
||||||
|
; if real user-mode base is not equal to preferred base, relocate image
|
||||||
|
sub ebx, [esi+DLLDESCR.defaultbase]
|
||||||
|
jz @f
|
||||||
|
stdcall rebase_coff, [esi+DLLDESCR.coff_hdr], [esi+DLLDESCR.symbols_ptr], ebx
|
||||||
|
@@:
|
||||||
|
|
||||||
|
mov eax, [esi+DLLDESCR.exports]
|
||||||
|
sub eax, [esi+DLLDESCR.defaultbase]
|
||||||
|
add eax, [img_base]
|
||||||
ret
|
ret
|
||||||
|
.fail_and_free_data:
|
||||||
|
stdcall kernel_free, [esi+DLLDESCR.data]
|
||||||
|
.fail_and_free_dll:
|
||||||
|
mov eax, esi
|
||||||
|
call free
|
||||||
|
.fail_and_free_coff:
|
||||||
|
stdcall kernel_free, [coff]
|
||||||
.fail:
|
.fail:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
.fail_and_free_user:
|
||||||
|
stdcall user_free, [img_base]
|
||||||
|
.fail_and_dereference:
|
||||||
|
mov eax, 1 ; delete 1 reference
|
||||||
|
call dereference_dll
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
; initialize [APPDATA.dlls_list_ptr] for given thread
|
||||||
proc stop_all_services
|
; DLL is per-process object, so APPDATA.dlls_list_ptr must be
|
||||||
|
; kept in sync for all threads of one process.
|
||||||
|
; out: eax = APPDATA.dlls_list_ptr if all is OK,
|
||||||
|
; NULL if memory allocation failed
|
||||||
|
init_dlls_in_thread:
|
||||||
|
mov ebx, [current_slot]
|
||||||
|
mov eax, [ebx+APPDATA.dlls_list_ptr]
|
||||||
|
test eax, eax
|
||||||
|
jnz .ret
|
||||||
|
push [ebx+APPDATA.dir_table]
|
||||||
|
mov eax, 8
|
||||||
|
call malloc
|
||||||
|
pop edx
|
||||||
|
test eax, eax
|
||||||
|
jz .ret
|
||||||
|
mov [eax], eax
|
||||||
|
mov [eax+4], eax
|
||||||
|
mov ecx, [TASK_COUNT]
|
||||||
|
mov ebx, SLOT_BASE+256
|
||||||
|
.set:
|
||||||
|
cmp [ebx+APPDATA.dir_table], edx
|
||||||
|
jnz @f
|
||||||
|
mov [ebx+APPDATA.dlls_list_ptr], eax
|
||||||
|
@@:
|
||||||
|
add ebx, 256
|
||||||
|
dec ecx
|
||||||
|
jnz .set
|
||||||
|
.ret:
|
||||||
|
ret
|
||||||
|
|
||||||
|
; in: eax = number of references to delete, esi -> DLLDESCR struc
|
||||||
|
dereference_dll:
|
||||||
|
sub [esi+DLLDESCR.refcount], eax
|
||||||
|
jnz .ret
|
||||||
|
mov eax, [esi+DLLDESCR.fd]
|
||||||
|
mov edx, [esi+DLLDESCR.bk]
|
||||||
|
mov [eax+DLLDESCR.bk], edx
|
||||||
|
mov [edx+DLLDESCR.fd], eax
|
||||||
|
stdcall kernel_free, [esi+DLLDESCR.coff_hdr]
|
||||||
|
stdcall kernel_free, [esi+DLLDESCR.data]
|
||||||
|
mov eax, esi
|
||||||
|
call free
|
||||||
|
.ret:
|
||||||
|
ret
|
||||||
|
|
||||||
|
destroy_hdll:
|
||||||
|
push ebx ecx esi edi
|
||||||
|
push eax
|
||||||
|
mov ebx, [eax+HDLL.base]
|
||||||
|
mov esi, [eax+HDLL.parent]
|
||||||
|
mov edx, [esi+DLLDESCR.size]
|
||||||
|
; The following actions require the context of application where HDLL is mapped.
|
||||||
|
; However, destroy_hdll can be called in the context of OS thread when
|
||||||
|
; cleaning up objects created by the application which is destroyed.
|
||||||
|
; So remember current cr3 and set it to page table of target.
|
||||||
|
mov eax, [ecx+APPDATA.dir_table]
|
||||||
|
; Because we cheat with cr3, disable interrupts: task switch would restore
|
||||||
|
; page table from APPDATA of current thread.
|
||||||
|
; Also set [current_slot] because it is used by user_free.
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
push [current_slot]
|
||||||
|
mov [current_slot], ecx
|
||||||
|
mov ecx, cr3
|
||||||
|
push ecx
|
||||||
|
mov cr3, eax
|
||||||
|
push ebx ; argument for user_free
|
||||||
|
mov eax, ebx
|
||||||
|
shr ebx, 12
|
||||||
|
push ebx
|
||||||
|
mov esi, [esi+DLLDESCR.data]
|
||||||
|
shr esi, 12
|
||||||
|
.unmap_loop:
|
||||||
|
push eax
|
||||||
|
mov eax, 2
|
||||||
|
xchg eax, [page_tabs+ebx*4]
|
||||||
|
mov ecx, [page_tabs+esi*4]
|
||||||
|
and eax, not 0xFFF
|
||||||
|
and ecx, not 0xFFF
|
||||||
|
cmp eax, ecx
|
||||||
|
jz @f
|
||||||
|
call free_page
|
||||||
|
@@:
|
||||||
|
pop eax
|
||||||
|
invlpg [eax]
|
||||||
|
add eax, 0x1000
|
||||||
|
inc ebx
|
||||||
|
inc esi
|
||||||
|
sub edx, 0x1000
|
||||||
|
ja .unmap_loop
|
||||||
|
pop ebx
|
||||||
|
and dword [page_tabs+(ebx-1)*4], not DONT_FREE_BLOCK
|
||||||
|
call user_free
|
||||||
|
; Restore context.
|
||||||
|
pop eax
|
||||||
|
mov cr3, eax
|
||||||
|
pop [current_slot]
|
||||||
|
popf
|
||||||
|
; Ok, cheating is done.
|
||||||
|
pop eax
|
||||||
|
push eax
|
||||||
|
mov esi, [eax+HDLL.parent]
|
||||||
|
mov eax, [eax+HDLL.refcount]
|
||||||
|
call dereference_dll
|
||||||
|
pop eax
|
||||||
|
mov edx, [eax+HDLL.bk]
|
||||||
|
mov ebx, [eax+HDLL.fd]
|
||||||
|
mov [ebx+HDLL.bk], edx
|
||||||
|
mov [edx+HDLL.fd], ebx
|
||||||
|
call free
|
||||||
|
pop edi esi ecx ebx
|
||||||
|
ret
|
||||||
|
|
||||||
|
; ecx -> APPDATA for slot, esi = dlls_list_ptr
|
||||||
|
destroy_all_hdlls:
|
||||||
|
test esi, esi
|
||||||
|
jz .ret
|
||||||
|
.loop:
|
||||||
|
mov eax, [esi+HDLL.fd]
|
||||||
|
cmp eax, esi
|
||||||
|
jz free
|
||||||
|
call destroy_hdll
|
||||||
|
jmp .loop
|
||||||
|
.ret:
|
||||||
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
stop_all_services:
|
||||||
|
push ebp
|
||||||
mov edx, [srv.fd]
|
mov edx, [srv.fd]
|
||||||
.next:
|
.next:
|
||||||
cmp edx, srv.fd-SRV_FD_OFFSET
|
cmp edx, srv.fd-SRV_FD_OFFSET
|
||||||
je .done
|
je .done
|
||||||
cmp [edx+SRV.magic], ' SRV'
|
cmp [edx+SRV.magic], ' SRV'
|
||||||
jne .next
|
jne .next
|
||||||
cmp [edx+SRV.size], SRV_SIZE
|
cmp [edx+SRV.size], SRV.sizeof
|
||||||
jne .next
|
jne .next
|
||||||
|
|
||||||
mov ebx, [edx+SRV.entry]
|
mov ebx, [edx+SRV.entry]
|
||||||
@@ -1101,12 +1557,16 @@ proc stop_all_services
|
|||||||
jz .next
|
jz .next
|
||||||
|
|
||||||
push edx
|
push edx
|
||||||
stdcall ebx, dword -1
|
mov ebp, esp
|
||||||
|
push 0
|
||||||
|
push -1
|
||||||
|
call ebx
|
||||||
|
mov esp, ebp
|
||||||
pop edx
|
pop edx
|
||||||
jmp .next
|
jmp .next
|
||||||
.done:
|
.done:
|
||||||
|
pop ebp
|
||||||
ret
|
ret
|
||||||
endp
|
|
||||||
|
|
||||||
; param
|
; param
|
||||||
; eax= size
|
; eax= size
|
||||||
|
@@ -60,10 +60,6 @@ iglobal
|
|||||||
szClearEvent db 'ClearEvent',0
|
szClearEvent db 'ClearEvent',0
|
||||||
|
|
||||||
szLoadCursor db 'LoadCursor',0
|
szLoadCursor db 'LoadCursor',0
|
||||||
szSelectHwCursor db 'SelectHwCursor',0
|
|
||||||
szSetHwCursor db 'SetHwCursor',0
|
|
||||||
szHwCursorRestore db 'HwCursorRestore', 0
|
|
||||||
szHwCursorCreate db 'HwCursorCreate', 0
|
|
||||||
|
|
||||||
szSysMsgBoardStr db 'SysMsgBoardStr', 0
|
szSysMsgBoardStr db 'SysMsgBoardStr', 0
|
||||||
szSysMsgBoardChar db 'SysMsgBoardChar', 0
|
szSysMsgBoardChar db 'SysMsgBoardChar', 0
|
||||||
@@ -139,11 +135,6 @@ kernel_export:
|
|||||||
|
|
||||||
dd szLoadCursor , load_cursor ;stdcall
|
dd szLoadCursor , load_cursor ;stdcall
|
||||||
|
|
||||||
dd szSelectHwCursor , select_hw_cursor ;import stdcall
|
|
||||||
dd szSetHwCursor , set_hw_cursor ;import stdcall
|
|
||||||
dd szHwCursorRestore , hw_restore ;import
|
|
||||||
dd szHwCursorCreate , create_cursor ;import
|
|
||||||
|
|
||||||
dd szSysMsgBoardStr , sys_msg_board_str
|
dd szSysMsgBoardStr , sys_msg_board_str
|
||||||
dd szSysMsgBoardChar , sys_msg_board
|
dd szSysMsgBoardChar , sys_msg_board
|
||||||
dd szGetCurrentTask , get_curr_task
|
dd szGetCurrentTask , get_curr_task
|
||||||
|
@@ -13,7 +13,9 @@
|
|||||||
|
|
||||||
$Revision$
|
$Revision$
|
||||||
|
|
||||||
|
if 0
|
||||||
|
; The code currently does not work. Kill "if 0/end if" only after correcting
|
||||||
|
; to current kernel (dll.inc).
|
||||||
macro library [name,fname]
|
macro library [name,fname]
|
||||||
{
|
{
|
||||||
forward
|
forward
|
||||||
@@ -315,3 +317,4 @@ endp
|
|||||||
uglobal
|
uglobal
|
||||||
s_libname db 64 dup (0)
|
s_libname db 64 dup (0)
|
||||||
endg
|
endg
|
||||||
|
end if
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -140,7 +140,7 @@ proc init_kernel_heap
|
|||||||
|
|
||||||
mov ecx, [pg_data.kernel_pages]
|
mov ecx, [pg_data.kernel_pages]
|
||||||
shl ecx, 12
|
shl ecx, 12
|
||||||
sub ecx, HEAP_BASE+4096*MEM_BLOCK_SIZE
|
sub ecx, HEAP_BASE-OS_BASE+4096*MEM_BLOCK_SIZE
|
||||||
mov [heap_size], ecx
|
mov [heap_size], ecx
|
||||||
mov [heap_free], ecx
|
mov [heap_free], ecx
|
||||||
mov [ebx+block_size], ecx
|
mov [ebx+block_size], ecx
|
||||||
@@ -758,6 +758,102 @@ m_exit:
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
align 4
|
||||||
|
proc user_alloc_at stdcall, address:dword, alloc_size:dword
|
||||||
|
|
||||||
|
push ebx
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
|
||||||
|
mov ebx, [current_slot]
|
||||||
|
mov edx, [address]
|
||||||
|
and edx, not 0xFFF
|
||||||
|
mov [address], edx
|
||||||
|
sub edx, 0x1000
|
||||||
|
jb .error
|
||||||
|
mov esi, [ebx+APPDATA.heap_base]
|
||||||
|
mov edi, [ebx+APPDATA.heap_top]
|
||||||
|
cmp edx, esi
|
||||||
|
jb .error
|
||||||
|
.scan:
|
||||||
|
cmp esi, edi
|
||||||
|
jae .error
|
||||||
|
mov ebx, esi
|
||||||
|
shr ebx, 12
|
||||||
|
mov eax, [page_tabs+ebx*4]
|
||||||
|
mov ecx, eax
|
||||||
|
and ecx, 0xFFFFF000
|
||||||
|
add ecx, esi
|
||||||
|
cmp edx, ecx
|
||||||
|
jb .found
|
||||||
|
mov esi, ecx
|
||||||
|
jmp .scan
|
||||||
|
.error:
|
||||||
|
xor eax, eax
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
|
ret
|
||||||
|
.found:
|
||||||
|
test al, FREE_BLOCK
|
||||||
|
jz .error
|
||||||
|
mov eax, ecx
|
||||||
|
sub eax, edx
|
||||||
|
sub eax, 0x1000
|
||||||
|
cmp eax, [alloc_size]
|
||||||
|
jb .error
|
||||||
|
|
||||||
|
; Here we have 1 big free block which includes requested area.
|
||||||
|
; In general, 3 other blocks must be created instead:
|
||||||
|
; free at [esi, edx);
|
||||||
|
; busy at [edx, edx+0x1000+ALIGN_UP(alloc_size,0x1000));
|
||||||
|
; free at [edx+0x1000+ALIGN_UP(alloc_size,0x1000), ecx)
|
||||||
|
; First or third block (or both) may be absent.
|
||||||
|
mov eax, edx
|
||||||
|
sub eax, esi
|
||||||
|
jz .nofirst
|
||||||
|
or al, FREE_BLOCK
|
||||||
|
mov [page_tabs+ebx*4], eax
|
||||||
|
.nofirst:
|
||||||
|
mov eax, [alloc_size]
|
||||||
|
add eax, 0x1FFF
|
||||||
|
and eax, not 0xFFF
|
||||||
|
mov ebx, edx
|
||||||
|
add edx, eax
|
||||||
|
shr ebx, 12
|
||||||
|
or al, USED_BLOCK
|
||||||
|
mov [page_tabs+ebx*4], eax
|
||||||
|
shr eax, 12
|
||||||
|
dec eax
|
||||||
|
jz .second_nofill
|
||||||
|
inc ebx
|
||||||
|
.fill:
|
||||||
|
mov dword [page_tabs+ebx*4], 2
|
||||||
|
inc ebx
|
||||||
|
dec eax
|
||||||
|
jnz .fill
|
||||||
|
.second_nofill:
|
||||||
|
sub ecx, edx
|
||||||
|
jz .nothird
|
||||||
|
or cl, FREE_BLOCK
|
||||||
|
mov [page_tabs+ebx*4], ecx
|
||||||
|
.nothird:
|
||||||
|
|
||||||
|
mov edx, [current_slot]
|
||||||
|
mov ebx, [alloc_size]
|
||||||
|
add ebx, 0xFFF
|
||||||
|
and ebx, not 0xFFF
|
||||||
|
add ebx, [edx+APPDATA.mem_size]
|
||||||
|
call update_mem_size
|
||||||
|
|
||||||
|
mov eax, [address]
|
||||||
|
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc user_free stdcall, base:dword
|
proc user_free stdcall, base:dword
|
||||||
|
|
||||||
@@ -1221,10 +1317,10 @@ proc shmem_open stdcall name:dword, size:dword, access:dword
|
|||||||
and eax, SHM_OPEN_MASK
|
and eax, SHM_OPEN_MASK
|
||||||
mov [action], eax
|
mov [action], eax
|
||||||
|
|
||||||
mov eax, [name]
|
mov ebx, [name]
|
||||||
test eax, eax
|
test ebx, ebx
|
||||||
mov edx, E_PARAM
|
mov edx, E_PARAM
|
||||||
jz .exit
|
jz .fail
|
||||||
|
|
||||||
mov esi, [shmem_list.fd]
|
mov esi, [shmem_list.fd]
|
||||||
align 4
|
align 4
|
||||||
@@ -1233,7 +1329,7 @@ align 4
|
|||||||
je .not_found
|
je .not_found
|
||||||
|
|
||||||
lea edx, [esi+SMEM.name] ; link , base, size
|
lea edx, [esi+SMEM.name] ; link , base, size
|
||||||
stdcall strncmp, edx, eax, 32
|
stdcall strncmp, edx, ebx, 32
|
||||||
test eax, eax
|
test eax, eax
|
||||||
je .found
|
je .found
|
||||||
|
|
||||||
@@ -1245,20 +1341,20 @@ align 4
|
|||||||
|
|
||||||
cmp eax, SHM_OPEN
|
cmp eax, SHM_OPEN
|
||||||
mov edx, E_NOTFOUND
|
mov edx, E_NOTFOUND
|
||||||
je .exit
|
je .fail
|
||||||
|
|
||||||
cmp eax, SHM_CREATE
|
cmp eax, SHM_CREATE
|
||||||
mov edx, E_PARAM
|
mov edx, E_PARAM
|
||||||
je .create_shm
|
je .create_shm
|
||||||
|
|
||||||
cmp eax, SHM_OPEN_ALWAYS
|
cmp eax, SHM_OPEN_ALWAYS
|
||||||
jne .exit
|
jne .fail
|
||||||
|
|
||||||
.create_shm:
|
.create_shm:
|
||||||
|
|
||||||
mov ecx, [size]
|
mov ecx, [size]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .exit
|
jz .fail
|
||||||
|
|
||||||
add ecx, 4095
|
add ecx, 4095
|
||||||
and ecx, -4096
|
and ecx, -4096
|
||||||
@@ -1269,7 +1365,7 @@ align 4
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
mov edx, E_NOMEM
|
mov edx, E_NOMEM
|
||||||
jz .exit
|
jz .fail
|
||||||
|
|
||||||
stdcall kernel_alloc, [size]
|
stdcall kernel_alloc, [size]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@@ -1312,7 +1408,7 @@ align 4
|
|||||||
je .create_map
|
je .create_map
|
||||||
|
|
||||||
cmp eax, SHM_OPEN_ALWAYS
|
cmp eax, SHM_OPEN_ALWAYS
|
||||||
jne .exit
|
jne .fail
|
||||||
|
|
||||||
.create_map:
|
.create_map:
|
||||||
|
|
||||||
@@ -1321,7 +1417,7 @@ align 4
|
|||||||
cmp eax, [esi+SMEM.access]
|
cmp eax, [esi+SMEM.access]
|
||||||
mov [access], eax
|
mov [access], eax
|
||||||
mov edx, E_ACCESS
|
mov edx, E_ACCESS
|
||||||
ja .exit
|
ja .fail
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [CURRENT_TASK]
|
||||||
shl ebx, 5
|
shl ebx, 5
|
||||||
@@ -1332,12 +1428,14 @@ align 4
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov edx, E_NOMEM
|
mov edx, E_NOMEM
|
||||||
jz .exit
|
jz .fail
|
||||||
|
|
||||||
|
inc [esi+SMEM.refcount]
|
||||||
|
|
||||||
mov [edi+SMAP.magic], 'SMAP'
|
mov [edi+SMAP.magic], 'SMAP'
|
||||||
mov [edi+SMAP.destroy], destroy_smap
|
mov [edi+SMAP.destroy], destroy_smap
|
||||||
|
mov [edi+SMAP.parent], esi
|
||||||
mov [edi+SMAP.base], 0
|
mov [edi+SMAP.base], 0
|
||||||
mov [edi+SMAP.parent], 0
|
|
||||||
|
|
||||||
stdcall user_alloc, [esi+SMEM.size]
|
stdcall user_alloc, [esi+SMEM.size]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@@ -1345,9 +1443,7 @@ align 4
|
|||||||
mov edx, E_NOMEM
|
mov edx, E_NOMEM
|
||||||
jz .cleanup2
|
jz .cleanup2
|
||||||
|
|
||||||
lock inc [esi+SMEM.refcount]
|
|
||||||
mov [edi+SMAP.base], eax
|
mov [edi+SMAP.base], eax
|
||||||
mov [edi+SMAP.parent], esi
|
|
||||||
|
|
||||||
mov ecx, [esi+SMEM.size]
|
mov ecx, [esi+SMEM.size]
|
||||||
mov [size], ecx
|
mov [size], ecx
|
||||||
@@ -1374,10 +1470,10 @@ align 4
|
|||||||
xor edx, edx
|
xor edx, edx
|
||||||
|
|
||||||
cmp [owner_access], 0
|
cmp [owner_access], 0
|
||||||
jne .exit
|
jne .fail
|
||||||
|
|
||||||
mov edx, [size]
|
|
||||||
.exit:
|
.exit:
|
||||||
|
mov edx, [size]
|
||||||
|
.fail:
|
||||||
mov eax, [mapped]
|
mov eax, [mapped]
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
@@ -1385,13 +1481,14 @@ align 4
|
|||||||
pop esi
|
pop esi
|
||||||
pop ebx
|
pop ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.cleanup:
|
.cleanup:
|
||||||
|
mov [size], edx
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
call free
|
call free
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.cleanup2:
|
.cleanup2:
|
||||||
|
mov [size], edx
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
call destroy_smap
|
call destroy_smap
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -20,6 +20,7 @@ $Revision$
|
|||||||
; esi= nb
|
; esi= nb
|
||||||
; ebx= idx
|
; ebx= idx
|
||||||
;
|
;
|
||||||
|
align 16
|
||||||
malloc:
|
malloc:
|
||||||
push esi
|
push esi
|
||||||
|
|
||||||
@@ -134,13 +135,17 @@ malloc:
|
|||||||
mov [eax+12], ecx ; r->bk = B;
|
mov [eax+12], ecx ; r->bk = B;
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
pop esi
|
pop esi
|
||||||
|
mov [mst.mutex], 0
|
||||||
ret
|
ret
|
||||||
.small:
|
.small:
|
||||||
|
|
||||||
; if (ms.treemap != 0 && (mem = malloc_small(nb)) != 0)
|
; if (ms.treemap != 0 && (mem = malloc_small(nb)) != 0)
|
||||||
|
;;;;;;;;;;; start a change <lrz>
|
||||||
cmp [mst.treemap], 0
|
mov eax,[mst.treemap]
|
||||||
je .from_top
|
test eax,eax
|
||||||
|
;;;;;;;;;;; end the change <lrz>
|
||||||
|
; cmp [mst.treemap], 0
|
||||||
|
jz .from_top
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
call malloc_small
|
call malloc_small
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@@ -196,7 +201,6 @@ malloc:
|
|||||||
; param
|
; param
|
||||||
; eax= mem
|
; eax= mem
|
||||||
|
|
||||||
align 4
|
|
||||||
free:
|
free:
|
||||||
push edi
|
push edi
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
@@ -246,7 +250,7 @@ free:
|
|||||||
shr ecx, 3
|
shr ecx, 3
|
||||||
cmp eax, edx
|
cmp eax, edx
|
||||||
jne @F
|
jne @F
|
||||||
and [mst.smallmap], ecx
|
btr [mst.smallmap], ecx
|
||||||
@@:
|
@@:
|
||||||
mov [eax+12], edx ;F->bk = B;
|
mov [eax+12], edx ;F->bk = B;
|
||||||
mov [edx+8], eax ;B->fd = F
|
mov [edx+8], eax ;B->fd = F
|
||||||
@@ -383,7 +387,6 @@ free:
|
|||||||
; ecx = chunk
|
; ecx = chunk
|
||||||
; eax = size
|
; eax = size
|
||||||
|
|
||||||
align 4
|
|
||||||
insert_chunk:
|
insert_chunk:
|
||||||
|
|
||||||
cmp eax, 256
|
cmp eax, 256
|
||||||
@@ -416,13 +419,11 @@ insert_chunk:
|
|||||||
and [mst.mutex], 0
|
and [mst.mutex], 0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
|
||||||
|
|
||||||
; param
|
; param
|
||||||
; esi= chunk
|
; esi= chunk
|
||||||
; ebx= size
|
; ebx= size
|
||||||
|
|
||||||
align 4
|
|
||||||
insert_large_chunk:
|
insert_large_chunk:
|
||||||
|
|
||||||
; I = compute_tree_index(S);
|
; I = compute_tree_index(S);
|
||||||
@@ -475,7 +476,6 @@ insert_large_chunk:
|
|||||||
shl eax, cl ;eax= K
|
shl eax, cl ;eax= K
|
||||||
|
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
|
||||||
.not_eq_size:
|
.not_eq_size:
|
||||||
|
|
||||||
; C = &(T->child[(K >> 31) & 1]);
|
; C = &(T->child[(K >> 31) & 1]);
|
||||||
@@ -517,7 +517,6 @@ insert_large_chunk:
|
|||||||
mov [esi+8], eax
|
mov [esi+8], eax
|
||||||
mov [esi+12], edx
|
mov [esi+12], edx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.insert_child:
|
.insert_child:
|
||||||
|
|
||||||
; *C = X;
|
; *C = X;
|
||||||
@@ -536,7 +535,6 @@ insert_large_chunk:
|
|||||||
; param
|
; param
|
||||||
; edx= chunk
|
; edx= chunk
|
||||||
|
|
||||||
align 4
|
|
||||||
unlink_large_chunk:
|
unlink_large_chunk:
|
||||||
|
|
||||||
mov eax, [edx+12]
|
mov eax, [edx+12]
|
||||||
@@ -593,17 +591,21 @@ unlink_large_chunk:
|
|||||||
btr [mst.treemap], ecx
|
btr [mst.treemap], ecx
|
||||||
pop edi
|
pop edi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.l3:
|
.l3:
|
||||||
cmp [edi+16], edx
|
cmp [edi+16], edx
|
||||||
jne @F
|
jne @F
|
||||||
|
|
||||||
mov [edi+16], eax
|
mov [edi+16], eax
|
||||||
jmp .l4
|
jmp .l4
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov [edi+20], eax
|
mov [edi+20], eax
|
||||||
|
|
||||||
.l4:
|
.l4:
|
||||||
test eax, eax
|
test eax, eax
|
||||||
je .done
|
je .done
|
||||||
|
|
||||||
.l5:
|
.l5:
|
||||||
mov [eax+24], edi
|
mov [eax+24], edi
|
||||||
mov ecx, [edx+16]
|
mov ecx, [edx+16]
|
||||||
@@ -612,6 +614,7 @@ unlink_large_chunk:
|
|||||||
|
|
||||||
mov [eax+16], ecx
|
mov [eax+16], ecx
|
||||||
mov [ecx+24], eax
|
mov [ecx+24], eax
|
||||||
|
|
||||||
.l6:
|
.l6:
|
||||||
mov edx, [edx+20]
|
mov edx, [edx+20]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
@@ -619,6 +622,7 @@ unlink_large_chunk:
|
|||||||
|
|
||||||
mov [eax+20], edx
|
mov [eax+20], edx
|
||||||
mov [edx+24], eax
|
mov [edx+24], eax
|
||||||
|
|
||||||
.done:
|
.done:
|
||||||
pop edi
|
pop edi
|
||||||
ret
|
ret
|
||||||
@@ -626,7 +630,6 @@ unlink_large_chunk:
|
|||||||
; param
|
; param
|
||||||
; esi= nb
|
; esi= nb
|
||||||
|
|
||||||
align 4
|
|
||||||
malloc_small:
|
malloc_small:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esi
|
mov ebp, esi
|
||||||
@@ -641,8 +644,10 @@ malloc_small:
|
|||||||
mov edi, [ecx+4]
|
mov edi, [ecx+4]
|
||||||
and edi, -4
|
and edi, -4
|
||||||
sub edi, esi
|
sub edi, esi
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
|
|
||||||
.loop_1:
|
.loop_1:
|
||||||
|
|
||||||
; while ((t = leftmost_child(t)) != 0)
|
; while ((t = leftmost_child(t)) != 0)
|
||||||
@@ -652,8 +657,10 @@ malloc_small:
|
|||||||
jz @F
|
jz @F
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
jmp .l1
|
jmp .l1
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov ecx, [ecx+20]
|
mov ecx, [ecx+20]
|
||||||
|
|
||||||
.l1:
|
.l1:
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .unlink
|
jz .unlink
|
||||||
@@ -704,6 +711,7 @@ malloc_small:
|
|||||||
|
|
||||||
lea eax, [ebx+8]
|
lea eax, [ebx+8]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.split:
|
.split:
|
||||||
|
|
||||||
; v->head = nb|PINUSE_BIT|CINUSE_BIT;
|
; v->head = nb|PINUSE_BIT|CINUSE_BIT;
|
||||||
@@ -736,6 +744,7 @@ malloc_small:
|
|||||||
pop ebp
|
pop ebp
|
||||||
lea eax, [ebx+8]
|
lea eax, [ebx+8]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.large:
|
.large:
|
||||||
lea eax, [ebx+8]
|
lea eax, [ebx+8]
|
||||||
push eax
|
push eax
|
||||||
@@ -750,12 +759,12 @@ malloc_small:
|
|||||||
; param
|
; param
|
||||||
; esi= nb
|
; esi= nb
|
||||||
|
|
||||||
align 4
|
|
||||||
malloc_large:
|
malloc_large:
|
||||||
.idx equ esp+4
|
.idx equ esp+4
|
||||||
.rst equ esp
|
.rst equ esp
|
||||||
|
|
||||||
push ebp
|
push ebp
|
||||||
|
push esi
|
||||||
push edi
|
push edi
|
||||||
sub esp, 8
|
sub esp, 8
|
||||||
; v = 0;
|
; v = 0;
|
||||||
@@ -789,17 +798,20 @@ malloc_large:
|
|||||||
jne @F
|
jne @F
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
jmp .l1
|
jmp .l1
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
shr edx, 1
|
shr edx, 1
|
||||||
mov ecx, 37
|
mov ecx, 37
|
||||||
sub ecx, edx
|
sub ecx, edx
|
||||||
|
|
||||||
.l1:
|
.l1:
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
shl edx, cl
|
shl edx, cl
|
||||||
|
|
||||||
; rst = 0;
|
; rst = 0;
|
||||||
mov [.rst], ebp
|
mov [.rst], ebp
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
|
|
||||||
; trem = (t->head & ~INUSE_BITS) - nb;
|
; trem = (t->head & ~INUSE_BITS) - nb;
|
||||||
@@ -819,6 +831,7 @@ malloc_large:
|
|||||||
mov ebp, eax
|
mov ebp, eax
|
||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
je .l2
|
je .l2
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
; rt = t->child[1];
|
; rt = t->child[1];
|
||||||
@@ -840,6 +853,7 @@ malloc_large:
|
|||||||
|
|
||||||
; rst = rt;
|
; rst = rt;
|
||||||
mov [.rst], ecx
|
mov [.rst], ecx
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
; if (t == 0)
|
; if (t == 0)
|
||||||
|
|
||||||
@@ -850,9 +864,11 @@ malloc_large:
|
|||||||
|
|
||||||
add edx, edx
|
add edx, edx
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
; t = rst;
|
; t = rst;
|
||||||
mov eax, [.rst]
|
mov eax, [.rst]
|
||||||
|
|
||||||
.l2:
|
.l2:
|
||||||
; if (t == 0 && v == 0)
|
; if (t == 0 && v == 0)
|
||||||
|
|
||||||
@@ -861,6 +877,7 @@ malloc_large:
|
|||||||
test ebp, ebp
|
test ebp, ebp
|
||||||
jne .l7
|
jne .l7
|
||||||
mov ecx, [.idx]
|
mov ecx, [.idx]
|
||||||
|
|
||||||
.l3:
|
.l3:
|
||||||
|
|
||||||
; leftbits = (-1<<idx) & ms.treemap;
|
; leftbits = (-1<<idx) & ms.treemap;
|
||||||
@@ -874,11 +891,13 @@ malloc_large:
|
|||||||
bsf eax, edx
|
bsf eax, edx
|
||||||
; t = ms.treebins[i];
|
; t = ms.treebins[i];
|
||||||
mov eax, [mst.treebins+eax*4]
|
mov eax, [mst.treebins+eax*4]
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
; while (t != 0)
|
; while (t != 0)
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .l5
|
jz .l5
|
||||||
|
|
||||||
.l4:
|
.l4:
|
||||||
|
|
||||||
; trem = (t->head & ~INUSE_BITS) - nb;
|
; trem = (t->head & ~INUSE_BITS) - nb;
|
||||||
@@ -896,6 +915,7 @@ malloc_large:
|
|||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
; v = t;
|
; v = t;
|
||||||
mov ebp, eax
|
mov ebp, eax
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
; t = leftmost_child(t);
|
; t = leftmost_child(t);
|
||||||
@@ -905,20 +925,24 @@ malloc_large:
|
|||||||
je @F
|
je @F
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
jmp .l6
|
jmp .l6
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov eax, [eax+20]
|
mov eax, [eax+20]
|
||||||
|
|
||||||
.l6:
|
.l6:
|
||||||
|
|
||||||
; while (t != 0)
|
; while (t != 0)
|
||||||
|
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jne .l4
|
jne .l4
|
||||||
|
|
||||||
.l5:
|
.l5:
|
||||||
|
|
||||||
; if (v != 0)
|
; if (v != 0)
|
||||||
|
|
||||||
test ebp, ebp
|
test ebp, ebp
|
||||||
jz .done
|
jz .done
|
||||||
|
|
||||||
.l7:
|
.l7:
|
||||||
|
|
||||||
; r = chunk_plus_offset((mchunkptr)v, nb);
|
; r = chunk_plus_offset((mchunkptr)v, nb);
|
||||||
@@ -947,8 +971,10 @@ malloc_large:
|
|||||||
lea eax, [ebp+8]
|
lea eax, [ebp+8]
|
||||||
add esp, 8
|
add esp, 8
|
||||||
pop edi
|
pop edi
|
||||||
|
pop esi
|
||||||
pop ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.large:
|
.large:
|
||||||
|
|
||||||
; v->head = nb|PINUSE_BIT|CINUSE_BIT;
|
; v->head = nb|PINUSE_BIT|CINUSE_BIT;
|
||||||
@@ -971,16 +997,18 @@ malloc_large:
|
|||||||
lea eax, [ebp+8]
|
lea eax, [ebp+8]
|
||||||
add esp, 8
|
add esp, 8
|
||||||
pop edi
|
pop edi
|
||||||
|
pop esi
|
||||||
pop ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.done:
|
.done:
|
||||||
add esp, 8
|
add esp, 8
|
||||||
pop edi
|
pop edi
|
||||||
|
pop esi
|
||||||
pop ebp
|
pop ebp
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
|
||||||
init_malloc:
|
init_malloc:
|
||||||
|
|
||||||
stdcall kernel_alloc, 0x40000
|
stdcall kernel_alloc, 0x40000
|
||||||
@@ -989,6 +1017,7 @@ init_malloc:
|
|||||||
mov [mst.topsize], 128*1024
|
mov [mst.topsize], 128*1024
|
||||||
mov dword [eax+4], (128*1024) or 1
|
mov dword [eax+4], (128*1024) or 1
|
||||||
mov eax, mst.smallbins
|
mov eax, mst.smallbins
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov [eax+8], eax
|
mov [eax+8], eax
|
||||||
mov [eax+12], eax
|
mov [eax+12], eax
|
||||||
@@ -998,6 +1027,3 @@ init_malloc:
|
|||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -167,7 +167,7 @@ proc map_io_mem stdcall, base:dword, size:dword, flags:dword
|
|||||||
@@:
|
@@:
|
||||||
mov [page_tabs+eax*4], edx
|
mov [page_tabs+eax*4], edx
|
||||||
; push eax
|
; push eax
|
||||||
; invlpg [ebx]
|
invlpg [ebx]
|
||||||
; pop eax
|
; pop eax
|
||||||
inc eax
|
inc eax
|
||||||
add ebx, edi
|
add ebx, edi
|
||||||
@@ -205,7 +205,7 @@ commit_pages:
|
|||||||
@@:
|
@@:
|
||||||
mov [page_tabs+ebx*4], eax
|
mov [page_tabs+ebx*4], eax
|
||||||
; push eax
|
; push eax
|
||||||
; invlpg [edi]
|
invlpg [edi]
|
||||||
; pop eax
|
; pop eax
|
||||||
add edi, edx
|
add edi, edx
|
||||||
add eax, edx
|
add eax, edx
|
||||||
@@ -321,8 +321,17 @@ proc init_LFB
|
|||||||
cmp dword [LFBAddress], -1
|
cmp dword [LFBAddress], -1
|
||||||
jne @f
|
jne @f
|
||||||
mov [BOOT_VAR+0x901c],byte 2
|
mov [BOOT_VAR+0x901c],byte 2
|
||||||
stdcall kernel_alloc, 0x280000
|
stdcall alloc_pages, (0x280000 / 4096)
|
||||||
mov [LFBAddress], eax
|
|
||||||
|
push eax
|
||||||
|
call alloc_page
|
||||||
|
stdcall map_page_table, LFB_BASE, eax
|
||||||
|
pop eax
|
||||||
|
or eax, PG_UW
|
||||||
|
mov ebx, LFB_BASE
|
||||||
|
mov ecx, 0x280000 / 4096
|
||||||
|
call commit_pages
|
||||||
|
mov [LFBAddress], dword LFB_BASE
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
test [SCR_MODE],word 0100000000000000b
|
test [SCR_MODE],word 0100000000000000b
|
||||||
@@ -334,7 +343,7 @@ proc init_LFB
|
|||||||
|
|
||||||
mov edx, LFB_BASE
|
mov edx, LFB_BASE
|
||||||
mov esi, [LFBAddress]
|
mov esi, [LFBAddress]
|
||||||
mov edi, 0x00800000
|
mov edi, 0x00C00000
|
||||||
mov dword [exp_lfb+4], edx
|
mov dword [exp_lfb+4], edx
|
||||||
|
|
||||||
shr edi, 12
|
shr edi, 12
|
||||||
@@ -558,14 +567,6 @@ proc page_fault_handler
|
|||||||
push ebx ;that is locals: .err_addr = cr2
|
push ebx ;that is locals: .err_addr = cr2
|
||||||
inc [pg_data.pages_faults]
|
inc [pg_data.pages_faults]
|
||||||
|
|
||||||
; push eax
|
|
||||||
; push edx
|
|
||||||
; mov edx, 0x400 ;bochs
|
|
||||||
; mov al,0xff ;bochs
|
|
||||||
; out dx, al ;bochs
|
|
||||||
; pop edx
|
|
||||||
; pop eax
|
|
||||||
|
|
||||||
mov eax, [pf_err_code]
|
mov eax, [pf_err_code]
|
||||||
|
|
||||||
cmp ebx, OS_BASE ;ebx == .err_addr
|
cmp ebx, OS_BASE ;ebx == .err_addr
|
||||||
@@ -592,6 +593,11 @@ end if
|
|||||||
pop ebx ;restore exception number (#PF)
|
pop ebx ;restore exception number (#PF)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; xchg bx, bx
|
||||||
|
; add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller
|
||||||
|
; restore_ring3_context
|
||||||
|
; iretd
|
||||||
|
|
||||||
.user_space:
|
.user_space:
|
||||||
test eax, PG_MAP
|
test eax, PG_MAP
|
||||||
jnz .err_access ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
jnz .err_access ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -614,7 +620,7 @@ end if
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
stdcall map_page,[.err_addr],eax,dword PG_UW
|
stdcall map_page,[.err_addr],eax,PG_UW
|
||||||
|
|
||||||
mov edi, [.err_addr]
|
mov edi, [.err_addr]
|
||||||
and edi, 0xFFFFF000
|
and edi, 0xFFFFF000
|
||||||
@@ -627,9 +633,40 @@ end if
|
|||||||
restore_ring3_context
|
restore_ring3_context
|
||||||
iretd
|
iretd
|
||||||
|
|
||||||
.err_access = .fail
|
.err_access:
|
||||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; access denied? this may be a result of copy-on-write protection for DLL
|
||||||
;jmp .fail
|
; check list of HDLLs
|
||||||
|
and ebx, not 0xFFF
|
||||||
|
mov eax, [CURRENT_TASK]
|
||||||
|
shl eax, 8
|
||||||
|
mov eax, [SLOT_BASE+eax+APPDATA.dlls_list_ptr]
|
||||||
|
test eax, eax
|
||||||
|
jz .fail
|
||||||
|
mov esi, [eax+HDLL.fd]
|
||||||
|
.scan_hdll:
|
||||||
|
cmp esi, eax
|
||||||
|
jz .fail
|
||||||
|
mov edx, ebx
|
||||||
|
sub edx, [esi+HDLL.base]
|
||||||
|
cmp edx, [esi+HDLL.size]
|
||||||
|
jb .fault_in_hdll
|
||||||
|
.scan_hdll.next:
|
||||||
|
mov esi, [esi+HDLL.fd]
|
||||||
|
jmp .scan_hdll
|
||||||
|
.fault_in_hdll:
|
||||||
|
; allocate new page, map it as rw and copy data
|
||||||
|
call alloc_page
|
||||||
|
test eax, eax
|
||||||
|
jz .fail
|
||||||
|
stdcall map_page,ebx,eax,PG_UW
|
||||||
|
mov edi, ebx
|
||||||
|
mov ecx, 1024
|
||||||
|
sub ebx, [esi+HDLL.base]
|
||||||
|
mov esi, [esi+HDLL.parent]
|
||||||
|
mov esi, [esi+DLLDESCR.data]
|
||||||
|
add esi, ebx
|
||||||
|
rep movsd
|
||||||
|
jmp .exit
|
||||||
|
|
||||||
.kernel_space:
|
.kernel_space:
|
||||||
test eax, PG_MAP
|
test eax, PG_MAP
|
||||||
@@ -677,14 +714,17 @@ end if
|
|||||||
jmp .exit
|
jmp .exit
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
; returns number of mapped bytes
|
||||||
proc map_mem stdcall, lin_addr:dword,pdir:dword,\
|
proc map_mem stdcall, lin_addr:dword,slot:dword,\
|
||||||
ofs:dword,buf_size:dword
|
ofs:dword,buf_size:dword,req_access:dword
|
||||||
mov eax, [buf_size]
|
push 0 ; initialize number of mapped bytes
|
||||||
test eax, eax
|
|
||||||
|
cmp [buf_size], 0
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
mov eax, [pdir]
|
mov eax, [slot]
|
||||||
|
shl eax, 8
|
||||||
|
mov eax, [SLOT_BASE+eax+APPDATA.dir_table]
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
|
|
||||||
stdcall map_page,[ipc_pdir],eax,PG_UW
|
stdcall map_page,[ipc_pdir],eax,PG_UW
|
||||||
@@ -716,10 +756,11 @@ proc map_mem stdcall, lin_addr:dword,pdir:dword,\
|
|||||||
and edx, 0x3FF
|
and edx, 0x3FF
|
||||||
mov esi, [ipc_ptab]
|
mov esi, [ipc_ptab]
|
||||||
|
|
||||||
.map: mov eax, [esi+edx*4]
|
.map:
|
||||||
and eax, 0xFFFFF000
|
stdcall safe_map_page,[slot],[req_access],[ofs]
|
||||||
jz .exit
|
jnc .exit
|
||||||
stdcall map_page,edi,eax,PG_UW
|
add dword [ebp-4], 4096
|
||||||
|
add [ofs], 4096
|
||||||
dec ecx
|
dec ecx
|
||||||
jz .exit
|
jz .exit
|
||||||
add edi, 0x1000
|
add edi, 0x1000
|
||||||
@@ -736,20 +777,23 @@ proc map_mem stdcall, lin_addr:dword,pdir:dword,\
|
|||||||
jmp .map
|
jmp .map
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
|
pop eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
proc map_memEx stdcall, lin_addr:dword,slot:dword,\
|
||||||
proc map_memEx stdcall, lin_addr:dword,pdir:dword,\
|
ofs:dword,buf_size:dword,req_access:dword
|
||||||
ofs:dword,buf_size:dword
|
push 0 ; initialize number of mapped bytes
|
||||||
mov eax, [buf_size]
|
|
||||||
test eax, eax
|
cmp [buf_size], 0
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
mov eax, [pdir]
|
mov eax, [slot]
|
||||||
|
shl eax, 8
|
||||||
|
mov eax, [SLOT_BASE+eax+APPDATA.dir_table]
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
|
|
||||||
stdcall map_page,[proc_mem_pdir],eax,dword PG_UW
|
stdcall map_page,[proc_mem_pdir],eax,PG_UW
|
||||||
mov ebx, [ofs]
|
mov ebx, [ofs]
|
||||||
shr ebx, 22
|
shr ebx, 22
|
||||||
mov esi, [proc_mem_pdir]
|
mov esi, [proc_mem_pdir]
|
||||||
@@ -758,7 +802,7 @@ proc map_memEx stdcall, lin_addr:dword,pdir:dword,\
|
|||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .exit
|
jz .exit
|
||||||
stdcall map_page,edi,eax,dword PG_UW
|
stdcall map_page,edi,eax,PG_UW
|
||||||
|
|
||||||
@@: mov edi, [lin_addr]
|
@@: mov edi, [lin_addr]
|
||||||
and edi, 0xFFFFF000
|
and edi, 0xFFFFF000
|
||||||
@@ -772,21 +816,101 @@ proc map_memEx stdcall, lin_addr:dword,pdir:dword,\
|
|||||||
and edx, 0x3FF
|
and edx, 0x3FF
|
||||||
mov esi, [proc_mem_tab]
|
mov esi, [proc_mem_tab]
|
||||||
|
|
||||||
.map: mov eax, [esi+edx*4]
|
.map:
|
||||||
; and eax, 0xFFFFF000
|
stdcall safe_map_page,[slot],[req_access],[ofs]
|
||||||
; test eax, eax
|
jnc .exit
|
||||||
; jz .exit
|
add dword [ebp-4], 0x1000
|
||||||
stdcall map_page,edi,eax,dword PG_UW
|
|
||||||
add edi, 0x1000
|
add edi, 0x1000
|
||||||
|
add [ofs], 0x1000
|
||||||
inc edx
|
inc edx
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .map
|
jnz .map
|
||||||
.exit:
|
.exit:
|
||||||
|
pop eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
; in: esi+edx*4 = pointer to page table entry
|
||||||
|
; in: [slot], [req_access], [ofs] on the stack
|
||||||
|
; in: edi = linear address to map
|
||||||
|
; out: CF cleared <=> failed
|
||||||
|
; destroys: only eax
|
||||||
|
proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
||||||
|
mov eax, [esi+edx*4]
|
||||||
|
test al, PG_MAP
|
||||||
|
jz .not_present
|
||||||
|
test al, PG_WRITE
|
||||||
|
jz .resolve_readonly
|
||||||
|
; normal case: writable page, just map with requested access
|
||||||
|
.map:
|
||||||
|
stdcall map_page, edi, eax, [req_access]
|
||||||
|
stc
|
||||||
|
.fail:
|
||||||
|
ret
|
||||||
|
.not_present:
|
||||||
|
; check for alloc-on-demand page
|
||||||
|
test al, 2
|
||||||
|
jz .fail
|
||||||
|
; allocate new page, save it to source page table
|
||||||
|
push ecx
|
||||||
|
call alloc_page
|
||||||
|
pop ecx
|
||||||
|
test eax, eax
|
||||||
|
jz .fail
|
||||||
|
or al, PG_UW
|
||||||
|
mov [esi+edx*4], eax
|
||||||
|
jmp .map
|
||||||
|
.resolve_readonly:
|
||||||
|
; readonly page, probably copy-on-write
|
||||||
|
; check: readonly request of readonly page is ok
|
||||||
|
test [req_access], PG_WRITE
|
||||||
|
jz .map
|
||||||
|
; find control structure for this page
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
cld
|
||||||
|
push ebx ecx
|
||||||
|
mov eax, [slot]
|
||||||
|
shl eax, 8
|
||||||
|
mov eax, [SLOT_BASE+eax+APPDATA.dlls_list_ptr]
|
||||||
|
test eax, eax
|
||||||
|
jz .no_hdll
|
||||||
|
mov ecx, [eax+HDLL.fd]
|
||||||
|
.scan_hdll:
|
||||||
|
cmp ecx, eax
|
||||||
|
jz .no_hdll
|
||||||
|
mov ebx, [ofs]
|
||||||
|
and ebx, not 0xFFF
|
||||||
|
sub ebx, [ecx+HDLL.base]
|
||||||
|
cmp ebx, [ecx+HDLL.size]
|
||||||
|
jb .hdll_found
|
||||||
|
mov ecx, [ecx+HDLL.fd]
|
||||||
|
jmp .scan_hdll
|
||||||
|
.no_hdll:
|
||||||
|
pop ecx ebx
|
||||||
|
popf
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
.hdll_found:
|
||||||
|
; allocate page, save it in page table, map it, copy contents from base
|
||||||
|
mov eax, [ecx+HDLL.parent]
|
||||||
|
add ebx, [eax+DLLDESCR.data]
|
||||||
|
call alloc_page
|
||||||
|
test eax, eax
|
||||||
|
jz .no_hdll
|
||||||
|
or al, PG_UW
|
||||||
|
mov [esi+edx*4], eax
|
||||||
|
stdcall map_page, edi, eax, [req_access]
|
||||||
|
push esi edi
|
||||||
|
mov esi, ebx
|
||||||
|
mov ecx, 4096/4
|
||||||
|
rep movsd
|
||||||
|
pop edi esi
|
||||||
|
pop ecx ebx
|
||||||
|
popf
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
sys_IPC:
|
sys_IPC:
|
||||||
;input:
|
;input:
|
||||||
@@ -870,15 +994,15 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
|||||||
mov ecx, [ipc_tmp]
|
mov ecx, [ipc_tmp]
|
||||||
cmp esi, 0x40000-0x1000 ; size of [ipc_tmp] minus one page
|
cmp esi, 0x40000-0x1000 ; size of [ipc_tmp] minus one page
|
||||||
jbe @f
|
jbe @f
|
||||||
push eax esi edi
|
push esi edi
|
||||||
add esi,0x1000
|
add esi,0x1000
|
||||||
stdcall alloc_kernel_space,esi
|
stdcall alloc_kernel_space,esi
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
pop edi esi eax
|
pop edi esi
|
||||||
@@:
|
@@:
|
||||||
mov [used_buf], ecx
|
mov [used_buf], ecx
|
||||||
stdcall map_mem, ecx, [SLOT_BASE+eax+0xB8],\
|
stdcall map_mem, ecx, [dst_slot],\
|
||||||
edi, esi
|
edi, esi, PG_SW
|
||||||
|
|
||||||
mov edi, [dst_offset]
|
mov edi, [dst_offset]
|
||||||
add edi, [used_buf]
|
add edi, [used_buf]
|
||||||
@@ -986,137 +1110,144 @@ sysfn_meminfo:
|
|||||||
mov [ecx+24], eax
|
mov [ecx+24], eax
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
mov dword [esp+32], -1
|
or dword [esp+32], -1
|
||||||
ret
|
ret
|
||||||
|
iglobal
|
||||||
align 4
|
align 4
|
||||||
f68call:
|
f68call:
|
||||||
dd f68.11
|
dd f68.11 ; init_heap
|
||||||
dd f68.12
|
dd f68.12 ; user_alloc
|
||||||
dd f68.13
|
dd f68.13 ; user_free
|
||||||
dd f68.14
|
dd f68.14 ; get_event_ex
|
||||||
dd f68.fail ;moved to f68.24
|
dd f68.fail ;moved to f68.24
|
||||||
dd f68.16
|
dd f68.16 ; get_service
|
||||||
dd f68.17
|
dd f68.17 ; call_service
|
||||||
dd f68.fail ;moved to f68.25
|
dd f68.fail ;moved to f68.25
|
||||||
dd f68.19
|
dd f68.19 ; load_dll
|
||||||
dd f68.20
|
dd f68.20 ; user_realloc
|
||||||
dd f68.21
|
dd f68.21 ; load_driver
|
||||||
dd f68.22
|
dd f68.22 ; shmem_open
|
||||||
dd f68.23
|
dd f68.23 ; shmem_close
|
||||||
dd f68.24
|
dd f68.24
|
||||||
dd f68.25
|
dd f68.25
|
||||||
|
endg
|
||||||
align 4
|
align 4
|
||||||
f68:
|
f68:
|
||||||
cmp eax,4
|
cmp ebx,4
|
||||||
jle sys_sheduler
|
jbe sys_sheduler
|
||||||
|
|
||||||
cmp eax, 11
|
cmp ebx, 11
|
||||||
jb .fail
|
jb .fail
|
||||||
|
|
||||||
cmp eax, 25
|
cmp ebx, 25
|
||||||
ja .fail
|
ja .fail
|
||||||
|
|
||||||
jmp dword [f68call+eax*4-11*4]
|
jmp dword [f68call+ebx*4-11*4]
|
||||||
.11:
|
.11:
|
||||||
call init_heap
|
call init_heap
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.12:
|
.12:
|
||||||
stdcall user_alloc, ebx
|
stdcall user_alloc, ecx
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.13:
|
.13:
|
||||||
stdcall user_free, ebx
|
stdcall user_free, ecx
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.14:
|
.14:
|
||||||
cmp ebx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
mov edi,ebx
|
mov edi,ecx
|
||||||
call get_event_ex
|
call get_event_ex
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
|
||||||
.24:
|
|
||||||
mov eax, [current_slot]
|
|
||||||
xchg ebx, [eax+APPDATA.exc_handler]
|
|
||||||
xchg ecx, [eax+APPDATA.except_mask]
|
|
||||||
mov [esp+36], ebx ; reg_eax+8
|
|
||||||
mov [esp+24], ecx ; reg_ebx+8
|
|
||||||
ret
|
ret
|
||||||
.16:
|
.16:
|
||||||
test ebx, ebx
|
test ecx, ecx
|
||||||
jz .fail
|
jz .fail
|
||||||
cmp ebx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall get_service, ebx
|
stdcall get_service, ecx
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.17:
|
.17:
|
||||||
call srv_handlerEx ;ebx
|
call srv_handlerEx ;ecx
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.25:
|
|
||||||
cmp ebx,32
|
|
||||||
jae .fail
|
|
||||||
mov eax, [current_slot]
|
|
||||||
btr [eax+APPDATA.except_mask],ebx
|
|
||||||
setc byte[esp+36]
|
|
||||||
jecxz @f
|
|
||||||
bts [eax+APPDATA.except_mask],ebx
|
|
||||||
@@: ret
|
|
||||||
.19:
|
.19:
|
||||||
cmp ebx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall load_library, ebx
|
stdcall load_library, ecx
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.20:
|
.20:
|
||||||
mov eax, ecx
|
mov eax, edx
|
||||||
call user_realloc
|
mov ebx, ecx
|
||||||
mov [esp+36], eax
|
call user_realloc ;in: eax = pointer, ebx = new size
|
||||||
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.21:
|
.21:
|
||||||
|
cmp ecx, OS_BASE
|
||||||
|
jae .fail
|
||||||
|
|
||||||
cmp ebx, OS_BASE
|
cmp ebx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
stdcall load_PE, ebx
|
mov edi, edx
|
||||||
|
stdcall load_PE, ecx
|
||||||
|
mov esi, eax
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
|
|
||||||
mov esi, eax
|
push edi
|
||||||
stdcall eax, DRV_ENTRY
|
push DRV_ENTRY
|
||||||
|
call eax
|
||||||
|
add esp, 8
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
|
|
||||||
mov [eax+SRV.entry], esi
|
mov [eax+SRV.entry], esi
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
.22:
|
.22:
|
||||||
cmp ebx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
stdcall shmem_open, ebx, ecx, edx
|
stdcall shmem_open, ecx, edx, esi
|
||||||
mov [esp+28], edx
|
mov [esp+24], edx
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.23:
|
.23:
|
||||||
cmp ebx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
stdcall shmem_close, ebx
|
stdcall shmem_close, ecx
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
|
ret
|
||||||
|
.24:
|
||||||
|
mov eax, [current_slot]
|
||||||
|
xchg ecx, [eax+APPDATA.exc_handler]
|
||||||
|
xchg edx, [eax+APPDATA.except_mask]
|
||||||
|
mov [esp+32], ecx ; reg_eax+8
|
||||||
|
mov [esp+20], edx ; reg_ebx+8
|
||||||
|
ret
|
||||||
|
.25:
|
||||||
|
cmp ecx,32
|
||||||
|
jae .fail
|
||||||
|
mov eax, [current_slot]
|
||||||
|
btr [eax+APPDATA.except_mask],ecx
|
||||||
|
setc byte[esp+32]
|
||||||
|
jecxz @f
|
||||||
|
bts [eax+APPDATA.except_mask],ecx
|
||||||
|
@@:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [esp+36], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -1156,41 +1287,52 @@ proc init_mtrr
|
|||||||
|
|
||||||
mov ecx, 0x2FF
|
mov ecx, 0x2FF
|
||||||
rdmsr ;
|
rdmsr ;
|
||||||
|
; has BIOS already initialized MTRRs?
|
||||||
|
test ah, 8
|
||||||
|
jnz .skip_init
|
||||||
|
; rarely needed, so mainly placeholder
|
||||||
|
; main memory - cached
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
xor edx, edx
|
|
||||||
xor eax, eax
|
|
||||||
mov ecx, 0x2FF
|
|
||||||
wrmsr ;disable all MTRR
|
|
||||||
|
|
||||||
mov eax, [MEM_AMOUNT]
|
mov eax, [MEM_AMOUNT]
|
||||||
; round eax up to next power of 2
|
; round eax up to next power of 2
|
||||||
dec eax
|
dec eax
|
||||||
bsr ecx, eax
|
bsr ecx, eax
|
||||||
mov eax, 2
|
mov ebx, 2
|
||||||
shl eax, cl
|
shl ebx, cl
|
||||||
stdcall set_mtrr, edx,edx,eax,MEM_WB
|
dec ebx
|
||||||
stdcall set_mtrr, 1,[LFBAddress],[LFBSize],MEM_WC
|
; base of memory range = 0, type of memory range = MEM_WB
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
xor eax, eax
|
mov eax, MEM_WB
|
||||||
mov ecx, 0x204
|
mov ecx, 0x200
|
||||||
mov ebx, 6
|
wrmsr
|
||||||
@@:
|
; mask of memory range = 0xFFFFFFFFF - (size - 1), ebx = size - 1
|
||||||
wrmsr ;disable unused MTRR
|
mov eax, 0xFFFFFFFF
|
||||||
|
mov edx, 0x0000000F
|
||||||
|
sub eax, ebx
|
||||||
|
sbb edx, 0
|
||||||
|
or eax, 0x800
|
||||||
inc ecx
|
inc ecx
|
||||||
wrmsr
|
wrmsr
|
||||||
|
; clear unused MTRRs
|
||||||
|
xor eax, eax
|
||||||
|
xor edx, edx
|
||||||
|
@@:
|
||||||
|
wrmsr
|
||||||
inc ecx
|
inc ecx
|
||||||
dec ebx
|
cmp ecx, 0x210
|
||||||
jnz @b
|
jb @b
|
||||||
|
; enable MTRRs
|
||||||
|
pop eax
|
||||||
|
or ah, 8
|
||||||
|
and al, 0xF0 ; default memtype = UC
|
||||||
|
mov ecx, 0x2FF
|
||||||
|
wrmsr
|
||||||
|
.skip_init:
|
||||||
|
stdcall set_mtrr, [LFBAddress],[LFBSize],MEM_WC
|
||||||
|
|
||||||
wbinvd ;again invalidate
|
wbinvd ;again invalidate
|
||||||
|
|
||||||
pop eax
|
|
||||||
or eax, 0x800 ;set default memtype to UC
|
|
||||||
and al, 0xF0
|
|
||||||
mov ecx, 0x2FF
|
|
||||||
wrmsr ;and enable MTRR
|
|
||||||
|
|
||||||
mov eax, cr0
|
mov eax, cr0
|
||||||
and eax, not 0x60000000
|
and eax, not 0x60000000
|
||||||
mov cr0, eax ; enable caching
|
mov cr0, eax ; enable caching
|
||||||
@@ -1199,13 +1341,29 @@ proc init_mtrr
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc set_mtrr stdcall, reg:dword,base:dword,size:dword,mem_type:dword
|
proc set_mtrr stdcall, base:dword,size:dword,mem_type:dword
|
||||||
|
; find unused register
|
||||||
|
mov ecx, 0x201
|
||||||
|
@@:
|
||||||
|
rdmsr
|
||||||
|
dec ecx
|
||||||
|
test ah, 8
|
||||||
|
jz .found
|
||||||
|
rdmsr
|
||||||
|
mov al, 0 ; clear memory type field
|
||||||
|
cmp eax, [base]
|
||||||
|
jz .ret
|
||||||
|
add ecx, 3
|
||||||
|
cmp ecx, 0x210
|
||||||
|
jb @b
|
||||||
|
; no free registers, ignore the call
|
||||||
|
.ret:
|
||||||
|
ret
|
||||||
|
.found:
|
||||||
|
; found, write values
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
mov eax, [base]
|
mov eax, [base]
|
||||||
or eax, [mem_type]
|
or eax, [mem_type]
|
||||||
mov ecx, [reg]
|
|
||||||
lea ecx, [0x200+ecx*2]
|
|
||||||
wrmsr
|
wrmsr
|
||||||
|
|
||||||
mov ebx, [size]
|
mov ebx, [size]
|
||||||
|
@@ -280,6 +280,8 @@ L40:
|
|||||||
__exports:
|
__exports:
|
||||||
export 'KERNEL', \
|
export 'KERNEL', \
|
||||||
alloc_kernel_space, 'AllocKernelSpace', \ ; stdcall
|
alloc_kernel_space, 'AllocKernelSpace', \ ; stdcall
|
||||||
|
alloc_page, 'AllocPage', \ ; gcc ABI
|
||||||
|
alloc_pages, 'AllocPages', \ ; stdcall
|
||||||
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
|
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
|
||||||
create_kernel_object, 'CreateObject', \
|
create_kernel_object, 'CreateObject', \
|
||||||
create_ring_buffer, 'CreateRingBuffer', \ ; stdcall
|
create_ring_buffer, 'CreateRingBuffer', \ ; stdcall
|
||||||
@@ -287,17 +289,12 @@ __exports:
|
|||||||
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
|
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
|
||||||
kernel_alloc, 'KernelAlloc', \ ; stdcall
|
kernel_alloc, 'KernelAlloc', \ ; stdcall
|
||||||
kernel_free, 'KernelFree', \ ; stdcall
|
kernel_free, 'KernelFree', \ ; stdcall
|
||||||
alloc_pages, 'AllocPages', \ ; stdcall
|
|
||||||
malloc, 'Kmalloc', \
|
malloc, 'Kmalloc', \
|
||||||
free, 'Kfree', \
|
free, 'Kfree', \
|
||||||
map_io_mem, 'MapIoMem', \ ; stdcall
|
map_io_mem, 'MapIoMem', \ ; stdcall
|
||||||
get_pg_addr, 'GetPgAddr', \ ; eax
|
get_pg_addr, 'GetPgAddr', \ ; eax
|
||||||
\
|
\
|
||||||
select_hw_cursor, 'SelectHwCursor', \ ; stdcall
|
get_display, 'GetDisplay', \
|
||||||
set_hw_cursor, 'SetHwCursor', \ ; stdcall
|
|
||||||
hw_restore, 'HwCursorRestore', \ ;
|
|
||||||
create_cursor, 'HwCursorCreate', \ ;
|
|
||||||
\
|
|
||||||
set_screen, 'SetScreen', \
|
set_screen, 'SetScreen', \
|
||||||
pci_api, 'PciApi', \
|
pci_api, 'PciApi', \
|
||||||
pci_read8, 'PciRead8', \ ; stdcall
|
pci_read8, 'PciRead8', \ ; stdcall
|
||||||
@@ -307,6 +304,7 @@ __exports:
|
|||||||
pci_write16, 'PciWrite16', \ ; stdcall
|
pci_write16, 'PciWrite16', \ ; stdcall
|
||||||
pci_write32, 'PciWrite32', \ ; stdcall
|
pci_write32, 'PciWrite32', \ ; stdcall
|
||||||
\
|
\
|
||||||
|
get_service, 'GetService', \ ;
|
||||||
reg_service, 'RegService', \ ; stdcall
|
reg_service, 'RegService', \ ; stdcall
|
||||||
attach_int_handler, 'AttachIntHandler', \ ; stdcall
|
attach_int_handler, 'AttachIntHandler', \ ; stdcall
|
||||||
user_alloc, 'UserAlloc', \ ; stdcall
|
user_alloc, 'UserAlloc', \ ; stdcall
|
||||||
|
@@ -174,8 +174,23 @@ do_change_task:
|
|||||||
cmp eax, [esi+ecx] ;offset>0x7F
|
cmp eax, [esi+ecx] ;offset>0x7F
|
||||||
je @f
|
je @f
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
@@: ; set tss.esp0
|
@@:
|
||||||
|
; set tss.esp0
|
||||||
|
|
||||||
Mov [tss._esp0],eax,[ebx+APPDATA.saved_esp0]
|
Mov [tss._esp0],eax,[ebx+APPDATA.saved_esp0]
|
||||||
|
|
||||||
|
mov edx, [ebx+APPDATA.tls_base]
|
||||||
|
cmp edx, [esi+APPDATA.tls_base]
|
||||||
|
je @f
|
||||||
|
|
||||||
|
mov [tls_data_l+2],dx
|
||||||
|
shr edx,16
|
||||||
|
mov [tls_data_l+4],dl
|
||||||
|
mov [tls_data_l+7],dh
|
||||||
|
|
||||||
|
mov dx, app_tls
|
||||||
|
mov fs, dx
|
||||||
|
@@:
|
||||||
; set gs selector unconditionally
|
; set gs selector unconditionally
|
||||||
Mov gs,ax,graph_data
|
Mov gs,ax,graph_data
|
||||||
; set CR0.TS
|
; set CR0.TS
|
||||||
@@ -211,6 +226,7 @@ struc TIMER
|
|||||||
.arg dd ?
|
.arg dd ?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MAX_PROIRITY 0 ; highest, used for kernel tasks
|
MAX_PROIRITY 0 ; highest, used for kernel tasks
|
||||||
MAX_USER_PRIORITY 0 ; highest priority for user processes
|
MAX_USER_PRIORITY 0 ; highest priority for user processes
|
||||||
USER_PRIORITY 7 ; default (should correspond to nice 0)
|
USER_PRIORITY 7 ; default (should correspond to nice 0)
|
||||||
@@ -218,7 +234,9 @@ MIN_USER_PRIORITY 14 ; minimum priority for user processes
|
|||||||
IDLE_PRIORITY 15 ; lowest, only IDLE process goes here
|
IDLE_PRIORITY 15 ; lowest, only IDLE process goes here
|
||||||
NR_SCHED_QUEUES 16 ; MUST equal IDLE_PRIORYTY + 1
|
NR_SCHED_QUEUES 16 ; MUST equal IDLE_PRIORYTY + 1
|
||||||
|
|
||||||
|
uglobal
|
||||||
rdy_head rd 16
|
rdy_head rd 16
|
||||||
|
endg
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
pick_task:
|
pick_task:
|
||||||
|
@@ -279,21 +279,26 @@ p_irq15:
|
|||||||
iret
|
iret
|
||||||
|
|
||||||
ready_for_next_irq:
|
ready_for_next_irq:
|
||||||
mov [check_idle_semaphore],5
|
mov eax,5
|
||||||
mov al, 0x20
|
mov [check_idle_semaphore],eax
|
||||||
|
; mov al, 0x20
|
||||||
|
add eax,(0x20-0x5)
|
||||||
|
|
||||||
out 0x20, al
|
out 0x20, al
|
||||||
ret
|
ret
|
||||||
|
;destroy eax
|
||||||
ready_for_next_irq_1:
|
ready_for_next_irq_1:
|
||||||
mov [check_idle_semaphore],5
|
mov eax,5
|
||||||
mov al, 0x20
|
mov [check_idle_semaphore],eax
|
||||||
|
; mov al, 0x20
|
||||||
|
add eax,(0x20-0x5)
|
||||||
out 0xa0,al
|
out 0xa0,al
|
||||||
out 0x20, al
|
out 0x20, al
|
||||||
ret
|
ret
|
||||||
|
|
||||||
irqD:
|
irqD:
|
||||||
push eax
|
push eax
|
||||||
mov al,0
|
xor eax,eax
|
||||||
out 0xf0,al
|
out 0xf0,al
|
||||||
mov al,0x20
|
mov al,0x20
|
||||||
out 0xa0,al
|
out 0xa0,al
|
||||||
@@ -396,37 +401,33 @@ clear_application_table_status:
|
|||||||
|
|
||||||
cmp eax,[application_table_status]
|
cmp eax,[application_table_status]
|
||||||
jne apptsl1
|
jne apptsl1
|
||||||
mov [application_table_status],0
|
xor eax,eax
|
||||||
|
mov [application_table_status],eax
|
||||||
apptsl1:
|
apptsl1:
|
||||||
|
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; * eax = 64 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
; * ebx = 1 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
; * ecx = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||||
|
; * eax = 0 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
; * eax = 1 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
sys_resize_app_memory:
|
sys_resize_app_memory:
|
||||||
; eax = 1 - resize
|
; ebx = 1 - resize
|
||||||
; ebx = new amount of memory
|
; ecx = new amount of memory
|
||||||
|
|
||||||
cmp eax,1
|
|
||||||
jne .no_application_mem_resize
|
|
||||||
|
|
||||||
stdcall new_mem_resize, ebx
|
|
||||||
mov [esp+36], eax
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
; cmp eax,1
|
||||||
|
dec ebx
|
||||||
|
jnz .no_application_mem_resize
|
||||||
|
stdcall new_mem_resize, ecx
|
||||||
|
mov [esp+32], eax
|
||||||
.no_application_mem_resize:
|
.no_application_mem_resize:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
sys_threads:
|
|
||||||
|
|
||||||
; eax=1 create thread
|
|
||||||
;
|
|
||||||
; ebx=thread start
|
|
||||||
; ecx=thread stack value
|
|
||||||
;
|
|
||||||
; on return : eax = pid
|
|
||||||
jmp new_sys_threads
|
|
||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
; process_terminating db 'K : Process - terminating',13,10,0
|
; process_terminating db 'K : Process - terminating',13,10,0
|
||||||
; process_terminated db 'K : Process - done',13,10,0
|
; process_terminated db 'K : Process - done',13,10,0
|
||||||
@@ -497,10 +498,10 @@ term9:
|
|||||||
pop esi
|
pop esi
|
||||||
jmp @B
|
jmp @B
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov eax, [.slot]
|
mov eax, [.slot]
|
||||||
shl eax, 8
|
shl eax, 8
|
||||||
mov eax,[SLOT_BASE+eax+APPDATA.dir_table]
|
stdcall destroy_app_space, [SLOT_BASE+eax+APPDATA.dir_table], [SLOT_BASE+eax+APPDATA.dlls_list_ptr]
|
||||||
stdcall destroy_app_space, eax
|
|
||||||
|
|
||||||
mov esi, [.slot]
|
mov esi, [.slot]
|
||||||
cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1
|
cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1
|
||||||
@@ -586,13 +587,13 @@ term9:
|
|||||||
shl esi,5
|
shl esi,5
|
||||||
add esi,window_data
|
add esi,window_data
|
||||||
mov eax,[esi+WDATA.box.left]
|
mov eax,[esi+WDATA.box.left]
|
||||||
mov [dlx],eax
|
mov [draw_limits.left],eax
|
||||||
add eax,[esi+WDATA.box.width]
|
add eax,[esi+WDATA.box.width]
|
||||||
mov [dlxe],eax
|
mov [draw_limits.right],eax
|
||||||
mov eax,[esi+WDATA.box.top]
|
mov eax,[esi+WDATA.box.top]
|
||||||
mov [dly],eax
|
mov [draw_limits.top],eax
|
||||||
add eax,[esi+WDATA.box.height]
|
add eax,[esi+WDATA.box.height]
|
||||||
mov [dlye],eax
|
mov [draw_limits.bottom],eax
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [esi+WDATA.box.left],eax
|
mov [esi+WDATA.box.left],eax
|
||||||
@@ -641,12 +642,12 @@ term9:
|
|||||||
add edi,SLOT_BASE
|
add edi,SLOT_BASE
|
||||||
|
|
||||||
mov eax, [edi+APPDATA.io_map]
|
mov eax, [edi+APPDATA.io_map]
|
||||||
cmp eax, (tss._io_map_0-OS_BASE+PG_MAP)
|
cmp eax, [SLOT_BASE+256+APPDATA.io_map]
|
||||||
je @F
|
je @F
|
||||||
call free_page
|
call free_page
|
||||||
@@:
|
@@:
|
||||||
mov eax, [edi+APPDATA.io_map+4]
|
mov eax, [edi+APPDATA.io_map+4]
|
||||||
cmp eax, (tss._io_map_1-OS_BASE+PG_MAP)
|
cmp eax, [SLOT_BASE+256+APPDATA.io_map+4]
|
||||||
je @F
|
je @F
|
||||||
call free_page
|
call free_page
|
||||||
@@:
|
@@:
|
||||||
@@ -689,22 +690,22 @@ term9:
|
|||||||
cmp [hd1_status], esi
|
cmp [hd1_status], esi
|
||||||
jnz @f
|
jnz @f
|
||||||
call free_hd_channel
|
call free_hd_channel
|
||||||
mov [hd1_status], 0
|
and [hd1_status], 0
|
||||||
@@:
|
@@:
|
||||||
cmp [cd_status], esi
|
cmp [cd_status], esi
|
||||||
jnz @f
|
jnz @f
|
||||||
call free_cd_channel
|
call free_cd_channel
|
||||||
mov [cd_status], 0
|
and [cd_status], 0
|
||||||
@@:
|
@@:
|
||||||
cmp [flp_status], esi
|
cmp [flp_status], esi
|
||||||
jnz @f
|
jnz @f
|
||||||
mov [flp_status], 0
|
and [flp_status], 0
|
||||||
@@:
|
@@:
|
||||||
pop esi
|
pop esi
|
||||||
cmp [bgrlockpid], esi
|
cmp [bgrlockpid], esi
|
||||||
jnz @f
|
jnz @f
|
||||||
and [bgrlockpid], 0
|
and [bgrlockpid], 0
|
||||||
mov [bgrlock], 0
|
and [bgrlock], 0
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
pusha ; remove all irq reservations
|
pusha ; remove all irq reservations
|
||||||
@@ -736,8 +737,8 @@ term9:
|
|||||||
|
|
||||||
mov esi,[RESERVED_PORTS]
|
mov esi,[RESERVED_PORTS]
|
||||||
|
|
||||||
cmp esi,0
|
test esi,esi
|
||||||
je rmpr9
|
jz rmpr9
|
||||||
|
|
||||||
rmpr3:
|
rmpr3:
|
||||||
|
|
||||||
@@ -796,10 +797,10 @@ term9:
|
|||||||
; call systest
|
; call systest
|
||||||
sti ; .. and life goes on
|
sti ; .. and life goes on
|
||||||
|
|
||||||
mov eax, [dlx]
|
mov eax, [draw_limits.left]
|
||||||
mov ebx, [dly]
|
mov ebx, [draw_limits.top]
|
||||||
mov ecx, [dlxe]
|
mov ecx, [draw_limits.right]
|
||||||
mov edx, [dlye]
|
mov edx, [draw_limits.bottom]
|
||||||
call calculatescreen
|
call calculatescreen
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
xor esi, esi
|
xor esi, esi
|
||||||
@@ -808,7 +809,7 @@ term9:
|
|||||||
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
|
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
|
||||||
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
|
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
|
||||||
|
|
||||||
mov [application_table_status],0
|
and [application_table_status],0
|
||||||
;mov esi,process_terminated
|
;mov esi,process_terminated
|
||||||
;call sys_msg_board_str
|
;call sys_msg_board_str
|
||||||
add esp, 4
|
add esp, 4
|
||||||
|
@@ -20,7 +20,6 @@ cross_order:
|
|||||||
call dword [servetable+edi*4]
|
call dword [servetable+edi*4]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; SYSENTER ENTRY ;;
|
;; SYSENTER ENTRY ;;
|
||||||
@@ -123,59 +122,57 @@ iglobal
|
|||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd sys_midi ; 20-ResetMidi and OutputMidi
|
|
||||||
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
|
||||||
dd sys_settime ; 22-setting date,time,clock and alarm-clock
|
|
||||||
dd 0
|
|
||||||
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
|
||||||
dd 0 ;
|
|
||||||
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
|
||||||
dd 0
|
|
||||||
dd 0 ;
|
|
||||||
dd 0
|
|
||||||
dd sys_current_directory ; 30-Get/SetCurrentDirectory
|
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd readmousepos ; 37-GetMousePosition_ScreenRelative,.
|
|
||||||
dd 0 ; 38-DrawLine
|
|
||||||
dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,.
|
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd sys_outport ; 43-SendDeviceData
|
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
|
dd 0
|
||||||
dd display_number ; 47-WriteNum
|
dd 0
|
||||||
dd display_settings ; 48-SetRedrawType and SetButtonType
|
dd 0
|
||||||
dd sys_apm ; 49-Advanced Power Management (APM)
|
dd 0
|
||||||
dd random_shaped_window ; 50-Window shape & scale
|
dd 0
|
||||||
dd syscall_threads ; 51-Threads
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd sound_interface ; 55-Sound interface
|
dd sound_interface ; 55-Sound interface
|
||||||
dd 0
|
dd 0
|
||||||
dd sys_pcibios ; 57-PCI BIOS32
|
dd 0
|
||||||
dd file_system ; 58-Common file system interface
|
dd file_system ; 58-Common file system interface
|
||||||
dd 0
|
dd 0
|
||||||
dd sys_IPC ; 60-Inter Process Communication
|
dd sys_IPC ; 60-Inter Process Communication
|
||||||
dd sys_gs ; 61-Direct graphics access
|
dd sys_gs ; 61-Direct graphics access
|
||||||
dd sys_pci ; 62-PCI functions
|
dd sys_pci ; 62-PCI functions
|
||||||
dd sys_msg_board ; 63-System message board
|
dd sys_msg_board ; 63-System message board
|
||||||
dd sys_resize_app_memory ; 64-Resize application memory usage
|
dd 0
|
||||||
dd syscall_putimage_palette; 65-PutImagePalette
|
dd syscall_putimage_palette; 65-PutImagePalette
|
||||||
dd sys_process_def ; 66-Process definitions - keyboard
|
dd sys_process_def ; 66-Process definitions - keyboard
|
||||||
dd sys_window_move ; 67-Window move or resize
|
dd sys_window_move ; 67-Window move or resize
|
||||||
dd f68 ; 68-Some internal services
|
dd 0
|
||||||
dd sys_debug_services ; 69-Debug
|
dd 0
|
||||||
dd file_system_lfn ; 70-Common file system interface, version 2
|
dd file_system_lfn ; 70-Common file system interface, version 2
|
||||||
dd syscall_windowsettings ; 71-Window settings
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; NEW SYSTEM FUNCTIONS TABLE ;;
|
;; NEW SYSTEM FUNCTIONS TABLE ;;
|
||||||
@@ -191,7 +188,7 @@ iglobal
|
|||||||
dd delay_hs ; 5-DelayHs
|
dd delay_hs ; 5-DelayHs
|
||||||
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
|
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
|
||||||
dd syscall_putimage ; 7-PutImage
|
dd syscall_putimage ; 7-PutImage
|
||||||
dd sys_button ; 8-DefineButton
|
dd syscall_button ; 8-DefineButton
|
||||||
dd sys_cpuusage ; 9-GetProcessInfo
|
dd sys_cpuusage ; 9-GetProcessInfo
|
||||||
dd sys_waitforevent ; 10-WaitForEvent
|
dd sys_waitforevent ; 10-WaitForEvent
|
||||||
dd sys_getevent ; 11-CheckForEvent
|
dd sys_getevent ; 11-CheckForEvent
|
||||||
@@ -203,58 +200,58 @@ iglobal
|
|||||||
dd sys_getbutton ; 17-GetButton
|
dd sys_getbutton ; 17-GetButton
|
||||||
dd sys_system ; 18-System Services
|
dd sys_system ; 18-System Services
|
||||||
dd paleholder ; 19-reserved
|
dd paleholder ; 19-reserved
|
||||||
dd cross_order ; 20-ResetMidi and OutputMidi
|
dd sys_midi ; 20-ResetMidi and OutputMidi
|
||||||
dd cross_order ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
||||||
dd cross_order ; 22-setting date,time,clock and alarm-clock
|
dd sys_settime ; 22-setting date,time,clock and alarm-clock
|
||||||
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
|
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
|
||||||
dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
||||||
dd undefined_syscall ; 25-reserved
|
dd undefined_syscall ; 25-reserved
|
||||||
dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
||||||
dd undefined_syscall ; 27-reserved
|
dd undefined_syscall ; 27-reserved
|
||||||
dd undefined_syscall ; 28-reserved
|
dd undefined_syscall ; 28-reserved
|
||||||
dd sys_date ; 29-GetDate
|
dd sys_date ; 29-GetDate
|
||||||
dd cross_order ; 30-Get/SetCurrentDirectory
|
dd sys_current_directory ; 30-Get/SetCurrentDirectory
|
||||||
dd undefined_syscall ; 31-reserved
|
dd undefined_syscall ; 31-reserved
|
||||||
dd undefined_syscall ; 32-reserved
|
dd undefined_syscall ; 32-reserved
|
||||||
dd undefined_syscall ; 33-reserved
|
dd undefined_syscall ; 33-reserved
|
||||||
dd undefined_syscall ; 34-reserved
|
dd undefined_syscall ; 34-reserved
|
||||||
dd syscall_getpixel ; 35-GetPixel
|
dd syscall_getpixel ; 35-GetPixel
|
||||||
dd syscall_getarea ; 36-GetArea
|
dd syscall_getarea ; 36-GetArea
|
||||||
dd cross_order ; 37-GetMousePosition_ScreenRelative,.
|
dd readmousepos ; 37-GetMousePosition_ScreenRelative,.
|
||||||
dd syscall_drawline ; 38-DrawLine
|
dd syscall_drawline ; 38-DrawLine
|
||||||
dd cross_order ; 39-GetBackgroundSize,ReadBgrData,.
|
dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,.
|
||||||
dd set_app_param ; 40-WantEvents
|
dd set_app_param ; 40-WantEvents
|
||||||
dd syscall_getirqowner ; 41-GetIrqOwner
|
dd syscall_getirqowner ; 41-GetIrqOwner
|
||||||
dd get_irq_data ; 42-ReadIrqData
|
dd get_irq_data ; 42-ReadIrqData
|
||||||
dd cross_order ; 43-SendDeviceData
|
dd sys_outport ; 43-SendDeviceData
|
||||||
dd sys_programirq ; 44-ProgramIrqs
|
dd sys_programirq ; 44-ProgramIrqs
|
||||||
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
|
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
|
||||||
dd cross_order ; 46-ReservePortArea and FreePortArea
|
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
|
||||||
dd cross_order ; 47-WriteNum
|
dd display_number ; 47-WriteNum
|
||||||
dd cross_order ; 48-SetRedrawType and SetButtonType
|
dd syscall_display_settings ; 48-SetRedrawType and SetButtonType
|
||||||
dd cross_order ; 49-Advanced Power Management (APM)
|
dd sys_apm ; 49-Advanced Power Management (APM)
|
||||||
dd cross_order ; 50-Window shape & scale
|
dd syscall_set_window_shape ; 50-Window shape & scale
|
||||||
dd cross_order ; 51-Threads
|
dd syscall_threads ; 51-Threads
|
||||||
dd cross_order ; 52-Stack driver status
|
dd undefined_syscall ; 52-Stack driver status
|
||||||
dd cross_order ; 53-Socket interface
|
dd undefined_syscall ; 53-Socket interface
|
||||||
dd undefined_syscall ; 54-reserved
|
dd undefined_syscall ; 54-reserved
|
||||||
dd cross_order ; 55-Sound interface
|
dd cross_order ; 55-Sound interface
|
||||||
dd undefined_syscall ; 56-reserved
|
dd undefined_syscall ; 56-reserved
|
||||||
dd cross_order ; 57-PCI BIOS32
|
dd sys_pcibios ; 57-PCI BIOS32
|
||||||
dd cross_order ; 58-Common file system interface
|
dd cross_order ; 58-Common file system interface
|
||||||
dd undefined_syscall ; 59-reserved
|
dd undefined_syscall ; 59-reserved
|
||||||
dd cross_order ; 60-Inter Process Communication
|
dd cross_order ; 60-Inter Process Communication
|
||||||
dd cross_order ; 61-Direct graphics access
|
dd cross_order ; 61-Direct graphics access
|
||||||
dd cross_order ; 62-PCI functions
|
dd cross_order ; 62-PCI functions
|
||||||
dd cross_order ; 63-System message board
|
dd cross_order ; 63-System message board
|
||||||
dd cross_order ; 64-Resize application memory usage
|
dd sys_resize_app_memory ; 64-Resize application memory usage
|
||||||
dd cross_order ; 65-PutImagePalette
|
dd cross_order ; 65-PutImagePalette
|
||||||
dd cross_order ; 66-Process definitions - keyboard
|
dd cross_order ; 66-Process definitions - keyboard
|
||||||
dd cross_order ; 67-Window move or resize
|
dd cross_order ; 67-Window move or resize
|
||||||
dd cross_order ; 68-Some internal services
|
dd f68 ; 68-Some internal services
|
||||||
dd cross_order ; 69-Debug
|
dd sys_debug_services ; 69-Debug
|
||||||
dd cross_order ; 70-Common file system interface, version 2
|
dd cross_order ; 70-Common file system interface, version 2
|
||||||
dd cross_order ; 71-Window settings
|
dd syscall_windowsettings ; 71-Window settings
|
||||||
dd sys_sendwindowmsg ; 72-Send window message
|
dd sys_sendwindowmsg ; 72-Send window message
|
||||||
dd sys_network ; 73-Network stack
|
dd sys_network ; 73-Network stack
|
||||||
dd sys_socket ; 74-Sockets
|
dd sys_socket ; 74-Sockets
|
||||||
|
@@ -113,6 +113,7 @@ proc fs_execute
|
|||||||
popad
|
popad
|
||||||
mov eax, -ERROR_FILE_NOT_FOUND
|
mov eax, -ERROR_FILE_NOT_FOUND
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.namecopied:
|
.namecopied:
|
||||||
|
|
||||||
mov [cmdline], ebx
|
mov [cmdline], ebx
|
||||||
@@ -150,8 +151,8 @@ proc fs_execute
|
|||||||
.get_lock:
|
.get_lock:
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
xchg eax, [application_table_status]
|
xchg eax, [application_table_status]
|
||||||
cmp eax, 0
|
test eax, eax
|
||||||
jne .wait_lock
|
jnz .wait_lock
|
||||||
|
|
||||||
call set_application_table_status
|
call set_application_table_status
|
||||||
|
|
||||||
@@ -201,6 +202,14 @@ proc fs_execute
|
|||||||
mov eax,[hdr_mem]
|
mov eax,[hdr_mem]
|
||||||
mov [ebx+APPDATA.mem_size],eax
|
mov [ebx+APPDATA.mem_size],eax
|
||||||
|
|
||||||
|
xor edx, edx
|
||||||
|
cmp word [6], '02'
|
||||||
|
jne @f
|
||||||
|
|
||||||
|
not edx
|
||||||
|
@@:
|
||||||
|
mov [ebx+APPDATA.tls_base],edx
|
||||||
|
|
||||||
if GREEDY_KERNEL
|
if GREEDY_KERNEL
|
||||||
else
|
else
|
||||||
mov ecx, [hdr_mem]
|
mov ecx, [hdr_mem]
|
||||||
@@ -278,8 +287,10 @@ test_app_header:
|
|||||||
.check_01_header:
|
.check_01_header:
|
||||||
|
|
||||||
cmp [eax+6], word '01'
|
cmp [eax+6], word '01'
|
||||||
|
je @f
|
||||||
|
cmp [eax+6], word '02'
|
||||||
jne .fail
|
jne .fail
|
||||||
|
@@:
|
||||||
mov ecx,[APP_HEADER_01.start]
|
mov ecx,[APP_HEADER_01.start]
|
||||||
mov [ebx+0x08], ecx ;app_eip
|
mov [ebx+0x08], ecx ;app_eip
|
||||||
mov edx,[APP_HEADER_01.mem_size]
|
mov edx,[APP_HEADER_01.mem_size]
|
||||||
@@ -475,7 +486,7 @@ end if
|
|||||||
dec [pg_data.pg_mutex]
|
dec [pg_data.pg_mutex]
|
||||||
cmp [dir_addr], 0
|
cmp [dir_addr], 0
|
||||||
je @f
|
je @f
|
||||||
stdcall destroy_app_space, [dir_addr]
|
stdcall destroy_app_space, [dir_addr], 0
|
||||||
@@:
|
@@:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
@@ -512,12 +523,10 @@ proc destroy_page_table stdcall, pg_tab:dword
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc destroy_app_space stdcall, pg_dir:dword
|
proc destroy_app_space stdcall, pg_dir:dword, dlls_list:dword
|
||||||
|
|
||||||
mov ebx, pg_data.pg_mutex
|
|
||||||
call wait_mutex ;ebx
|
|
||||||
|
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
|
push edx
|
||||||
mov eax,0x2
|
mov eax,0x2
|
||||||
mov ebx, [pg_dir]
|
mov ebx, [pg_dir]
|
||||||
.loop:
|
.loop:
|
||||||
@@ -527,8 +536,10 @@ proc destroy_app_space stdcall, pg_dir:dword
|
|||||||
cmp byte [CURRENT_TASK+ecx+0xa],9 ;if process running?
|
cmp byte [CURRENT_TASK+ecx+0xa],9 ;if process running?
|
||||||
jz @f ;skip empty slots
|
jz @f ;skip empty slots
|
||||||
shl ecx,3
|
shl ecx,3
|
||||||
cmp [SLOT_BASE+ecx+0xB8],ebx ;compare page directory addresses
|
add ecx,SLOT_BASE
|
||||||
|
cmp [ecx+APPDATA.dir_table],ebx ;compare page directory addresses
|
||||||
jnz @f
|
jnz @f
|
||||||
|
mov [ebp-4],ecx
|
||||||
inc edx ;thread found
|
inc edx ;thread found
|
||||||
@@:
|
@@:
|
||||||
inc eax
|
inc eax
|
||||||
@@ -537,13 +548,19 @@ proc destroy_app_space stdcall, pg_dir:dword
|
|||||||
|
|
||||||
;edx = number of threads
|
;edx = number of threads
|
||||||
;our process is zombi so it isn't counted
|
;our process is zombi so it isn't counted
|
||||||
|
pop ecx
|
||||||
cmp edx,1
|
cmp edx,1
|
||||||
jg .exit
|
jg .ret
|
||||||
;if there isn't threads then clear memory.
|
;if there isn't threads then clear memory.
|
||||||
|
mov esi, [dlls_list]
|
||||||
|
call destroy_all_hdlls
|
||||||
|
|
||||||
|
mov ebx, pg_data.pg_mutex
|
||||||
|
call wait_mutex ;ebx
|
||||||
|
|
||||||
mov eax, [pg_dir]
|
mov eax, [pg_dir]
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
|
stdcall map_page,[tmp_task_pdir],eax,PG_SW
|
||||||
mov esi, [tmp_task_pdir]
|
mov esi, [tmp_task_pdir]
|
||||||
mov edi, (OS_BASE shr 20)/4
|
mov edi, (OS_BASE shr 20)/4
|
||||||
.destroy:
|
.destroy:
|
||||||
@@ -551,7 +568,7 @@ proc destroy_app_space stdcall, pg_dir:dword
|
|||||||
test eax, 1
|
test eax, 1
|
||||||
jz .next
|
jz .next
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
stdcall map_page,[tmp_task_ptab],eax,dword PG_SW
|
stdcall map_page,[tmp_task_ptab],eax,PG_SW
|
||||||
stdcall destroy_page_table, [tmp_task_ptab]
|
stdcall destroy_page_table, [tmp_task_ptab]
|
||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
call free_page
|
call free_page
|
||||||
@@ -563,9 +580,10 @@ proc destroy_app_space stdcall, pg_dir:dword
|
|||||||
mov eax, [pg_dir]
|
mov eax, [pg_dir]
|
||||||
call free_page
|
call free_page
|
||||||
.exit:
|
.exit:
|
||||||
stdcall map_page,[tmp_task_ptab],dword 0,dword PG_UNMAP
|
stdcall map_page,[tmp_task_ptab],0,PG_UNMAP
|
||||||
stdcall map_page,[tmp_task_pdir],dword 0,dword PG_UNMAP
|
stdcall map_page,[tmp_task_pdir],0,PG_UNMAP
|
||||||
dec [pg_data.pg_mutex]
|
dec [pg_data.pg_mutex]
|
||||||
|
.ret:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@@ -613,24 +631,24 @@ pid_to_slot:
|
|||||||
|
|
||||||
check_region:
|
check_region:
|
||||||
;input:
|
;input:
|
||||||
; ebx - start of buffer
|
; esi - start of buffer
|
||||||
; ecx - size of buffer
|
; edx - size of buffer
|
||||||
;result:
|
;result:
|
||||||
; eax = 1 region lays in app memory
|
; eax = 1 region lays in app memory
|
||||||
; eax = 0 region don't lays in app memory
|
; eax = 0 region don't lays in app memory
|
||||||
mov eax,[CURRENT_TASK]
|
mov eax,[CURRENT_TASK]
|
||||||
jmp check_process_region
|
; jmp check_process_region
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
check_process_region:
|
;check_process_region:
|
||||||
;input:
|
;input:
|
||||||
; eax - slot
|
; eax - slot
|
||||||
; ebx - start of buffer
|
; esi - start of buffer
|
||||||
; ecx - size of buffer
|
; edx - size of buffer
|
||||||
;result:
|
;result:
|
||||||
; eax = 1 region lays in app memory
|
; eax = 1 region lays in app memory
|
||||||
; eax = 0 region don't lays in app memory
|
; eax = 0 region don't lays in app memory
|
||||||
|
|
||||||
test ecx,ecx
|
test edx,edx
|
||||||
jle .ok
|
jle .ok
|
||||||
shl eax,5
|
shl eax,5
|
||||||
cmp word [CURRENT_TASK+eax+0xa],0
|
cmp word [CURRENT_TASK+eax+0xa],0
|
||||||
@@ -698,9 +716,9 @@ align 4
|
|||||||
proc read_process_memory
|
proc read_process_memory
|
||||||
;Input:
|
;Input:
|
||||||
; eax - process slot
|
; eax - process slot
|
||||||
; ebx - buffer address
|
; ecx - buffer address
|
||||||
; ecx - buffer size
|
; edx - buffer size
|
||||||
; edx - start address in other process
|
; esi - start address in other process
|
||||||
;Output:
|
;Output:
|
||||||
; eax - number of bytes read.
|
; eax - number of bytes read.
|
||||||
locals
|
locals
|
||||||
@@ -712,10 +730,10 @@ proc read_process_memory
|
|||||||
endl
|
endl
|
||||||
|
|
||||||
mov [slot], eax
|
mov [slot], eax
|
||||||
mov [buff], ebx
|
mov [buff], ecx
|
||||||
and [r_count], 0
|
and [r_count], 0
|
||||||
mov [tmp_r_cnt], ecx
|
mov [tmp_r_cnt], edx
|
||||||
mov [offset], edx
|
mov [offset], esi
|
||||||
|
|
||||||
pushad
|
pushad
|
||||||
.read_mem:
|
.read_mem:
|
||||||
@@ -733,18 +751,22 @@ proc read_process_memory
|
|||||||
jna @F
|
jna @F
|
||||||
mov ecx, 0x8000
|
mov ecx, 0x8000
|
||||||
@@:
|
@@:
|
||||||
mov eax, [slot]
|
|
||||||
shl eax,8
|
|
||||||
mov ebx, [offset]
|
mov ebx, [offset]
|
||||||
; add ebx, new_app_base
|
|
||||||
push ecx
|
push ecx
|
||||||
stdcall map_memEx, [proc_mem_map],\
|
stdcall map_memEx, [proc_mem_map],\
|
||||||
[SLOT_BASE+eax+0xB8],\
|
[slot], ebx, ecx, PG_MAP
|
||||||
ebx, ecx
|
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
mov esi, [offset]
|
mov esi, [offset]
|
||||||
and esi, 0xfff
|
and esi, 0xfff
|
||||||
|
sub eax, esi
|
||||||
|
jbe .ret
|
||||||
|
cmp ecx, eax
|
||||||
|
jbe @f
|
||||||
|
mov ecx, eax
|
||||||
|
mov [tmp_r_cnt], eax
|
||||||
|
@@:
|
||||||
add esi, [proc_mem_map]
|
add esi, [proc_mem_map]
|
||||||
mov edi, [buff]
|
mov edi, [buff]
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@@ -754,7 +776,7 @@ proc read_process_memory
|
|||||||
add [offset], edx
|
add [offset], edx
|
||||||
sub [tmp_r_cnt], edx
|
sub [tmp_r_cnt], edx
|
||||||
jnz .read_mem
|
jnz .read_mem
|
||||||
|
.ret:
|
||||||
popad
|
popad
|
||||||
mov eax, [r_count]
|
mov eax, [r_count]
|
||||||
ret
|
ret
|
||||||
@@ -764,9 +786,9 @@ align 4
|
|||||||
proc write_process_memory
|
proc write_process_memory
|
||||||
;Input:
|
;Input:
|
||||||
; eax - process slot
|
; eax - process slot
|
||||||
; ebx - buffer address
|
; ecx - buffer address
|
||||||
; ecx - buffer size
|
; edx - buffer size
|
||||||
; edx - start address in other process
|
; esi - start address in other process
|
||||||
;Output:
|
;Output:
|
||||||
; eax - number of bytes written
|
; eax - number of bytes written
|
||||||
|
|
||||||
@@ -779,10 +801,10 @@ proc write_process_memory
|
|||||||
endl
|
endl
|
||||||
|
|
||||||
mov [slot], eax
|
mov [slot], eax
|
||||||
mov [buff], ebx
|
mov [buff], ecx
|
||||||
and [w_count], 0
|
and [w_count], 0
|
||||||
mov [tmp_w_cnt], ecx
|
mov [tmp_w_cnt], edx
|
||||||
mov [offset], edx
|
mov [offset], esi
|
||||||
|
|
||||||
pushad
|
pushad
|
||||||
.read_mem:
|
.read_mem:
|
||||||
@@ -800,18 +822,22 @@ proc write_process_memory
|
|||||||
jna @F
|
jna @F
|
||||||
mov ecx, 0x8000
|
mov ecx, 0x8000
|
||||||
@@:
|
@@:
|
||||||
mov eax, [slot]
|
|
||||||
shl eax,8
|
|
||||||
mov ebx, [offset]
|
mov ebx, [offset]
|
||||||
; add ebx, new_app_base
|
; add ebx, new_app_base
|
||||||
push ecx
|
push ecx
|
||||||
stdcall map_memEx, [proc_mem_map],\
|
stdcall map_memEx, [proc_mem_map],\
|
||||||
[SLOT_BASE+eax+0xB8],\
|
[slot], ebx, ecx, PG_SW
|
||||||
ebx, ecx
|
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
mov edi, [offset]
|
mov edi, [offset]
|
||||||
and edi, 0xfff
|
and edi, 0xfff
|
||||||
|
sub eax, edi
|
||||||
|
jbe .ret
|
||||||
|
cmp ecx, eax
|
||||||
|
jbe @f
|
||||||
|
mov ecx, eax
|
||||||
|
mov [tmp_w_cnt], eax
|
||||||
|
@@:
|
||||||
add edi, [proc_mem_map]
|
add edi, [proc_mem_map]
|
||||||
mov esi, [buff]
|
mov esi, [buff]
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@@ -821,7 +847,7 @@ proc write_process_memory
|
|||||||
add [offset], edx
|
add [offset], edx
|
||||||
sub [tmp_w_cnt], edx
|
sub [tmp_w_cnt], edx
|
||||||
jnz .read_mem
|
jnz .read_mem
|
||||||
|
.ret:
|
||||||
popad
|
popad
|
||||||
mov eax, [w_count]
|
mov eax, [w_count]
|
||||||
ret
|
ret
|
||||||
@@ -838,15 +864,14 @@ proc new_sys_threads
|
|||||||
app_mem dd ? ;0x10
|
app_mem dd ? ;0x10
|
||||||
endl
|
endl
|
||||||
|
|
||||||
cmp eax,1
|
cmp ebx,1
|
||||||
jne .failed ;other subfunctions
|
jne .failed ;other subfunctions
|
||||||
|
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
|
mov [app_eip], ecx
|
||||||
mov [app_cmdline], eax
|
mov [app_cmdline], eax
|
||||||
|
mov [app_esp], edx
|
||||||
mov [app_path], eax
|
mov [app_path], eax
|
||||||
mov [app_eip], ebx
|
|
||||||
mov [app_esp], ecx
|
|
||||||
|
|
||||||
;mov esi,new_process_loading
|
;mov esi,new_process_loading
|
||||||
;call sys_msg_board_str
|
;call sys_msg_board_str
|
||||||
.wait_lock:
|
.wait_lock:
|
||||||
@@ -858,8 +883,8 @@ proc new_sys_threads
|
|||||||
.get_lock:
|
.get_lock:
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
xchg eax, [application_table_status]
|
xchg eax, [application_table_status]
|
||||||
cmp eax, 0
|
test eax, eax
|
||||||
jne .wait_lock
|
jnz .wait_lock
|
||||||
|
|
||||||
call set_application_table_status
|
call set_application_table_status
|
||||||
|
|
||||||
@@ -897,19 +922,36 @@ proc new_sys_threads
|
|||||||
mov ecx,[ebx+APPDATA.dir_table]
|
mov ecx,[ebx+APPDATA.dir_table]
|
||||||
mov [edx+APPDATA.dir_table],ecx ;copy page directory
|
mov [edx+APPDATA.dir_table],ecx ;copy page directory
|
||||||
|
|
||||||
|
mov eax,[ebx+APPDATA.dlls_list_ptr]
|
||||||
|
mov [edx+APPDATA.dlls_list_ptr],eax
|
||||||
|
|
||||||
|
mov eax, [ebx+APPDATA.tls_base]
|
||||||
|
test eax, eax
|
||||||
|
jz @F
|
||||||
|
|
||||||
|
push edx
|
||||||
|
stdcall user_alloc, 4096
|
||||||
|
pop edx
|
||||||
|
test eax, eax
|
||||||
|
jz .failed1 ;eax=0
|
||||||
|
@@:
|
||||||
|
mov [edx+APPDATA.tls_base], eax
|
||||||
|
|
||||||
lea eax, [app_cmdline]
|
lea eax, [app_cmdline]
|
||||||
stdcall set_app_params ,[slot],eax,dword 0,\
|
stdcall set_app_params ,[slot],eax,dword 0,\
|
||||||
dword 0,dword 0
|
dword 0,dword 0
|
||||||
|
|
||||||
;mov esi,new_process_running
|
;mov esi,new_process_running
|
||||||
;call sys_msg_board_str ;output information about succefull startup
|
;call sys_msg_board_str ;output information about succefull startup
|
||||||
|
xor eax,eax
|
||||||
mov [application_table_status],0 ;unlock application_table_status mutex
|
mov [application_table_status],eax ;unlock application_table_status mutex
|
||||||
mov eax,[process_number] ;set result
|
mov eax,[process_number] ;set result
|
||||||
ret
|
ret
|
||||||
.failed:
|
.failed:
|
||||||
mov [application_table_status],0
|
xor eax,eax
|
||||||
mov eax,-1
|
.failed1:
|
||||||
|
mov [application_table_status],eax
|
||||||
|
dec eax ;-1
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@@ -931,6 +973,24 @@ wait_mutex:
|
|||||||
pop eax
|
pop eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
tls_app_entry:
|
||||||
|
|
||||||
|
call init_heap
|
||||||
|
stdcall user_alloc, 4096
|
||||||
|
|
||||||
|
mov edx, [current_slot]
|
||||||
|
mov [edx+APPDATA.tls_base], eax
|
||||||
|
mov [tls_data_l+2],ax
|
||||||
|
shr eax,16
|
||||||
|
mov [tls_data_l+4],al
|
||||||
|
mov [tls_data_l+7],ah
|
||||||
|
mov dx, app_tls
|
||||||
|
mov fs, dx
|
||||||
|
popad
|
||||||
|
iretd
|
||||||
|
|
||||||
|
|
||||||
EFL_IF equ 0x0200
|
EFL_IF equ 0x0200
|
||||||
EFL_IOPL1 equ 0x1000
|
EFL_IOPL1 equ 0x1000
|
||||||
EFL_IOPL2 equ 0x2000
|
EFL_IOPL2 equ 0x2000
|
||||||
@@ -959,10 +1019,10 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
|||||||
mov [eax+SLOT_BASE+APPDATA.except_mask], 0
|
mov [eax+SLOT_BASE+APPDATA.except_mask], 0
|
||||||
|
|
||||||
;set default io permission map
|
;set default io permission map
|
||||||
mov [eax+SLOT_BASE+APPDATA.io_map],\
|
mov ecx, [SLOT_BASE+256+APPDATA.io_map]
|
||||||
(tss._io_map_0-OS_BASE+PG_MAP)
|
mov [eax+SLOT_BASE+APPDATA.io_map], ecx
|
||||||
mov [eax+SLOT_BASE+APPDATA.io_map+4],\
|
mov ecx, [SLOT_BASE+256+APPDATA.io_map+4]
|
||||||
(tss._io_map_1-OS_BASE+PG_MAP)
|
mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx
|
||||||
|
|
||||||
mov esi, fpu_data
|
mov esi, fpu_data
|
||||||
mov ecx, 512/4
|
mov ecx, 512/4
|
||||||
@@ -1037,6 +1097,11 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
|||||||
shl ebx,5
|
shl ebx,5
|
||||||
lea ecx,[draw_data+ebx] ;ecx - pointer to draw data
|
lea ecx,[draw_data+ebx] ;ecx - pointer to draw data
|
||||||
|
|
||||||
|
mov edx, irq0.return
|
||||||
|
cmp [ebx*8+SLOT_BASE+APPDATA.tls_base], -1
|
||||||
|
jne @F
|
||||||
|
mov edx, tls_app_entry
|
||||||
|
@@:
|
||||||
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
||||||
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL
|
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL
|
||||||
mov [ebx+window_data+WDATA.fl_redraw], 1
|
mov [ebx+window_data+WDATA.fl_redraw], 1
|
||||||
@@ -1050,9 +1115,9 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
|||||||
mov [ebx+4],eax ;set PID
|
mov [ebx+4],eax ;set PID
|
||||||
|
|
||||||
;set draw data to full screen
|
;set draw data to full screen
|
||||||
|
xor eax,eax
|
||||||
mov [ecx+0],dword 0
|
mov [ecx+0],dword eax
|
||||||
mov [ecx+4],dword 0
|
mov [ecx+4],dword eax
|
||||||
mov eax,[Screen_Max_X]
|
mov eax,[Screen_Max_X]
|
||||||
mov [ecx+8],eax
|
mov [ecx+8],eax
|
||||||
mov eax,[Screen_Max_Y]
|
mov eax,[Screen_Max_Y]
|
||||||
@@ -1063,7 +1128,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
|||||||
lea ecx, [ebx+REG_EIP]
|
lea ecx, [ebx+REG_EIP]
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
|
||||||
mov [ebx+REG_RET], dword irq0.return
|
mov [ebx+REG_RET], edx
|
||||||
mov [ebx+REG_EDI], eax
|
mov [ebx+REG_EDI], eax
|
||||||
mov [ebx+REG_ESI], eax
|
mov [ebx+REG_ESI], eax
|
||||||
mov [ebx+REG_EBP], eax
|
mov [ebx+REG_EBP], eax
|
||||||
|
223
kernel/branches/net/core/test_malloc.asm
Normal file
223
kernel/branches/net/core/test_malloc.asm
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
; Tests of malloc()/free() from the kernel heap.
|
||||||
|
; This file is not included in the kernel, it is just test application.
|
||||||
|
use32
|
||||||
|
db 'MENUET01'
|
||||||
|
dd 1, start, i_end, mem, mem, 0, 0
|
||||||
|
|
||||||
|
start:
|
||||||
|
; Zero-initialize uglobals (as in kernel at boot)
|
||||||
|
mov ecx, (zeroend - zerostart + 3) / 4
|
||||||
|
xor eax, eax
|
||||||
|
mov edi, zerostart
|
||||||
|
rep stosd
|
||||||
|
; Initialize small heap (as in kernel at boot)
|
||||||
|
call init_malloc
|
||||||
|
; Run tests
|
||||||
|
call run_test1
|
||||||
|
call run_test2
|
||||||
|
call run_test3
|
||||||
|
; All is OK, return
|
||||||
|
or eax, -1
|
||||||
|
int 0x40
|
||||||
|
|
||||||
|
run_test1:
|
||||||
|
; basic test
|
||||||
|
mov eax, 1
|
||||||
|
call malloc_with_test
|
||||||
|
mov byte [eax], 0xDD
|
||||||
|
mov esi, eax
|
||||||
|
mov eax, 1
|
||||||
|
call malloc_with_test
|
||||||
|
cmp byte [esi], 0xDD
|
||||||
|
jnz memory_destroyed
|
||||||
|
mov byte [eax], 0xEE
|
||||||
|
xchg eax, esi
|
||||||
|
call free
|
||||||
|
cmp byte [esi], 0xEE
|
||||||
|
jnz memory_destroyed
|
||||||
|
xchg eax, esi
|
||||||
|
call free
|
||||||
|
ret
|
||||||
|
|
||||||
|
run_test2:
|
||||||
|
ret
|
||||||
|
|
||||||
|
run_test3:
|
||||||
|
; 1024000 times run random operation.
|
||||||
|
; Randomly select malloc(random size from 1 to 1023)
|
||||||
|
; or free(random of previously allocated areas)
|
||||||
|
mov edi, 0x12345678
|
||||||
|
xor esi, esi ; 0 areas allocated
|
||||||
|
mov ebx, 1024000
|
||||||
|
.loop:
|
||||||
|
imul edi, 1103515245
|
||||||
|
add edi, 12345
|
||||||
|
mov eax, edi
|
||||||
|
shr eax, 16
|
||||||
|
test ebx, 64
|
||||||
|
jz .prefer_free
|
||||||
|
.prefer_malloc:
|
||||||
|
test eax, 3
|
||||||
|
jz .free
|
||||||
|
jmp @f
|
||||||
|
.prefer_free:
|
||||||
|
test eax, 3
|
||||||
|
jnz .free
|
||||||
|
@@:
|
||||||
|
shr eax, 2
|
||||||
|
and eax, 1023
|
||||||
|
jz .loop
|
||||||
|
push ebx
|
||||||
|
push eax
|
||||||
|
; mov ecx, [saved_state_num]
|
||||||
|
; mov [saved_state+ecx*8], eax
|
||||||
|
call malloc_with_test
|
||||||
|
; mov ecx, [saved_state_num]
|
||||||
|
; mov [saved_state+ecx*8+4], eax
|
||||||
|
; inc [saved_state_num]
|
||||||
|
pop ecx
|
||||||
|
pop ebx
|
||||||
|
inc esi
|
||||||
|
push ecx eax
|
||||||
|
push edi
|
||||||
|
mov edi, eax
|
||||||
|
mov eax, esi
|
||||||
|
rep stosb
|
||||||
|
pop edi
|
||||||
|
jmp .common
|
||||||
|
.free:
|
||||||
|
test esi, esi
|
||||||
|
jz .loop
|
||||||
|
xor edx, edx
|
||||||
|
div esi
|
||||||
|
sub edx, esi
|
||||||
|
neg edx
|
||||||
|
dec edx
|
||||||
|
mov eax, [esp+edx*8]
|
||||||
|
; mov ecx, [saved_state_num]
|
||||||
|
; mov [saved_state+ecx*8], -1
|
||||||
|
; mov [saved_state+ecx*8+4], eax
|
||||||
|
; inc [saved_state_num]
|
||||||
|
mov ecx, [esp+edx*8+4]
|
||||||
|
push edi eax
|
||||||
|
mov edi, eax
|
||||||
|
mov al, [edi]
|
||||||
|
repz scasb
|
||||||
|
jnz memory_destroyed
|
||||||
|
pop eax edi
|
||||||
|
push ebx edx
|
||||||
|
call free
|
||||||
|
pop edx ebx
|
||||||
|
dec esi
|
||||||
|
pop eax ecx
|
||||||
|
push edi
|
||||||
|
lea edi, [esp+4]
|
||||||
|
@@:
|
||||||
|
dec edx
|
||||||
|
js @f
|
||||||
|
xchg eax, [edi]
|
||||||
|
xchg ecx, [edi+4]
|
||||||
|
add edi, 8
|
||||||
|
jmp @b
|
||||||
|
@@:
|
||||||
|
pop edi
|
||||||
|
.common:
|
||||||
|
dec ebx
|
||||||
|
jnz .loop
|
||||||
|
@@:
|
||||||
|
dec esi
|
||||||
|
js @f
|
||||||
|
pop eax ecx
|
||||||
|
call free
|
||||||
|
jmp @b
|
||||||
|
@@:
|
||||||
|
ret
|
||||||
|
|
||||||
|
malloc_with_test:
|
||||||
|
; calls malloc() and checks returned value
|
||||||
|
call malloc
|
||||||
|
test eax, eax
|
||||||
|
jz generic_malloc_fail
|
||||||
|
call check_mutex
|
||||||
|
call check_range
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Stubs for kernel procedures used by heap code
|
||||||
|
wait_mutex:
|
||||||
|
inc dword [ebx]
|
||||||
|
ret
|
||||||
|
|
||||||
|
kernel_alloc:
|
||||||
|
cmp dword [esp+4], bufsize
|
||||||
|
jnz error1
|
||||||
|
mov eax, buffer
|
||||||
|
ret 4
|
||||||
|
|
||||||
|
macro $Revision [args]
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
; Error handlers
|
||||||
|
error1:
|
||||||
|
mov eax, 1
|
||||||
|
jmp error_with_code
|
||||||
|
|
||||||
|
generic_malloc_fail:
|
||||||
|
mov eax, 2
|
||||||
|
jmp error_with_code
|
||||||
|
|
||||||
|
check_mutex:
|
||||||
|
cmp [mst.mutex], 0
|
||||||
|
jnz @f
|
||||||
|
ret
|
||||||
|
@@:
|
||||||
|
mov eax, 3
|
||||||
|
jmp error_with_code
|
||||||
|
|
||||||
|
check_range:
|
||||||
|
cmp eax, buffer
|
||||||
|
jb @f
|
||||||
|
cmp eax, buffer+bufsize
|
||||||
|
jae @f
|
||||||
|
ret
|
||||||
|
@@:
|
||||||
|
mov eax, 4
|
||||||
|
jmp error_with_code
|
||||||
|
|
||||||
|
memory_destroyed:
|
||||||
|
mov eax, 5
|
||||||
|
jmp error_with_code
|
||||||
|
|
||||||
|
error_with_code:
|
||||||
|
mov edx, saved_state_num
|
||||||
|
; eax = error code
|
||||||
|
; 1 signals error in testing code (wrong bufsize)
|
||||||
|
; 2 = malloc() returned NULL
|
||||||
|
; 3 = mutex not released
|
||||||
|
; 4 = weird returned value from malloc()
|
||||||
|
; 5 = memory destroyed by malloc() or free()
|
||||||
|
int3 ; simplest way to report error
|
||||||
|
jmp $-1 ; just in case
|
||||||
|
|
||||||
|
; Include main heap code
|
||||||
|
include '../proc32.inc'
|
||||||
|
include '../const.inc'
|
||||||
|
include 'malloc.inc'
|
||||||
|
|
||||||
|
i_end:
|
||||||
|
|
||||||
|
align 4
|
||||||
|
zerostart:
|
||||||
|
mst MEM_STATE
|
||||||
|
|
||||||
|
align 16
|
||||||
|
bufsize = 0x40000 ; change if malloc.inc changes
|
||||||
|
buffer rb bufsize
|
||||||
|
zeroend:
|
||||||
|
|
||||||
|
saved_state_num dd ?
|
||||||
|
saved_state rd 0x10000
|
||||||
|
|
||||||
|
align 4
|
||||||
|
rb 0x10000 ; for stack
|
||||||
|
mem:
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -47,7 +47,6 @@ keymap_alt:
|
|||||||
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
boot_memdetect db 'Determining amount of memory',0
|
boot_memdetect db 'Determining amount of memory',0
|
||||||
boot_fonts db 'Fonts loaded',0
|
boot_fonts db 'Fonts loaded',0
|
||||||
boot_tss db 'Setting TSSs',0
|
boot_tss db 'Setting TSSs',0
|
||||||
@@ -119,34 +118,21 @@ shmem_list:
|
|||||||
.bk dd shmem_list
|
.bk dd shmem_list
|
||||||
.fd dd shmem_list
|
.fd dd shmem_list
|
||||||
|
|
||||||
|
dll_list:
|
||||||
|
.bk dd dll_list
|
||||||
|
.fd dd dll_list
|
||||||
|
|
||||||
|
MAX_DEFAULT_DLL_ADDR = 0x20000000
|
||||||
|
MIN_DEFAULT_DLL_ADDR = 0x10000000
|
||||||
|
dll_cur_addr dd MIN_DEFAULT_DLL_ADDR
|
||||||
|
|
||||||
; supported videomodes
|
; supported videomodes
|
||||||
|
|
||||||
mode_1280_1024_32:
|
|
||||||
dw 1280,1024,32,60
|
|
||||||
mode_1280_1024_24:
|
|
||||||
dw 1280,1024,24,60
|
|
||||||
mode_1024_768_32:
|
|
||||||
dw 1024,768,32,60
|
|
||||||
mode_1024_768_24:
|
|
||||||
dw 1024,768,24,60
|
|
||||||
mode_800_600_32:
|
|
||||||
dw 800,600,32,60
|
|
||||||
mode_800_600_24:
|
|
||||||
dw 800,600,24,60
|
|
||||||
mode_640_480_32:
|
|
||||||
dw 640,480,32,60
|
|
||||||
mode_640_480_24:
|
|
||||||
dw 640,480,24,60
|
|
||||||
mode_640_480_16:
|
|
||||||
dw 640,480,16,60
|
|
||||||
mode_320_240_8:
|
|
||||||
dw 320,240,8,60
|
|
||||||
|
|
||||||
; mike.dld {
|
; mike.dld {
|
||||||
db 0
|
db 0
|
||||||
dd servetable-0x10000
|
dd servetable-0x10000
|
||||||
draw_line dd __sys_draw_line
|
draw_line dd __sys_draw_line
|
||||||
disable_mouse dd __sys_disable_mouse
|
|
||||||
draw_pointer dd __sys_draw_pointer
|
draw_pointer dd __sys_draw_pointer
|
||||||
;//mike.dld, 2006-08-02 [
|
;//mike.dld, 2006-08-02 [
|
||||||
;drawbar dd __sys_drawbar
|
;drawbar dd __sys_drawbar
|
||||||
@@ -202,14 +188,14 @@ app_code_l:
|
|||||||
dw 0
|
dw 0
|
||||||
db 0
|
db 0
|
||||||
db cpl3
|
db cpl3
|
||||||
dw G32+D32+(new_app_base shr 16)+0xF;
|
dw G32+D32+0xF;
|
||||||
|
|
||||||
app_data_l:
|
app_data_l:
|
||||||
dw 0xFFFF
|
dw 0xFFFF
|
||||||
dw 0
|
dw 0
|
||||||
db 0
|
db 0
|
||||||
db drw3
|
db drw3
|
||||||
dw G32+D32+(new_app_base shr 16)+0xF;
|
dw G32+D32+0xF;
|
||||||
|
|
||||||
; ------------- PCI BIOS ------------------
|
; ------------- PCI BIOS ------------------
|
||||||
|
|
||||||
@@ -260,6 +246,14 @@ tss0_l:
|
|||||||
db (tss shr 16) and 0xFF
|
db (tss shr 16) and 0xFF
|
||||||
db 10001001b
|
db 10001001b
|
||||||
dw (tss shr 16) and 0xFF00
|
dw (tss shr 16) and 0xFF00
|
||||||
|
|
||||||
|
tls_data_l:
|
||||||
|
dw 0x0FFF
|
||||||
|
dw 0
|
||||||
|
db 0
|
||||||
|
db drw3
|
||||||
|
dw D32
|
||||||
|
|
||||||
endofcode:
|
endofcode:
|
||||||
gdte:
|
gdte:
|
||||||
|
|
||||||
@@ -321,22 +315,26 @@ os_stack_seg rd 1
|
|||||||
srv.fd rd 1
|
srv.fd rd 1
|
||||||
srv.bk rd 1
|
srv.bk rd 1
|
||||||
|
|
||||||
scr_width rd 1
|
|
||||||
scr_height rd 1
|
|
||||||
|
|
||||||
create_cursor rd 1
|
align 16
|
||||||
select_hw_cursor rd 1
|
|
||||||
set_hw_cursor rd 1
|
_display display_t
|
||||||
hw_restore rd 1
|
|
||||||
|
_WinMapAddress rd 1
|
||||||
|
_WinMapSize rd 1
|
||||||
|
|
||||||
def_cursor rd 1
|
def_cursor rd 1
|
||||||
current_cursor rd 1
|
current_cursor rd 1
|
||||||
hw_cursor rd 1
|
hw_cursor rd 1
|
||||||
cur_def_interl rd 1
|
|
||||||
cur_saved_base rd 1
|
cur_saved_base rd 1
|
||||||
cur_saved_interl rd 1
|
|
||||||
cur_saved_w rd 1
|
cur.lock rd 1 ;1 - lock update, 2- hide
|
||||||
cur_saved_h rd 1
|
cur.left rd 1 ;cursor clip box
|
||||||
|
cur.top rd 1
|
||||||
|
cur.right rd 1
|
||||||
|
cur.bottom rd 1
|
||||||
|
cur.w rd 1
|
||||||
|
cur.h rd 1
|
||||||
|
|
||||||
ipc_tmp rd 1
|
ipc_tmp rd 1
|
||||||
ipc_pdir rd 1
|
ipc_pdir rd 1
|
||||||
|
@@ -55,7 +55,8 @@ bdds:
|
|||||||
inc ax
|
inc ax
|
||||||
cmp word [si], 170h
|
cmp word [si], 170h
|
||||||
jz @f
|
jz @f
|
||||||
mov ax, -1
|
or ax,-1
|
||||||
|
; mov ax, -1
|
||||||
@@:
|
@@:
|
||||||
stosw
|
stosw
|
||||||
pop ds
|
pop ds
|
||||||
@@ -63,10 +64,14 @@ bdds:
|
|||||||
bddl:
|
bddl:
|
||||||
mov al, dl
|
mov al, dl
|
||||||
stosb
|
stosb
|
||||||
mov al, 0
|
xor ax,ax
|
||||||
stosb
|
stosb
|
||||||
mov ax, -1
|
dec ax
|
||||||
stosw
|
stosw
|
||||||
|
; mov al, 0
|
||||||
|
; stosb
|
||||||
|
; mov ax, -1
|
||||||
|
; stosw
|
||||||
bddc2:
|
bddc2:
|
||||||
cmp cl, [es:0x475]
|
cmp cl, [es:0x475]
|
||||||
jae bdde
|
jae bdde
|
||||||
|
@@ -24,7 +24,7 @@ $Revision$
|
|||||||
mov cx,0xff
|
mov cx,0xff
|
||||||
wait_cmos:
|
wait_cmos:
|
||||||
dec cx
|
dec cx
|
||||||
cmp cx,0
|
test cx,cx
|
||||||
jne wait_cmos
|
jnz wait_cmos
|
||||||
in al,0x71
|
in al,0x71
|
||||||
mov [DRIVE_DATA],al
|
mov [DRIVE_DATA],al
|
||||||
|
@@ -72,8 +72,9 @@ FindHDD_3:
|
|||||||
|
|
||||||
|
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LBA
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LBA
|
||||||
|
uglobal
|
||||||
SectorAddress DD ?
|
SectorAddress DD ?
|
||||||
|
endg
|
||||||
;*************************************************
|
;*************************************************
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
@@ -99,8 +100,8 @@ ReadHDD_ID:
|
|||||||
@@WaitCompleet:
|
@@WaitCompleet:
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
dec ecx
|
dec ecx
|
||||||
cmp ecx,0
|
; cmp ecx,0
|
||||||
je @@Error1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
jz @@Error1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
in AL,DX
|
in AL,DX
|
||||||
test AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
test AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
||||||
@@ -116,19 +117,21 @@ ReadHDD_ID:
|
|||||||
mov DX,[ATABasePortAddr] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
mov DX,[ATABasePortAddr] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov CX,256 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
mov CX,256 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
rep insw ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
rep insw ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
jmp @@End
|
ret
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@Error1:
|
@@Error1:
|
||||||
mov [DevErrorCode],1
|
mov [DevErrorCode],1
|
||||||
jmp @@End
|
ret
|
||||||
@@Error6:
|
@@Error6:
|
||||||
mov [DevErrorCode],6
|
mov [DevErrorCode],6
|
||||||
@@End: ret
|
@@End: ret
|
||||||
|
|
||||||
|
|
||||||
|
iglobal
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <EFBFBD> 2
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <EFBFBD> 2
|
||||||
StandardATABases DW 1F0h, 170h
|
StandardATABases DW 1F0h, 170h
|
||||||
|
endg
|
||||||
|
uglobal
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
ChannelNumber DW ?
|
ChannelNumber DW ?
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -148,8 +151,8 @@ ATACommand DB ? ;
|
|||||||
; 3 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 4 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
; 3 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 4 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||||
; 5 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 6 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; 5 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 6 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
DevErrorCode DB ?
|
DevErrorCode dd ?
|
||||||
|
endg
|
||||||
;****************************************************
|
;****************************************************
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||||
@@ -203,8 +206,8 @@ SendCommandToHDD:
|
|||||||
@@WaitHDReady:
|
@@WaitHDReady:
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
dec ecx
|
dec ecx
|
||||||
cmp ecx,0
|
; cmp ecx,0
|
||||||
je @@Err1
|
jz @@Err1
|
||||||
; mov eax,[timer_ticks]
|
; mov eax,[timer_ticks]
|
||||||
; sub eax,[TickCounter_1]
|
; sub eax,[TickCounter_1]
|
||||||
; cmp eax,300 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 300 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; cmp eax,300 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 300 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@ -253,19 +256,18 @@ SendCommandToHDD:
|
|||||||
sti
|
sti
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov [DevErrorCode],0
|
mov [DevErrorCode],0
|
||||||
jmp @@End_2
|
ret
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@Err1: mov [DevErrorCode],1
|
@@Err1: mov [DevErrorCode],1
|
||||||
jmp @@End_2
|
ret
|
||||||
@@Err2: mov [DevErrorCode],2
|
@@Err2: mov [DevErrorCode],2
|
||||||
jmp @@End_2
|
ret
|
||||||
@@Err3: mov [DevErrorCode],3
|
@@Err3: mov [DevErrorCode],3
|
||||||
jmp @@End_2
|
ret
|
||||||
@@Err4: mov [DevErrorCode],4
|
@@Err4: mov [DevErrorCode],4
|
||||||
jmp @@End_2
|
ret
|
||||||
@@Err5: mov [DevErrorCode],5
|
@@Err5: mov [DevErrorCode],5
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@End_2:
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;*************************************************
|
;*************************************************
|
||||||
@@ -297,8 +299,8 @@ ReadCD_ID:
|
|||||||
@@WaitCompleet_1:
|
@@WaitCompleet_1:
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
dec ecx
|
dec ecx
|
||||||
cmp ecx,0
|
; cmp ecx,0
|
||||||
je @@Error1_1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
jz @@Error1_1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
in AL,DX
|
in AL,DX
|
||||||
test AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
test AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
||||||
@@ -314,11 +316,11 @@ ReadCD_ID:
|
|||||||
mov DX,[ATABasePortAddr] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1x0h
|
mov DX,[ATABasePortAddr] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1x0h
|
||||||
mov CX,256 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
mov CX,256 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
rep insw
|
rep insw
|
||||||
jmp @@End_1
|
ret
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@Error1_1:
|
@@Error1_1:
|
||||||
mov [DevErrorCode],1
|
mov [DevErrorCode],1
|
||||||
jmp @@End_1
|
ret
|
||||||
@@Error6_1:
|
@@Error6_1:
|
||||||
mov [DevErrorCode],6
|
mov [DevErrorCode],6
|
||||||
@@End_1:
|
@@End_1:
|
||||||
@@ -360,7 +362,7 @@ DeviceReset:
|
|||||||
@@WaitHDReady_1:
|
@@WaitHDReady_1:
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
dec ecx
|
dec ecx
|
||||||
cmp ecx,0
|
; cmp ecx,0
|
||||||
je @@Err1_2 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
je @@Err1_2 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
in AL,DX
|
in AL,DX
|
||||||
@@ -369,15 +371,14 @@ DeviceReset:
|
|||||||
jnz @@WaitHDReady_1
|
jnz @@WaitHDReady_1
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
mov [DevErrorCode],0
|
mov [DevErrorCode],0
|
||||||
jmp @@End_3
|
ret
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@Err1_2: mov [DevErrorCode],1
|
@@Err1_2: mov [DevErrorCode],1
|
||||||
jmp @@End_3
|
ret
|
||||||
@@Err3_2: mov [DevErrorCode],3
|
@@Err3_2: mov [DevErrorCode],3
|
||||||
jmp @@End_3
|
ret
|
||||||
@@Err4_2: mov [DevErrorCode],4
|
@@Err4_2: mov [DevErrorCode],4
|
||||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@@End_3:
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
EndFindHDD:
|
EndFindHDD:
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
$Revision$
|
$Revision$
|
||||||
|
|
||||||
|
_esp equ esp
|
||||||
|
|
||||||
;
|
;
|
||||||
; Formatted Debug Output (FDO)
|
; Formatted Debug Output (FDO)
|
||||||
@@ -61,9 +62,11 @@ macro DEBUGS_N _sign,_num,[_str] {
|
|||||||
jmp ..label
|
jmp ..label
|
||||||
..str db _str,0
|
..str db _str,0
|
||||||
..label:
|
..label:
|
||||||
add esp,4*8+4
|
; add esp,4*8+4
|
||||||
|
esp equ esp+4*8+4
|
||||||
mov edx,..str
|
mov edx,..str
|
||||||
sub esp,4*8+4
|
esp equ _esp
|
||||||
|
; sub esp,4*8+4
|
||||||
else
|
else
|
||||||
mov edx,_str
|
mov edx,_str
|
||||||
end if
|
end if
|
||||||
@@ -147,7 +150,8 @@ macro DEBUGD_N _sign,_num,_dec {
|
|||||||
else if _dec eqtype 0
|
else if _dec eqtype 0
|
||||||
mov eax,_dec
|
mov eax,_dec
|
||||||
else
|
else
|
||||||
add esp,4*8+4
|
; add esp,4*8+4
|
||||||
|
esp equ esp+4*8+4
|
||||||
if _num eq
|
if _num eq
|
||||||
mov eax,dword _dec
|
mov eax,dword _dec
|
||||||
else if _num = 1
|
else if _num = 1
|
||||||
@@ -165,7 +169,8 @@ macro DEBUGD_N _sign,_num,_dec {
|
|||||||
else
|
else
|
||||||
mov eax,dword _dec
|
mov eax,dword _dec
|
||||||
end if
|
end if
|
||||||
sub esp,4*8+4
|
esp equ _esp
|
||||||
|
; sub esp,4*8+4
|
||||||
end if
|
end if
|
||||||
mov cl,_sign
|
mov cl,_sign
|
||||||
call fdo_debug_outdec
|
call fdo_debug_outdec
|
||||||
@@ -215,9 +220,11 @@ macro DEBUGH_N _sign,_num,_hex {
|
|||||||
else if _hex eqtype 0
|
else if _hex eqtype 0
|
||||||
mov eax,_hex
|
mov eax,_hex
|
||||||
else
|
else
|
||||||
add esp,4*8+4
|
; add esp,4*8+4
|
||||||
|
esp equ esp+4*8+4
|
||||||
mov eax,dword _hex
|
mov eax,dword _hex
|
||||||
sub esp,4*8+4
|
esp equ _esp
|
||||||
|
; sub esp,4*8+4
|
||||||
end if
|
end if
|
||||||
if ~_num eq
|
if ~_num eq
|
||||||
mov edx,_num
|
mov edx,_num
|
||||||
@@ -286,9 +293,8 @@ debug_beginf
|
|||||||
.l3: ret
|
.l3: ret
|
||||||
debug_endf
|
debug_endf
|
||||||
|
|
||||||
__fdo_hexdigits db '0123456789ABCDEF'
|
|
||||||
debug_func fdo_debug_outhex
|
debug_func fdo_debug_outhex
|
||||||
|
__fdo_hexdigits db '0123456789ABCDEF'
|
||||||
debug_beginf
|
debug_beginf
|
||||||
mov cl,dl
|
mov cl,dl
|
||||||
neg cl
|
neg cl
|
||||||
|
@@ -65,13 +65,13 @@ floppy_fileread:
|
|||||||
|
|
||||||
mov [save_flag],0
|
mov [save_flag],0
|
||||||
mov [path_pointer_flp],edi
|
mov [path_pointer_flp],edi
|
||||||
cmp esi,0 ; return ramdisk root
|
test esi,esi ; return ramdisk root
|
||||||
jne fr_noroot_1
|
jnz fr_noroot_1
|
||||||
cmp ebx,224/16
|
cmp ebx,224/16
|
||||||
jbe fr_do_1
|
jbe fr_do_1
|
||||||
mov eax,5
|
mov eax,5
|
||||||
mov ebx,0
|
xor ebx,ebx
|
||||||
mov [flp_status],0
|
mov [flp_status],ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fr_do_1:
|
fr_do_1:
|
||||||
@@ -88,26 +88,29 @@ fr_do_1:
|
|||||||
shl ecx,9
|
shl ecx,9
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
mov eax,0 ; ok read
|
xor eax,eax
|
||||||
mov ebx,0
|
xor ebx,ebx
|
||||||
mov [flp_status],0
|
; mov eax,0 ; ok read
|
||||||
|
; mov ebx,0
|
||||||
|
mov [flp_status],eax
|
||||||
ret
|
ret
|
||||||
fdc_status_error_1:
|
fdc_status_error_1:
|
||||||
mov [flp_status],0
|
xor eax,eax
|
||||||
|
mov [flp_status],eax
|
||||||
mov eax,10
|
mov eax,10
|
||||||
mov ebx,-1
|
or ebx,-1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fr_noroot_1:
|
fr_noroot_1:
|
||||||
sub esp,32
|
sub esp,32
|
||||||
call expand_filename
|
call expand_filename
|
||||||
frfloppy_1:
|
frfloppy_1:
|
||||||
cmp ebx,0
|
test ebx,ebx
|
||||||
jne frfl5_1
|
jnz frfl5_1
|
||||||
mov ebx,1
|
mov ebx,1
|
||||||
frfl5_1:
|
frfl5_1:
|
||||||
cmp ecx,0
|
test ecx,ecx
|
||||||
jne frfl6_1
|
jnz frfl6_1
|
||||||
mov ecx,1
|
mov ecx,1
|
||||||
frfl6_1:
|
frfl6_1:
|
||||||
dec ebx
|
dec ebx
|
||||||
@@ -137,14 +140,14 @@ l.21_1:
|
|||||||
add ecx,21
|
add ecx,21
|
||||||
add edi, ecx ;Advance to next entry
|
add edi, ecx ;Advance to next entry
|
||||||
dec dl
|
dec dl
|
||||||
cmp dl,0
|
test dl,dl
|
||||||
jne l.21_1
|
jnz l.21_1
|
||||||
dec dh
|
dec dh
|
||||||
cmp dh,0
|
test dh,dh
|
||||||
jne l.20_1
|
jnz l.20_1
|
||||||
fdc_status_error_3:
|
fdc_status_error_3:
|
||||||
mov eax,5 ; file not found ?
|
mov eax,5 ; file not found ?
|
||||||
mov ebx,-1
|
or ebx,-1
|
||||||
add esp,32+28
|
add esp,32+28
|
||||||
mov [flp_status],0
|
mov [flp_status],0
|
||||||
ret
|
ret
|
||||||
@@ -232,8 +235,8 @@ frnoread_1:
|
|||||||
add esp,4
|
add esp,4
|
||||||
pop ebx ; ebx <- eax : size of file
|
pop ebx ; ebx <- eax : size of file
|
||||||
add esp,36
|
add esp,36
|
||||||
mov eax,0
|
xor eax,eax
|
||||||
mov [flp_status],0
|
mov [flp_status],eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fdc_status_error_5:
|
fdc_status_error_5:
|
||||||
@@ -499,8 +502,8 @@ calculate_chs:
|
|||||||
div ebx
|
div ebx
|
||||||
mov [FDD_Track],al
|
mov [FDD_Track],al
|
||||||
mov [FDD_Head],0
|
mov [FDD_Head],0
|
||||||
cmp edx,0
|
test edx,edx
|
||||||
je no_head_2
|
jz no_head_2
|
||||||
inc [FDD_Head]
|
inc [FDD_Head]
|
||||||
no_head_2:
|
no_head_2:
|
||||||
mov dl,[old_track]
|
mov dl,[old_track]
|
||||||
@@ -2131,7 +2134,7 @@ fs_FloppySetFileInfo:
|
|||||||
popa
|
popa
|
||||||
pop edi
|
pop edi
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cmp [FDC_Status], 0
|
cmp [FDC_Status], al
|
||||||
jz @f
|
jz @f
|
||||||
mov al, 11
|
mov al, 11
|
||||||
@@:
|
@@:
|
||||||
|
@@ -169,6 +169,7 @@ reserve_hd_channel:
|
|||||||
call clear_hd_cache
|
call clear_hd_cache
|
||||||
@@:
|
@@:
|
||||||
pop eax
|
pop eax
|
||||||
|
sti
|
||||||
.ret:
|
.ret:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -372,7 +372,7 @@ file_system_lfn:
|
|||||||
mov edi, fs_additional_handlers
|
mov edi, fs_additional_handlers
|
||||||
@@:
|
@@:
|
||||||
cmp dword [edi], 0
|
cmp dword [edi], 0
|
||||||
jz @f
|
jz .notfound
|
||||||
call dword [edi]
|
call dword [edi]
|
||||||
scasd
|
scasd
|
||||||
scasd
|
scasd
|
||||||
@@ -967,43 +967,76 @@ process_replace_file_name:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
sys_current_directory:
|
sys_current_directory:
|
||||||
mov esi, [current_slot]
|
; mov esi, [current_slot]
|
||||||
mov esi, [esi+APPDATA.cur_dir]
|
; mov esi, [esi+APPDATA.cur_dir]
|
||||||
mov edx, esi
|
; mov edx, esi
|
||||||
dec eax
|
|
||||||
|
;get length string of appdata.cur_dir
|
||||||
|
mov eax, [current_slot]
|
||||||
|
mov edi, [eax+APPDATA.cur_dir]
|
||||||
|
|
||||||
|
dec ebx
|
||||||
jz .set
|
jz .set
|
||||||
dec eax
|
dec ebx
|
||||||
jz .get
|
jz .get
|
||||||
ret
|
ret
|
||||||
.get:
|
.get:
|
||||||
; sysfunction 30.2: [for app] eax=30,ebx=2,ecx->buffer,edx=len
|
; sysfunction 30.2: [for app] eax=30,ebx=2,ecx->buffer,edx=len
|
||||||
; for our code: ebx->buffer,ecx=len
|
; for our code: ebx->buffer,ecx=len
|
||||||
@@:
|
max_cur_dir equ 0x1000
|
||||||
lodsb
|
|
||||||
test al, al
|
mov ebx,edi
|
||||||
jnz @b
|
|
||||||
sub esi, edx
|
push ecx
|
||||||
inc esi
|
push edi
|
||||||
mov [esp+36], esi
|
|
||||||
cmp ecx, esi
|
xor eax,eax
|
||||||
|
mov ecx,max_cur_dir
|
||||||
|
|
||||||
|
repne scasb ;find zerro at and string
|
||||||
|
jnz .error ; no zero in cur_dir: internal error, should not happen
|
||||||
|
|
||||||
|
sub edi,ebx ;lenght for copy
|
||||||
|
inc edi
|
||||||
|
mov [esp+32+8],edi ;return in eax
|
||||||
|
|
||||||
|
cmp edx, edi
|
||||||
jbe @f
|
jbe @f
|
||||||
mov ecx, esi
|
mov edx, edi
|
||||||
@@:
|
@@:
|
||||||
cmp ecx, 1
|
;source string
|
||||||
|
pop esi
|
||||||
|
;destination string
|
||||||
|
pop edi
|
||||||
|
cmp edx, 1
|
||||||
jbe .ret
|
jbe .ret
|
||||||
mov esi, edx
|
|
||||||
mov edi, ebx
|
mov al,'/' ;start string with '/'
|
||||||
mov al, '/'
|
|
||||||
stosb
|
stosb
|
||||||
dec ecx
|
mov ecx,edx
|
||||||
dec ecx
|
rep movsb ;copy string
|
||||||
rep movsb
|
.ret: ret
|
||||||
mov byte [edi], 0
|
|
||||||
.ret:
|
.error: add esp,8
|
||||||
|
or dword [esp+32],-1 ;error not found zerro at string ->[eax+APPDATA.cur_dir]
|
||||||
ret
|
ret
|
||||||
.set:
|
.set:
|
||||||
; sysfunction 30.1: [for app] eax=30,ebx=1,ecx->string
|
; sysfunction 30.1: [for app] eax=30,ebx=1,ecx->string
|
||||||
; for our code: ebx->string to set
|
; for our code: ebx->string to set
|
||||||
|
; use generic resolver with APPDATA.cur_dir as destination
|
||||||
|
push max_cur_dir ;0x1000
|
||||||
|
push edi ;destination
|
||||||
|
mov ebx,ecx
|
||||||
|
call get_full_file_name
|
||||||
|
ret
|
||||||
|
|
||||||
|
; in: ebx = file name, [esp+4] = destination, [esp+8] = sizeof destination
|
||||||
|
; destroys all registers except ebp,esp
|
||||||
|
get_full_file_name:
|
||||||
|
push ebp
|
||||||
|
mov esi, [current_slot]
|
||||||
|
mov esi, [esi+APPDATA.cur_dir]
|
||||||
|
mov edx, esi
|
||||||
@@:
|
@@:
|
||||||
inc esi
|
inc esi
|
||||||
cmp byte [esi-1], 0
|
cmp byte [esi-1], 0
|
||||||
@@ -1012,6 +1045,7 @@ sys_current_directory:
|
|||||||
cmp byte [ebx], '/'
|
cmp byte [ebx], '/'
|
||||||
jz .set_absolute
|
jz .set_absolute
|
||||||
; string gives relative path
|
; string gives relative path
|
||||||
|
mov edi, [esp+8] ; destination
|
||||||
.relative:
|
.relative:
|
||||||
cmp byte [ebx], 0
|
cmp byte [ebx], 0
|
||||||
jz .set_ok
|
jz .set_ok
|
||||||
@@ -1032,33 +1066,67 @@ sys_current_directory:
|
|||||||
dec esi
|
dec esi
|
||||||
cmp byte [esi], '/'
|
cmp byte [esi], '/'
|
||||||
jnz @b
|
jnz @b
|
||||||
mov byte [esi], 0
|
|
||||||
add ebx, 3
|
add ebx, 3
|
||||||
jmp .relative
|
jmp .relative
|
||||||
|
.set_ok:
|
||||||
|
cmp edx, edi ; is destination equal to APPDATA.cur_dir?
|
||||||
|
jz .set_ok.cur_dir
|
||||||
|
sub esi, edx
|
||||||
|
cmp esi, [esp+12]
|
||||||
|
jb .set_ok.copy
|
||||||
|
.fail:
|
||||||
|
mov byte [edi], 0
|
||||||
|
xor eax, eax ; fail
|
||||||
|
pop ebp
|
||||||
|
ret 8
|
||||||
|
.set_ok.copy:
|
||||||
|
mov ecx, esi
|
||||||
|
mov esi, edx
|
||||||
|
rep movsb
|
||||||
|
mov byte [edi], 0
|
||||||
|
.ret.ok:
|
||||||
|
mov al, 1 ; ok
|
||||||
|
pop ebp
|
||||||
|
ret 8
|
||||||
|
.set_ok.cur_dir:
|
||||||
|
mov byte [esi], 0
|
||||||
|
jmp .ret.ok
|
||||||
.doset_relative:
|
.doset_relative:
|
||||||
add edx, 0x1000
|
cmp edx, edi
|
||||||
mov byte [esi], '/'
|
jz .doset_relative.cur_dir
|
||||||
inc esi
|
sub esi, edx
|
||||||
cmp esi, edx
|
cmp esi, [esp+12]
|
||||||
jae .overflow_esi
|
jae .fail
|
||||||
|
mov ecx, esi
|
||||||
|
mov esi, edx
|
||||||
|
mov edx, edi
|
||||||
|
rep movsb
|
||||||
|
jmp .doset_relative.copy
|
||||||
|
.doset_relative.cur_dir:
|
||||||
|
mov edi, esi
|
||||||
|
.doset_relative.copy:
|
||||||
|
add edx, [esp+12]
|
||||||
|
mov byte [edi], '/'
|
||||||
|
inc edi
|
||||||
|
cmp edi, edx
|
||||||
|
jae .overflow
|
||||||
@@:
|
@@:
|
||||||
mov al, [ebx]
|
mov al, [ebx]
|
||||||
inc ebx
|
inc ebx
|
||||||
mov [esi], al
|
stosb
|
||||||
inc esi
|
|
||||||
test al, al
|
test al, al
|
||||||
jz .set_ok
|
jz .ret.ok
|
||||||
cmp esi, edx
|
cmp edi, edx
|
||||||
jb @b
|
jb @b
|
||||||
.overflow_esi:
|
.overflow:
|
||||||
mov byte [esi-1], 0 ; force null-terminated string
|
dec edi
|
||||||
.set_ok:
|
jmp .fail
|
||||||
ret
|
|
||||||
.set_absolute:
|
.set_absolute:
|
||||||
lea esi, [ebx+1]
|
lea esi, [ebx+1]
|
||||||
call process_replace_file_name
|
call process_replace_file_name
|
||||||
mov edi, edx
|
mov edi, [esp+8]
|
||||||
add edx, 0x1000
|
mov edx, [esp+12]
|
||||||
|
add edx, edi
|
||||||
.set_copy:
|
.set_copy:
|
||||||
lodsb
|
lodsb
|
||||||
stosb
|
stosb
|
||||||
@@ -1067,13 +1135,11 @@ sys_current_directory:
|
|||||||
.set_copy_cont:
|
.set_copy_cont:
|
||||||
cmp edi, edx
|
cmp edi, edx
|
||||||
jb .set_copy
|
jb .set_copy
|
||||||
.overflow_edi:
|
jmp .overflow
|
||||||
mov byte [edi-1], 0
|
|
||||||
ret
|
|
||||||
.set_part2:
|
.set_part2:
|
||||||
mov esi, ebp
|
mov esi, ebp
|
||||||
xor ebp, ebp
|
xor ebp, ebp
|
||||||
test esi, esi
|
test esi, esi
|
||||||
jz .set_ok
|
jz .ret.ok
|
||||||
mov byte [edi-1], '/'
|
mov byte [edi-1], '/'
|
||||||
jmp .set_copy_cont
|
jmp .set_copy_cont
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
$Revision$
|
$Revision:1322 $
|
||||||
|
|
||||||
|
|
||||||
uglobal
|
uglobal
|
||||||
@@ -625,8 +625,8 @@ cd_get_name:
|
|||||||
mov ebp,[cd_current_pointer_of_input_2]
|
mov ebp,[cd_current_pointer_of_input_2]
|
||||||
mov [cd_current_pointer_of_input],ebp
|
mov [cd_current_pointer_of_input],ebp
|
||||||
mov eax,[ebp]
|
mov eax,[ebp]
|
||||||
cmp eax,0 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
test eax,eax ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||||
je .next_sector
|
jz .next_sector
|
||||||
cmp ebp,CDDataBuf+2048 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
cmp ebp,CDDataBuf+2048 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||||
jae .next_sector
|
jae .next_sector
|
||||||
movzx eax, byte [ebp]
|
movzx eax, byte [ebp]
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
|
|||||||
.1:
|
.1:
|
||||||
; } \\ Alver \\
|
; } \\ Alver \\
|
||||||
pushad
|
pushad
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
|
|
||||||
movsx eax, bx ; eax=y
|
movsx eax, bx ; eax=y
|
||||||
sar ebx, 16 ; ebx=x
|
sar ebx, 16 ; ebx=x
|
||||||
|
@@ -311,7 +311,6 @@ drawwindow_IV:
|
|||||||
; shr esi,1
|
; shr esi,1
|
||||||
; and esi,0x007f7f7f
|
; and esi,0x007f7f7f
|
||||||
mov esi,[ebp+SKIN_DATA.colors.outer]
|
mov esi,[ebp+SKIN_DATA.colors.outer]
|
||||||
or [edi+WDATA.fl_wdrawn], 4
|
|
||||||
call draw_rectangle
|
call draw_rectangle
|
||||||
mov ecx,3
|
mov ecx,3
|
||||||
_dw3l:
|
_dw3l:
|
||||||
@@ -455,12 +454,6 @@ drawwindow_IV:
|
|||||||
|
|
||||||
no_skin_add_button:
|
no_skin_add_button:
|
||||||
pop edi
|
pop edi
|
||||||
and [edi+WDATA.fl_wdrawn], not 4
|
|
||||||
test [edi+WDATA.fl_wdrawn], 2
|
|
||||||
jz @f
|
|
||||||
call drawwindowframes2
|
|
||||||
@@:
|
|
||||||
|
|
||||||
popa
|
popa
|
||||||
|
|
||||||
ret 4
|
ret 4
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -51,12 +51,13 @@ endg
|
|||||||
draw_mouse_under:
|
draw_mouse_under:
|
||||||
; return old picture
|
; return old picture
|
||||||
|
|
||||||
cmp [set_hw_cursor], 0
|
cmp [_display.restore_cursor], 0
|
||||||
jz @F
|
je @F
|
||||||
|
|
||||||
pushad
|
pushad
|
||||||
movzx eax,word [X_UNDER]
|
movzx eax,word [X_UNDER]
|
||||||
movzx ebx,word [Y_UNDER]
|
movzx ebx,word [Y_UNDER]
|
||||||
stdcall [hw_restore], eax, ebx
|
stdcall [_display.restore_cursor], eax, ebx
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
@@ -97,7 +98,7 @@ mres:
|
|||||||
|
|
||||||
save_draw_mouse:
|
save_draw_mouse:
|
||||||
|
|
||||||
cmp [set_hw_cursor], 0
|
cmp [_display.move_cursor], 0
|
||||||
je .no_hw_cursor
|
je .no_hw_cursor
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
@@ -111,28 +112,25 @@ save_draw_mouse:
|
|||||||
mov ecx, [Screen_Max_X]
|
mov ecx, [Screen_Max_X]
|
||||||
inc ecx
|
inc ecx
|
||||||
mul ecx
|
mul ecx
|
||||||
|
add eax, [_WinMapAddress]
|
||||||
movzx edx, byte [display_data+ebx+eax]
|
movzx edx, byte [ebx+eax]
|
||||||
shl edx, 8
|
shl edx, 8
|
||||||
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
|
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
|
||||||
|
|
||||||
cmp esi, [current_cursor]
|
cmp esi, [current_cursor]
|
||||||
je .draw
|
je .draw
|
||||||
|
|
||||||
; cmp [esi+CURSOR.magic], 'CURS'
|
|
||||||
; jne .fail
|
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
call [select_hw_cursor]
|
call [_display.select_cursor]
|
||||||
mov [current_cursor], esi
|
mov [current_cursor], esi
|
||||||
.draw:
|
.draw:
|
||||||
stdcall [set_hw_cursor], esi
|
stdcall [_display.move_cursor], esi
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
mov ecx, [def_cursor]
|
mov ecx, [def_cursor]
|
||||||
mov [edx+SLOT_BASE+APPDATA.cursor], ecx
|
mov [edx+SLOT_BASE+APPDATA.cursor], ecx
|
||||||
stdcall [set_hw_cursor], ecx ; stdcall: [esp]=ebx,eax
|
stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -292,7 +290,7 @@ __sys_disable_mouse:
|
|||||||
inc ecx
|
inc ecx
|
||||||
imul ecx,ebx
|
imul ecx,ebx
|
||||||
add ecx,eax
|
add ecx,eax
|
||||||
add ecx, display_data
|
add ecx, [_WinMapAddress]
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [CURRENT_TASK]
|
||||||
movzx ebx, byte [ecx]
|
movzx ebx, byte [ecx]
|
||||||
cmp eax,ebx
|
cmp eax,ebx
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -17,157 +17,159 @@ $Revision$
|
|||||||
; ebx =3 - set alarm-clock ecx - 00SSMMHH
|
; ebx =3 - set alarm-clock ecx - 00SSMMHH
|
||||||
; out: 0 -Ok 1 -wrong format 2 -battery low
|
; out: 0 -Ok 1 -wrong format 2 -battery low
|
||||||
sys_settime:
|
sys_settime:
|
||||||
mov ecx,eax
|
|
||||||
cli
|
cli
|
||||||
mov al,0x0d
|
mov al,0x0d
|
||||||
out 0x70,al
|
out 0x70,al
|
||||||
in al,0x71
|
in al,0x71
|
||||||
bt ax,7
|
bt ax,7
|
||||||
jnc bat_low
|
jnc bat_low
|
||||||
cmp ecx,2 ;day of week
|
cmp ebx,2 ;day of week
|
||||||
jne nosetweek
|
jne nosetweek
|
||||||
test ebx,ebx ;test day of week
|
test ecx,ecx ;test day of week
|
||||||
je wrongtime
|
je wrongtime
|
||||||
cmp ebx,7
|
cmp ecx,7
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
mov dx,0x70
|
mov edx,0x70
|
||||||
call startstopclk
|
call startstopclk
|
||||||
dec edx
|
dec edx
|
||||||
mov al,6
|
mov al,6
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
mov al,bl
|
mov al,cl
|
||||||
out dx,al
|
out dx,al
|
||||||
jmp endsettime
|
jmp endsettime
|
||||||
nosetweek: ;set date
|
nosetweek: ;set date
|
||||||
cmp ecx,1
|
cmp ebx,1
|
||||||
jne nosetdate
|
jne nosetdate
|
||||||
cmp bl,0x99 ;test year
|
cmp cl,0x99 ;test year
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
shl ebx,4
|
shl ecx,4
|
||||||
cmp bl,0x90
|
cmp cl,0x90
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
cmp bh,0x99 ;test month
|
cmp ch,0x99 ;test month
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
shr ebx,4
|
shr ecx,4
|
||||||
test bh,bh
|
test ch,ch
|
||||||
je wrongtime
|
je wrongtime
|
||||||
cmp bh,0x12
|
cmp ch,0x12
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
shl ebx,8
|
shl ecx,8
|
||||||
bswap ebx ;ebx=00YYMMDD
|
bswap ecx ;ebx=00YYMMDD
|
||||||
test bl,bl ;test day
|
test cl,cl ;test day
|
||||||
je wrongtime
|
je wrongtime
|
||||||
shl ebx,4
|
shl ecx,4
|
||||||
cmp bl,0x90
|
cmp cl,0x90
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
shr ebx,4
|
shr ecx,4
|
||||||
cmp bh,2 ;February
|
cmp ch,2 ;February
|
||||||
jne testday
|
jne testday
|
||||||
cmp bl,0x29
|
cmp cl,0x29
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
jmp setdate
|
jmp setdate
|
||||||
testday:
|
testday:
|
||||||
cmp bh,8
|
cmp ch,8
|
||||||
jb testday1 ;Aug-Dec
|
jb testday1 ;Aug-Dec
|
||||||
bt bx,8
|
bt cx,8
|
||||||
jnc days31
|
jnc days31
|
||||||
jmp days30
|
jmp days30
|
||||||
testday1:
|
testday1:
|
||||||
bt bx,8 ;Jan-Jul ex.Feb
|
bt cx,8 ;Jan-Jul ex.Feb
|
||||||
jnc days30
|
jnc days30
|
||||||
days31:
|
days31:
|
||||||
cmp bl,0x31
|
cmp cl,0x31
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
jmp setdate
|
jmp setdate
|
||||||
days30:
|
days30:
|
||||||
cmp bl,0x30
|
cmp cl,0x30
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
setdate:
|
setdate:
|
||||||
mov dx,0x70
|
mov edx,0x70
|
||||||
call startstopclk
|
call startstopclk
|
||||||
dec edx
|
dec edx
|
||||||
mov al,7 ;set days
|
mov al,7 ;set days
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
mov al,bl
|
mov al,cl
|
||||||
out dx,al
|
out dx,al
|
||||||
dec edx
|
dec edx
|
||||||
mov al,8 ;set months
|
mov al,8 ;set months
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
mov al,bh
|
mov al,ch
|
||||||
out dx,al
|
out dx,al
|
||||||
dec edx
|
dec edx
|
||||||
mov al,9 ;set years
|
mov al,9 ;set years
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
shr ebx,8
|
shr ecx,8
|
||||||
mov al,bh
|
mov al,ch
|
||||||
out dx,al
|
out dx,al
|
||||||
jmp endsettime
|
jmp endsettime
|
||||||
nosetdate: ;set time or alarm-clock
|
nosetdate: ;set time or alarm-clock
|
||||||
cmp ecx,3
|
cmp ebx,3
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
cmp bl,0x23
|
cmp cl,0x23
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
cmp bh,0x59
|
cmp ch,0x59
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
shl ebx,4
|
shl ecx,4
|
||||||
cmp bl,0x90
|
cmp cl,0x90
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
cmp bh,0x92
|
cmp ch,0x92
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
shl ebx,4
|
shl ecx,4
|
||||||
bswap ebx ;00HHMMSS
|
bswap ecx ;00HHMMSS
|
||||||
cmp bl,0x59
|
cmp cl,0x59
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
shl ebx,4
|
shl ecx,4
|
||||||
cmp bl,0x90
|
cmp cl,0x90
|
||||||
ja wrongtime
|
ja wrongtime
|
||||||
shr ebx,4
|
shr ecx,4
|
||||||
mov dx,0x70
|
|
||||||
|
mov edx,0x70
|
||||||
call startstopclk
|
call startstopclk
|
||||||
dec edx
|
dec edx
|
||||||
cmp ecx,3
|
cmp ebx,3
|
||||||
|
|
||||||
je setalarm
|
je setalarm
|
||||||
xor eax,eax ;al=0-set seconds
|
xor eax,eax ;al=0-set seconds
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
mov al,bl
|
mov al,cl
|
||||||
out dx,al
|
out dx,al
|
||||||
dec edx
|
dec edx
|
||||||
mov al,2 ;set minutes
|
mov al,2 ;set minutes
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
mov al,bh
|
mov al,ch
|
||||||
out dx,al
|
out dx,al
|
||||||
dec edx
|
dec edx
|
||||||
mov al,4 ;set hours
|
mov al,4 ;set hours
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
shr ebx,8
|
shr ecx,8
|
||||||
mov al,bh
|
mov al,ch
|
||||||
out dx,al
|
out dx,al
|
||||||
jmp endsettime
|
jmp endsettime
|
||||||
setalarm:
|
setalarm:
|
||||||
mov al,1 ;set seconds for al.
|
mov al,1 ;set seconds for al.
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
mov al,bl
|
mov al,cl
|
||||||
out dx,al
|
out dx,al
|
||||||
dec edx
|
dec edx
|
||||||
mov al,3 ;set minutes for al.
|
mov al,3 ;set minutes for al.
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
mov al,bh
|
mov al,ch
|
||||||
out dx,al
|
out dx,al
|
||||||
dec edx
|
dec edx
|
||||||
mov al,5 ;set hours for al.
|
mov al,5 ;set hours for al.
|
||||||
out dx,al
|
out dx,al
|
||||||
inc edx
|
inc edx
|
||||||
shr ebx,8
|
shr ecx,8
|
||||||
mov al,bh
|
mov al,ch
|
||||||
out dx,al
|
out dx,al
|
||||||
dec edx
|
dec edx
|
||||||
mov al,0x0b ;enable irq's
|
mov al,0x0b ;enable irq's
|
||||||
@@ -180,15 +182,15 @@ sys_settime:
|
|||||||
dec edx
|
dec edx
|
||||||
call startstopclk
|
call startstopclk
|
||||||
sti
|
sti
|
||||||
mov [esp+36],dword 0
|
and [esp+36-4],dword 0
|
||||||
ret
|
ret
|
||||||
bat_low:
|
bat_low:
|
||||||
sti
|
sti
|
||||||
mov [esp+36],dword 2
|
mov [esp+36-4],dword 2
|
||||||
ret
|
ret
|
||||||
wrongtime:
|
wrongtime:
|
||||||
sti
|
sti
|
||||||
mov [esp+36],dword 1
|
mov [esp+36-4],dword 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
startstopclk:
|
startstopclk:
|
||||||
|
@@ -114,9 +114,9 @@ proc init_mem
|
|||||||
mov edx, (OS_BASE/4096)
|
mov edx, (OS_BASE/4096)
|
||||||
jmp .set
|
jmp .set
|
||||||
@@:
|
@@:
|
||||||
cmp edx, (HEAP_BASE+HEAP_MIN_SIZE)/4096
|
cmp edx, (HEAP_BASE-OS_BASE+HEAP_MIN_SIZE)/4096
|
||||||
jae .set
|
jae .set
|
||||||
mov edx, (HEAP_BASE+HEAP_MIN_SIZE)/4096
|
mov edx, (HEAP_BASE-OS_BASE+HEAP_MIN_SIZE)/4096
|
||||||
.set:
|
.set:
|
||||||
mov [pg_data.kernel_pages-OS_BASE], edx
|
mov [pg_data.kernel_pages-OS_BASE], edx
|
||||||
shr edx, 10
|
shr edx, 10
|
||||||
@@ -205,19 +205,18 @@ proc init_page_map
|
|||||||
mov edi, [ebx]
|
mov edi, [ebx]
|
||||||
shr edi, 12 ; edi = first page
|
shr edi, 12 ; edi = first page
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
neg eax
|
|
||||||
shr edi, 5
|
shr edi, 5
|
||||||
|
shl edi, 2
|
||||||
add edi, sys_pgmap-OS_BASE
|
add edi, sys_pgmap-OS_BASE
|
||||||
and eax, 31
|
and eax, 31
|
||||||
jz .startok
|
jz .startok
|
||||||
sub ecx, eax
|
add ecx, eax
|
||||||
|
sub ecx, 32
|
||||||
jbe .onedword
|
jbe .onedword
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
xor eax, eax
|
or eax, -1
|
||||||
inc eax
|
|
||||||
shl eax, cl
|
shl eax, cl
|
||||||
dec eax
|
|
||||||
or [edi], eax
|
or [edi], eax
|
||||||
add edi, 4
|
add edi, 4
|
||||||
pop ecx
|
pop ecx
|
||||||
@@ -228,15 +227,17 @@ proc init_page_map
|
|||||||
rep stosd
|
rep stosd
|
||||||
pop ecx
|
pop ecx
|
||||||
and ecx, 31
|
and ecx, 31
|
||||||
not eax
|
neg eax
|
||||||
shl eax, cl
|
shl eax, cl
|
||||||
|
dec eax
|
||||||
or [edi], eax
|
or [edi], eax
|
||||||
jmp .next
|
jmp .next
|
||||||
.onedword:
|
.onedword:
|
||||||
add ecx, eax
|
add ecx, 32
|
||||||
|
sub ecx, eax
|
||||||
@@:
|
@@:
|
||||||
dec eax
|
|
||||||
bts [edi], eax
|
bts [edi], eax
|
||||||
|
inc eax
|
||||||
loop @b
|
loop @b
|
||||||
.next:
|
.next:
|
||||||
add ebx, 20
|
add ebx, 20
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -99,6 +99,14 @@ virtual at 0
|
|||||||
TASKDATA TASKDATA
|
TASKDATA TASKDATA
|
||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
|
TSTATE_RUNNING = 0
|
||||||
|
TSTATE_RUN_SUSPENDED = 1
|
||||||
|
TSTATE_WAIT_SUSPENDED = 2
|
||||||
|
TSTATE_ZOMBIE = 3
|
||||||
|
TSTATE_TERMINATING = 4
|
||||||
|
TSTATE_WAITING = 5
|
||||||
|
TSTATE_FREE = 9
|
||||||
|
|
||||||
; structures definition
|
; structures definition
|
||||||
struc WDATA {
|
struc WDATA {
|
||||||
.box BOX
|
.box BOX
|
||||||
@@ -109,11 +117,12 @@ struc WDATA {
|
|||||||
.fl_wstate db ?
|
.fl_wstate db ?
|
||||||
.fl_wdrawn db ?
|
.fl_wdrawn db ?
|
||||||
.fl_redraw db ?
|
.fl_redraw db ?
|
||||||
|
.sizeof:
|
||||||
}
|
}
|
||||||
virtual at 0
|
virtual at 0
|
||||||
WDATA WDATA
|
WDATA WDATA
|
||||||
end virtual
|
end virtual
|
||||||
label WDATA.fl_wstyle byte at 0x13
|
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
|
||||||
|
|
||||||
struc APPDATA
|
struc APPDATA
|
||||||
{
|
{
|
||||||
@@ -141,7 +150,9 @@ struc APPDATA
|
|||||||
.wait_begin dd ? ;+92 +++
|
.wait_begin dd ? ;+92 +++
|
||||||
.wait_test dd ? ;+96 +++
|
.wait_test dd ? ;+96 +++
|
||||||
.wait_param dd ? ;+100 +++
|
.wait_param dd ? ;+100 +++
|
||||||
db 24 dup(?) ;+104
|
.tls_base dd ? ;+104
|
||||||
|
.dlls_list_ptr dd ? ;+108
|
||||||
|
db 16 dup(?) ;+112
|
||||||
|
|
||||||
.wnd_shape dd ? ;+128
|
.wnd_shape dd ? ;+128
|
||||||
.wnd_shape_scale dd ? ;+132
|
.wnd_shape_scale dd ? ;+132
|
||||||
|
@@ -143,22 +143,24 @@ ReadNoteByte:
|
|||||||
;result:
|
;result:
|
||||||
; al - note
|
; al - note
|
||||||
push eax
|
push eax
|
||||||
push ebx
|
|
||||||
push ecx
|
push ecx
|
||||||
push edx
|
push edx
|
||||||
|
push esi
|
||||||
|
|
||||||
mov eax,[pidProcessNote]
|
mov eax,[pidProcessNote]
|
||||||
call pid_to_slot
|
call pid_to_slot
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jz .failed
|
jz .failed
|
||||||
lea ebx,[esp+12]
|
lea ecx,[esp+12]
|
||||||
mov ecx,1
|
mov edx,1
|
||||||
mov edx,[memAdrNote]
|
mov esi,[memAdrNote]
|
||||||
inc [memAdrNote]
|
inc [memAdrNote]
|
||||||
|
|
||||||
call read_process_memory
|
call read_process_memory
|
||||||
.failed:
|
.failed:
|
||||||
|
pop esi
|
||||||
pop edx
|
pop edx
|
||||||
pop ecx
|
pop ecx
|
||||||
pop ebx
|
|
||||||
pop eax
|
pop eax
|
||||||
ret
|
ret
|
||||||
;------------------- END CODE -------------------
|
;------------------- END CODE -------------------
|
||||||
|
@@ -32,7 +32,7 @@ virtual at 0
|
|||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc vesa_init_cursor stdcall, dst:dword, src:dword
|
proc init_cursor stdcall, dst:dword, src:dword
|
||||||
locals
|
locals
|
||||||
rBase dd ?
|
rBase dd ?
|
||||||
pQuad dd ?
|
pQuad dd ?
|
||||||
@@ -290,7 +290,7 @@ endp
|
|||||||
; ebx= src
|
; ebx= src
|
||||||
; ecx= flags
|
; ecx= flags
|
||||||
|
|
||||||
vesa_cursor:
|
create_cursor:
|
||||||
.src equ esp
|
.src equ esp
|
||||||
.flags equ esp+4
|
.flags equ esp+4
|
||||||
.hcursor equ esp+8
|
.hcursor equ esp+8
|
||||||
@@ -300,7 +300,7 @@ vesa_cursor:
|
|||||||
push ebx
|
push ebx
|
||||||
|
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
mov eax, CURSOR_SIZE
|
mov eax, CURSOR.sizeof
|
||||||
call create_kernel_object
|
call create_kernel_object
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
@@ -330,7 +330,32 @@ vesa_cursor:
|
|||||||
mov [edi+CURSOR.hot_x], ecx
|
mov [edi+CURSOR.hot_x], ecx
|
||||||
mov [edi+CURSOR.hot_y], edx
|
mov [edi+CURSOR.hot_y], edx
|
||||||
|
|
||||||
stdcall vesa_init_cursor, eax, esi
|
stdcall init_cursor, eax, esi
|
||||||
|
|
||||||
|
mov eax, [.hcursor]
|
||||||
|
lea eax, [eax+CURSOR.list_next]
|
||||||
|
lea edx, [_display.cr_list.next]
|
||||||
|
|
||||||
|
pushfd
|
||||||
|
cli
|
||||||
|
mov ecx, [edx]
|
||||||
|
|
||||||
|
mov [eax], ecx
|
||||||
|
mov [eax+4], edx
|
||||||
|
|
||||||
|
mov [ecx+4], eax
|
||||||
|
mov [edx], eax
|
||||||
|
popfd
|
||||||
|
|
||||||
|
mov eax, [.hcursor]
|
||||||
|
.check_hw:
|
||||||
|
cmp [_display.init_cursor], 0
|
||||||
|
je .fail
|
||||||
|
|
||||||
|
push eax
|
||||||
|
call [_display.init_cursor]
|
||||||
|
add esp, 4
|
||||||
|
|
||||||
mov eax, [.hcursor]
|
mov eax, [.hcursor]
|
||||||
.fail:
|
.fail:
|
||||||
add esp, 12
|
add esp, 12
|
||||||
@@ -346,8 +371,7 @@ vesa_cursor:
|
|||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
cld
|
cld
|
||||||
rep movsd
|
rep movsd
|
||||||
add esp, 12
|
jmp .check_hw
|
||||||
ret
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc load_cursor stdcall, src:dword, flags:dword
|
proc load_cursor stdcall, src:dword, flags:dword
|
||||||
@@ -377,7 +401,7 @@ proc load_cursor stdcall, src:dword, flags:dword
|
|||||||
mov eax, [CURRENT_TASK+eax+4]
|
mov eax, [CURRENT_TASK+eax+4]
|
||||||
mov ebx, [src]
|
mov ebx, [src]
|
||||||
mov ecx, [flags]
|
mov ecx, [flags]
|
||||||
call [create_cursor] ;eax, ebx, ecx
|
call create_cursor ;eax, ebx, ecx
|
||||||
mov [handle], eax
|
mov [handle], eax
|
||||||
|
|
||||||
cmp word [flags], LOAD_FROM_FILE
|
cmp word [flags], LOAD_FROM_FILE
|
||||||
@@ -407,8 +431,6 @@ proc delete_cursor stdcall, hcursor:dword
|
|||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
cmp [esi+CURSOR.magic], 'CURS'
|
cmp [esi+CURSOR.magic], 'CURS'
|
||||||
jne .fail
|
jne .fail
|
||||||
; cmp [esi+CURSOR.size], CURSOR_SIZE
|
|
||||||
; jne .fail
|
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [CURRENT_TASK]
|
||||||
shl ebx, 5
|
shl ebx, 5
|
||||||
@@ -443,127 +465,78 @@ destroy_cursor:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
select_cursor:
|
select_cursor:
|
||||||
|
mov eax, [esp+4]
|
||||||
|
mov [_display.cursor], eax
|
||||||
ret 4
|
ret 4
|
||||||
|
|
||||||
align 4
|
|
||||||
proc init_cursors
|
|
||||||
|
|
||||||
cmp [SCR_MODE],word 0x13
|
|
||||||
jbe .fail
|
|
||||||
|
|
||||||
test word [SCR_MODE], 0x4000
|
|
||||||
jz .fail
|
|
||||||
|
|
||||||
movzx eax, byte [ScreenBPP]
|
|
||||||
mov ebx, [BytesPerScanLine]
|
|
||||||
cmp eax, 32
|
|
||||||
jne @F
|
|
||||||
sub ebx, 128
|
|
||||||
jmp .init
|
|
||||||
@@:
|
|
||||||
cmp eax, 24
|
|
||||||
jne .fail
|
|
||||||
sub ebx, 96
|
|
||||||
.init:
|
|
||||||
mov [cur_def_interl], ebx
|
|
||||||
|
|
||||||
stdcall load_driver, szHwMouse
|
|
||||||
mov [hw_cursor], eax
|
|
||||||
test eax, eax
|
|
||||||
jz .sw_mouse
|
|
||||||
|
|
||||||
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
|
|
||||||
mov [def_cursor], eax
|
|
||||||
ret
|
|
||||||
.sw_mouse:
|
|
||||||
mov [create_cursor], vesa_cursor
|
|
||||||
|
|
||||||
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
|
|
||||||
mov [def_cursor], eax
|
|
||||||
|
|
||||||
mov ecx, [Screen_Max_X]
|
|
||||||
mov edx, [Screen_Max_Y]
|
|
||||||
inc ecx
|
|
||||||
inc edx
|
|
||||||
mov [scr_width], ecx
|
|
||||||
mov [scr_height], edx
|
|
||||||
|
|
||||||
movzx ebx, byte [ScreenBPP]
|
|
||||||
cmp ebx, 32
|
|
||||||
jne @F
|
|
||||||
|
|
||||||
|
|
||||||
mov dword [select_hw_cursor], select_cursor
|
|
||||||
mov dword [set_hw_cursor], cursor_32
|
|
||||||
mov dword [hw_restore], restore_32
|
|
||||||
ret
|
|
||||||
@@:
|
|
||||||
mov dword [select_hw_cursor], select_cursor
|
|
||||||
mov dword [set_hw_cursor], cursor_24
|
|
||||||
mov dword [hw_restore], restore_24
|
|
||||||
ret
|
|
||||||
.fail:
|
|
||||||
xor eax, eax
|
|
||||||
mov dword [select_hw_cursor], eax
|
|
||||||
mov dword [set_hw_cursor], eax
|
|
||||||
mov dword [hw_restore], eax
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc restore_24 stdcall, x:dword, y:dword
|
proc restore_24 stdcall, x:dword, y:dword
|
||||||
locals
|
|
||||||
w dd ?
|
|
||||||
endl
|
|
||||||
|
|
||||||
mov edi, [cur_saved_base]
|
push ebx
|
||||||
mov edx, [cur_saved_h]
|
|
||||||
mov ebx, [cur_saved_interl]
|
mov ebx, [cur_saved_base]
|
||||||
|
mov edx, [cur.h]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .ret
|
jz .ret
|
||||||
|
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
|
||||||
mov esi, cur_saved_data
|
mov esi, cur_saved_data
|
||||||
@@:
|
mov ecx, [cur.w]
|
||||||
mov ecx, [cur_saved_w]
|
|
||||||
lea ecx, [ecx+ecx*2]
|
lea ecx, [ecx+ecx*2]
|
||||||
|
push ecx
|
||||||
|
@@:
|
||||||
|
mov edi, ebx
|
||||||
|
add ebx, [BytesPerScanLine]
|
||||||
|
|
||||||
|
mov ecx, [esp]
|
||||||
rep movsb
|
rep movsb
|
||||||
add edi, ebx
|
|
||||||
dec edx
|
dec edx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
|
pop ecx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
.ret:
|
.ret:
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc restore_32 stdcall, x:dword, y:dword
|
proc restore_32 stdcall, x:dword, y:dword
|
||||||
locals
|
|
||||||
w dd ?
|
|
||||||
endl
|
|
||||||
|
|
||||||
mov edi, [cur_saved_base]
|
push ebx
|
||||||
mov edx, [cur_saved_h]
|
|
||||||
mov ebx, [cur_saved_interl]
|
mov ebx, [cur_saved_base]
|
||||||
|
mov edx, [cur.h]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .ret
|
jz .ret
|
||||||
|
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
|
||||||
mov esi, cur_saved_data
|
mov esi, cur_saved_data
|
||||||
@@:
|
@@:
|
||||||
mov ecx, [cur_saved_w]
|
mov edi, ebx
|
||||||
|
add ebx, [BytesPerScanLine]
|
||||||
|
|
||||||
|
mov ecx, [cur.w]
|
||||||
rep movsd
|
rep movsd
|
||||||
add edi, ebx
|
|
||||||
dec edx
|
dec edx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
|
pop edi
|
||||||
.ret:
|
.ret:
|
||||||
|
pop esi
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
||||||
locals
|
locals
|
||||||
w dd ?
|
|
||||||
h dd ?
|
h dd ?
|
||||||
st dd ?
|
|
||||||
_dx dd ?
|
_dx dd ?
|
||||||
_dy dd ?
|
_dy dd ?
|
||||||
endl
|
endl
|
||||||
@@ -575,87 +548,84 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub ecx, [esi+CURSOR.hot_x]
|
sub ecx, [esi+CURSOR.hot_x]
|
||||||
|
lea ebx, [ecx+32-1]
|
||||||
mov [x], ecx
|
mov [x], ecx
|
||||||
sets dl
|
sets dl
|
||||||
dec edx
|
dec edx
|
||||||
and ecx, edx ;clip x to 0<=x
|
and ecx, edx ;clip x to 0<=x
|
||||||
|
mov [cur.left], ecx
|
||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
sub edi, [x]
|
sub edi, [x]
|
||||||
mov [_dx], edi
|
mov [_dx], edi
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub eax, [esi+CURSOR.hot_y]
|
sub eax, [esi+CURSOR.hot_y]
|
||||||
|
lea edi, [eax+32-1]
|
||||||
mov [y], eax
|
mov [y], eax
|
||||||
sets dl
|
sets dl
|
||||||
dec edx
|
dec edx
|
||||||
and eax, edx ;clip y to 0<=y
|
and eax, edx ;clip y to 0<=y
|
||||||
mov edi, eax
|
mov [cur.top], eax
|
||||||
sub edi, [y]
|
|
||||||
mov [_dy], edi
|
|
||||||
|
|
||||||
mul ebx
|
|
||||||
lea esi, [ecx+ecx*2]
|
|
||||||
add esi, [LFBAddress]
|
|
||||||
add esi, eax
|
|
||||||
mov [cur_saved_base],esi
|
|
||||||
|
|
||||||
mov edi, [scr_width]
|
|
||||||
mov edx, [scr_height]
|
|
||||||
mov eax, 32
|
|
||||||
|
|
||||||
sub edi, ecx
|
|
||||||
cmp edi, eax
|
|
||||||
jng @F
|
|
||||||
mov edi, eax
|
|
||||||
@@:
|
|
||||||
sub edi, [_dx]
|
|
||||||
|
|
||||||
sub edx, [y]
|
|
||||||
cmp edx, eax
|
|
||||||
jng @F
|
|
||||||
mov edx, eax
|
mov edx, eax
|
||||||
|
sub edx, [y]
|
||||||
|
mov [_dy], edx
|
||||||
|
|
||||||
|
mul dword [BytesPerScanLine]
|
||||||
|
lea edx, [LFB_BASE+ecx*3]
|
||||||
|
add edx, eax
|
||||||
|
mov [cur_saved_base],edx
|
||||||
|
|
||||||
|
cmp ebx, [Screen_Max_X]
|
||||||
|
jbe @F
|
||||||
|
mov ebx, [Screen_Max_X]
|
||||||
@@:
|
@@:
|
||||||
sub edx, [_dy]
|
cmp edi, [Screen_Max_Y]
|
||||||
|
jbe @F
|
||||||
|
mov edi, [Screen_Max_Y]
|
||||||
|
@@:
|
||||||
|
mov [cur.right], ebx
|
||||||
|
mov [cur.bottom], edi
|
||||||
|
|
||||||
mov [w], edi
|
sub ebx, [x]
|
||||||
mov [h], edx
|
sub edi, [y]
|
||||||
mov [cur_saved_w], edi
|
inc ebx
|
||||||
mov [cur_saved_h], edx
|
inc edi
|
||||||
|
|
||||||
sub eax, edi
|
mov [cur.w], ebx
|
||||||
shl eax, 2 ;lea eax, [eax+eax*2]
|
mov [cur.h], edi
|
||||||
lea edi, [edi+edi*2]
|
mov [h], edi
|
||||||
sub ebx, edi
|
|
||||||
mov [cur_saved_interl], ebx
|
|
||||||
|
|
||||||
|
mov eax, edi
|
||||||
mov edi, cur_saved_data
|
mov edi, cur_saved_data
|
||||||
@@:
|
@@:
|
||||||
mov ecx, [w]
|
mov esi, edx
|
||||||
|
add edx, [BytesPerScanLine]
|
||||||
|
mov ecx, [cur.w]
|
||||||
lea ecx, [ecx+ecx*2]
|
lea ecx, [ecx+ecx*2]
|
||||||
rep movsb
|
rep movsb
|
||||||
add esi, ebx
|
dec eax
|
||||||
dec edx
|
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
;draw cursor
|
;draw cursor
|
||||||
mov edx, eax
|
mov ebx, [cur_saved_base]
|
||||||
mov edi, [cur_saved_base]
|
|
||||||
mov eax, [_dy]
|
mov eax, [_dy]
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
add eax, [_dx]
|
add eax, [_dx]
|
||||||
shl eax, 2
|
|
||||||
|
|
||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
mov esi, [esi+CURSOR.base]
|
mov esi, [esi+CURSOR.base]
|
||||||
add esi, eax
|
lea edx, [esi+eax*4]
|
||||||
.row:
|
.row:
|
||||||
mov ecx, [w]
|
mov ecx, [cur.w]
|
||||||
|
mov esi, edx
|
||||||
|
mov edi, ebx
|
||||||
|
add edx, 32*4
|
||||||
|
add ebx, [BytesPerScanLine]
|
||||||
.pix:
|
.pix:
|
||||||
lodsd
|
lodsd
|
||||||
test eax, 0xFF000000
|
test eax, 0xFF000000
|
||||||
jz @F
|
jz @F
|
||||||
|
mov [edi], ax
|
||||||
mov word [edi], ax
|
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [edi+2],al
|
mov [edi+2],al
|
||||||
@@:
|
@@:
|
||||||
@@ -663,19 +633,16 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
dec ecx
|
dec ecx
|
||||||
jnz .pix
|
jnz .pix
|
||||||
|
|
||||||
add esi, edx
|
|
||||||
add edi, ebx
|
|
||||||
dec [h]
|
dec [h]
|
||||||
jnz .row
|
jnz .row
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
||||||
locals
|
locals
|
||||||
w dd ?
|
|
||||||
h dd ?
|
h dd ?
|
||||||
st dd ?
|
|
||||||
_dx dd ?
|
_dx dd ?
|
||||||
_dy dd ?
|
_dy dd ?
|
||||||
endl
|
endl
|
||||||
@@ -683,83 +650,80 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
mov ecx, [x]
|
mov ecx, [x]
|
||||||
mov eax, [y]
|
mov eax, [y]
|
||||||
mov ebx, [BytesPerScanLine]
|
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub ecx, [esi+CURSOR.hot_x]
|
sub ecx, [esi+CURSOR.hot_x]
|
||||||
|
lea ebx, [ecx+32-1]
|
||||||
mov [x], ecx
|
mov [x], ecx
|
||||||
sets dl
|
sets dl
|
||||||
dec edx
|
dec edx
|
||||||
and ecx, edx ;clip x to 0<=x
|
and ecx, edx ;clip x to 0<=x
|
||||||
|
mov [cur.left], ecx
|
||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
sub edi, [x]
|
sub edi, [x]
|
||||||
mov [_dx], edi
|
mov [_dx], edi
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub eax, [esi+CURSOR.hot_y]
|
sub eax, [esi+CURSOR.hot_y]
|
||||||
|
lea edi, [eax+32-1]
|
||||||
mov [y], eax
|
mov [y], eax
|
||||||
sets dl
|
sets dl
|
||||||
dec edx
|
dec edx
|
||||||
and eax, edx ;clip y to 0<=y
|
and eax, edx ;clip y to 0<=y
|
||||||
mov edi, eax
|
mov [cur.top], eax
|
||||||
sub edi, [y]
|
|
||||||
mov [_dy], edi
|
|
||||||
|
|
||||||
mul ebx
|
|
||||||
lea esi, [eax+ecx*4]
|
|
||||||
add esi, [LFBAddress]
|
|
||||||
mov [cur_saved_base],esi
|
|
||||||
|
|
||||||
mov edi, [scr_width]
|
|
||||||
mov edx, [scr_height]
|
|
||||||
mov eax, 32
|
|
||||||
|
|
||||||
sub edi, ecx
|
|
||||||
cmp edi, eax
|
|
||||||
jng @F
|
|
||||||
mov edi, eax
|
|
||||||
@@:
|
|
||||||
sub edi, [_dx]
|
|
||||||
|
|
||||||
sub edx, [y]
|
|
||||||
cmp edx, eax
|
|
||||||
jng @F
|
|
||||||
mov edx, eax
|
mov edx, eax
|
||||||
|
sub edx, [y]
|
||||||
|
mov [_dy], edx
|
||||||
|
|
||||||
|
mul dword [BytesPerScanLine]
|
||||||
|
lea edx, [LFB_BASE+eax+ecx*4]
|
||||||
|
mov [cur_saved_base],edx
|
||||||
|
|
||||||
|
cmp ebx, [Screen_Max_X]
|
||||||
|
jbe @F
|
||||||
|
mov ebx, [Screen_Max_X]
|
||||||
@@:
|
@@:
|
||||||
sub edx, [_dy]
|
cmp edi, [Screen_Max_Y]
|
||||||
|
jbe @F
|
||||||
|
mov edi, [Screen_Max_Y]
|
||||||
|
@@:
|
||||||
|
mov [cur.right], ebx
|
||||||
|
mov [cur.bottom], edi
|
||||||
|
|
||||||
mov [w], edi
|
sub ebx, [x]
|
||||||
mov [h], edx
|
sub edi, [y]
|
||||||
mov [cur_saved_w], edi
|
inc ebx
|
||||||
mov [cur_saved_h], edx
|
inc edi
|
||||||
|
|
||||||
sub eax, edi
|
mov [cur.w], ebx
|
||||||
shl eax, 2
|
mov [cur.h], edi
|
||||||
shl edi, 2
|
mov [h], edi
|
||||||
sub ebx, edi
|
|
||||||
mov [cur_saved_interl], ebx
|
|
||||||
|
|
||||||
|
mov eax, edi
|
||||||
mov edi, cur_saved_data
|
mov edi, cur_saved_data
|
||||||
@@:
|
@@:
|
||||||
mov ecx, [w]
|
mov esi, edx
|
||||||
|
add edx, [BytesPerScanLine]
|
||||||
|
mov ecx, [cur.w]
|
||||||
rep movsd
|
rep movsd
|
||||||
add esi, ebx
|
dec eax
|
||||||
dec edx
|
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
;draw cursor
|
;draw cursor
|
||||||
mov edx, eax
|
mov ebx, [cur_saved_base]
|
||||||
mov edi, [cur_saved_base]
|
|
||||||
mov eax, [_dy]
|
mov eax, [_dy]
|
||||||
shl eax, 5
|
shl eax, 5
|
||||||
add eax, [_dx]
|
add eax, [_dx]
|
||||||
shl eax, 2
|
|
||||||
|
|
||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
mov esi, [esi+CURSOR.base]
|
mov esi, [esi+CURSOR.base]
|
||||||
add esi, eax
|
lea edx, [esi+eax*4]
|
||||||
.row:
|
.row:
|
||||||
mov ecx, [w]
|
mov ecx, [cur.w]
|
||||||
|
mov esi, edx
|
||||||
|
mov edi, ebx
|
||||||
|
add edx, 32*4
|
||||||
|
add ebx, [BytesPerScanLine]
|
||||||
.pix:
|
.pix:
|
||||||
lodsd
|
lodsd
|
||||||
test eax, 0xFF000000
|
test eax, 0xFF000000
|
||||||
@@ -769,13 +733,73 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
add edi, 4
|
add edi, 4
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .pix
|
jnz .pix
|
||||||
add esi, edx
|
|
||||||
add edi, ebx
|
|
||||||
dec [h]
|
dec [h]
|
||||||
jnz .row
|
jnz .row
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
|
get_display:
|
||||||
|
mov eax, _display
|
||||||
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
init_display:
|
||||||
|
|
||||||
|
xor eax, eax
|
||||||
|
mov edi, _display
|
||||||
|
|
||||||
|
mov [edi+display_t.init_cursor], eax
|
||||||
|
mov [edi+display_t.select_cursor], eax
|
||||||
|
mov [edi+display_t.show_cursor], eax
|
||||||
|
mov [edi+display_t.move_cursor], eax
|
||||||
|
mov [edi+display_t.restore_cursor], eax
|
||||||
|
|
||||||
|
lea ecx, [edi+display_t.cr_list.next]
|
||||||
|
mov [edi+display_t.cr_list.next], ecx
|
||||||
|
mov [edi+display_t.cr_list.prev], ecx
|
||||||
|
|
||||||
|
cmp [SCR_MODE],word 0x13
|
||||||
|
jbe .fail
|
||||||
|
|
||||||
|
test word [SCR_MODE], 0x4000
|
||||||
|
jz .fail
|
||||||
|
|
||||||
|
mov ebx, restore_32
|
||||||
|
mov ecx, move_cursor_32
|
||||||
|
movzx eax, byte [ScreenBPP]
|
||||||
|
cmp eax, 32
|
||||||
|
je @F
|
||||||
|
|
||||||
|
mov ebx, restore_24
|
||||||
|
mov ecx, move_cursor_24
|
||||||
|
cmp eax, 24
|
||||||
|
jne .fail
|
||||||
|
@@:
|
||||||
|
mov [_display.select_cursor], select_cursor
|
||||||
|
mov [_display.move_cursor], ecx
|
||||||
|
mov [_display.restore_cursor], ebx
|
||||||
|
|
||||||
|
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
|
||||||
|
mov [def_cursor], eax
|
||||||
|
ret
|
||||||
|
.fail:
|
||||||
|
xor eax, eax
|
||||||
|
mov [_display.select_cursor], eax
|
||||||
|
mov [_display.move_cursor], eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
def_arrow:
|
def_arrow:
|
||||||
file 'arrow.cur'
|
file 'arrow.cur'
|
||||||
|
@@ -242,7 +242,7 @@ end if
|
|||||||
|
|
||||||
vesa12_drawbackground:
|
vesa12_drawbackground:
|
||||||
|
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
push ebx
|
push ebx
|
||||||
@@ -258,7 +258,7 @@ vesa12_drawbackground:
|
|||||||
mov [imax],eax
|
mov [imax],eax
|
||||||
mov eax,[draw_data+32+RECT.left]
|
mov eax,[draw_data+32+RECT.left]
|
||||||
mov ebx,[draw_data+32+RECT.top]
|
mov ebx,[draw_data+32+RECT.top]
|
||||||
mov edi,0 ;no force
|
xor edi,edi ;no force
|
||||||
|
|
||||||
v12dp3:
|
v12dp3:
|
||||||
|
|
||||||
@@ -327,7 +327,8 @@ vesa12_drawbackground:
|
|||||||
mov eax,[Screen_Max_X]
|
mov eax,[Screen_Max_X]
|
||||||
add eax,1
|
add eax,1
|
||||||
mul ebx
|
mul ebx
|
||||||
cmp [eax+esi+WinMapAddress],byte 1
|
add eax, [_WinMapAddress]
|
||||||
|
cmp [eax+esi],byte 1
|
||||||
jnz v12nbgp
|
jnz v12nbgp
|
||||||
mov eax,[BytesPerScanLine]
|
mov eax,[BytesPerScanLine]
|
||||||
mov ebx,edi
|
mov ebx,edi
|
||||||
@@ -386,7 +387,7 @@ vesa12_drawbackground:
|
|||||||
|
|
||||||
vesa12_drawbar:
|
vesa12_drawbar:
|
||||||
|
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
|
|
||||||
;; mov [novesachecksum],dword 0
|
;; mov [novesachecksum],dword 0
|
||||||
sub edx,ebx
|
sub edx,ebx
|
||||||
@@ -494,7 +495,7 @@ dbpi24bit12:
|
|||||||
sub eax,VGABasePtr
|
sub eax,VGABasePtr
|
||||||
mov ebx,3
|
mov ebx,3
|
||||||
div ebx
|
div ebx
|
||||||
add eax,WinMapAddress
|
add eax, [_WinMapAddress]
|
||||||
mov ebx,[CURRENT_TASK]
|
mov ebx,[CURRENT_TASK]
|
||||||
cld
|
cld
|
||||||
|
|
||||||
@@ -585,7 +586,7 @@ dbpi24bit12:
|
|||||||
mov eax,edi
|
mov eax,edi
|
||||||
sub eax,VGABasePtr
|
sub eax,VGABasePtr
|
||||||
shr eax,2
|
shr eax,2
|
||||||
add eax,WinMapAddress
|
add eax, [_WinMapAddress]
|
||||||
mov ebx,[CURRENT_TASK]
|
mov ebx,[CURRENT_TASK]
|
||||||
cld
|
cld
|
||||||
|
|
||||||
@@ -753,7 +754,7 @@ vesa12_putimage:
|
|||||||
; mov ecx,320*65536+240
|
; mov ecx,320*65536+240
|
||||||
; mov edx,20*65536+20
|
; mov edx,20*65536+20
|
||||||
|
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
|
|
||||||
mov [novesachecksum],dword 0
|
mov [novesachecksum],dword 0
|
||||||
push esi
|
push esi
|
||||||
@@ -830,7 +831,7 @@ vesa12_putimage:
|
|||||||
sub edx,VGABasePtr
|
sub edx,VGABasePtr
|
||||||
mov ebx,3
|
mov ebx,3
|
||||||
div ebx
|
div ebx
|
||||||
add edx,WinMapAddress
|
add edx, [_WinMapAddress]
|
||||||
mov ebx,[CURRENT_TASK]
|
mov ebx,[CURRENT_TASK]
|
||||||
mov bh,[esp+4*3]
|
mov bh,[esp+4*3]
|
||||||
|
|
||||||
@@ -909,7 +910,7 @@ vesa12_putimage:
|
|||||||
mov edx,edi
|
mov edx,edi
|
||||||
sub edx,VGABasePtr
|
sub edx,VGABasePtr
|
||||||
shr edx,2
|
shr edx,2
|
||||||
add edx,WinMapAddress
|
add edx, [_WinMapAddress]
|
||||||
mov ebx,[CURRENT_TASK]
|
mov ebx,[CURRENT_TASK]
|
||||||
mov bh,[esp+4*3]
|
mov bh,[esp+4*3]
|
||||||
|
|
||||||
|
@@ -28,7 +28,6 @@ $Revision$
|
|||||||
;BytesPerScanLine equ 0xfe08
|
;BytesPerScanLine equ 0xfe08
|
||||||
;LFBAddress equ 0xfe80
|
;LFBAddress equ 0xfe80
|
||||||
;ScreenBPP equ 0xfbf1
|
;ScreenBPP equ 0xfbf1
|
||||||
;WinMapAddress equ 0x460000
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -54,16 +53,14 @@ Vesa20_getpixel24:
|
|||||||
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
lea edi, [eax+eax*2] ; edi = x*3
|
lea edi, [eax+eax*2] ; edi = x*3
|
||||||
add edi, ebx ; edi = x*3+(y*y multiplier)
|
add edi, ebx ; edi = x*3+(y*y multiplier)
|
||||||
add edi, [LFBAddress] ; ebx = where pixel is in memory
|
mov ecx, [LFB_BASE+edi]
|
||||||
mov ecx, [edi]
|
|
||||||
and ecx, 0xffffff
|
and ecx, 0xffffff
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Vesa20_getpixel32:
|
Vesa20_getpixel32:
|
||||||
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
||||||
add edi, [LFBAddress] ; ebx = where pixel is in memory
|
mov ecx, [LFB_BASE+edi]
|
||||||
mov ecx, [edi]
|
|
||||||
and ecx, 0xffffff
|
and ecx, 0xffffff
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -106,7 +103,7 @@ align 16
|
|||||||
|
|
||||||
vesa20_putimage:
|
vesa20_putimage:
|
||||||
pushad
|
pushad
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
sub esp, putimg.stack_data
|
sub esp, putimg.stack_data
|
||||||
; save pointer to image
|
; save pointer to image
|
||||||
mov [putimg.pti], ebx
|
mov [putimg.pti], ebx
|
||||||
@@ -194,13 +191,12 @@ vesa20_putimage:
|
|||||||
shr ebx, 3
|
shr ebx, 3
|
||||||
imul eax, ebx
|
imul eax, ebx
|
||||||
add edx, eax
|
add edx, eax
|
||||||
add edx, [LFBAddress]
|
|
||||||
; pointer to pixel map
|
; pointer to pixel map
|
||||||
mov eax, [putimg.abs_cy]
|
mov eax, [putimg.abs_cy]
|
||||||
imul eax, [Screen_Max_X]
|
imul eax, [Screen_Max_X]
|
||||||
add eax, [putimg.abs_cy]
|
add eax, [putimg.abs_cy]
|
||||||
add eax, [putimg.abs_cx]
|
add eax, [putimg.abs_cx]
|
||||||
add eax, WinMapAddress
|
add eax, [_WinMapAddress]
|
||||||
xchg eax, ebp
|
xchg eax, ebp
|
||||||
; get process number
|
; get process number
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [CURRENT_TASK]
|
||||||
@@ -220,9 +216,9 @@ align 4
|
|||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
; mov eax, [esi] ; eax = RRBBGGRR
|
; mov eax, [esi] ; eax = RRBBGGRR
|
||||||
mov [edx], ax
|
mov [LFB_BASE+edx], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [edx+2], al
|
mov [LFB_BASE+edx+2], al
|
||||||
.skip:
|
.skip:
|
||||||
; add esi, 3 ;[putimg.source_bpp]
|
; add esi, 3 ;[putimg.source_bpp]
|
||||||
add edx, 3
|
add edx, 3
|
||||||
@@ -265,7 +261,7 @@ align 4
|
|||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
; mov eax, [esi] ; ecx = RRBBGGRR
|
; mov eax, [esi] ; ecx = RRBBGGRR
|
||||||
mov [edx], eax
|
mov [LFB_BASE+edx], eax
|
||||||
.skip:
|
.skip:
|
||||||
; add esi, [putimg.source_bpp]
|
; add esi, [putimg.source_bpp]
|
||||||
add edx, 4
|
add edx, 4
|
||||||
@@ -308,20 +304,25 @@ __sys_putpixel:
|
|||||||
|
|
||||||
;;; mov [novesachecksum], dword 0
|
;;; mov [novesachecksum], dword 0
|
||||||
pushad
|
pushad
|
||||||
test edi,1 ; force ?
|
|
||||||
jnz .forced
|
|
||||||
; not forced:
|
|
||||||
push ecx ; save 24th bit in case negative pixel wanted
|
|
||||||
call checkpixel
|
|
||||||
test ecx,ecx
|
|
||||||
pop ecx
|
|
||||||
jnz .exit
|
|
||||||
.forced:
|
|
||||||
cmp [Screen_Max_X], eax
|
cmp [Screen_Max_X], eax
|
||||||
jb .exit
|
jb .exit
|
||||||
cmp [Screen_Max_Y], ebx
|
cmp [Screen_Max_Y], ebx
|
||||||
jb .exit
|
jb .exit
|
||||||
.ok:
|
test edi,1 ; force ?
|
||||||
|
jnz .forced
|
||||||
|
|
||||||
|
; not forced:
|
||||||
|
|
||||||
|
push eax
|
||||||
|
mov edx,[_display.width] ; screen x size
|
||||||
|
imul edx, ebx
|
||||||
|
add eax, [_WinMapAddress]
|
||||||
|
movzx edx, byte [eax+edx]
|
||||||
|
cmp edx, [CURRENT_TASK]
|
||||||
|
pop eax
|
||||||
|
jne .exit
|
||||||
|
|
||||||
|
.forced:
|
||||||
; check if negation
|
; check if negation
|
||||||
test ecx,0x01000000
|
test ecx,0x01000000
|
||||||
jz .noneg
|
jz .noneg
|
||||||
@@ -342,11 +343,9 @@ Vesa20_putpixel24:
|
|||||||
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
lea edi, [eax+eax*2] ; edi = x*3
|
lea edi, [eax+eax*2] ; edi = x*3
|
||||||
mov eax, [esp+32-8+4]
|
mov eax, [esp+32-8+4]
|
||||||
add edi, [LFBAddress]
|
mov [LFB_BASE+ebx+edi], ax
|
||||||
add edi, ebx ; ebx = where to put pixel in memory
|
|
||||||
mov [edi], ax
|
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [edi+2], al
|
mov [LFB_BASE+ebx+edi+2], al
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
@@ -357,8 +356,7 @@ Vesa20_putpixel32:
|
|||||||
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
||||||
mov eax, [esp+32-8+4] ; eax = color
|
mov eax, [esp+32-8+4] ; eax = color
|
||||||
add edi, [LFBAddress] ; ebx = where to put pixel in memory
|
mov [LFB_BASE+edi], eax
|
||||||
mov [edi], eax
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;*************************************************
|
;*************************************************
|
||||||
@@ -378,7 +376,7 @@ calculate_edi:
|
|||||||
align 4
|
align 4
|
||||||
__sys_draw_line:
|
__sys_draw_line:
|
||||||
; inc [mouse_pause]
|
; inc [mouse_pause]
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
|
|
||||||
; draw a line
|
; draw a line
|
||||||
; eax = HIWORD = x1
|
; eax = HIWORD = x1
|
||||||
@@ -568,7 +566,7 @@ align 4
|
|||||||
; edi color
|
; edi color
|
||||||
vesa20_drawbar:
|
vesa20_drawbar:
|
||||||
pushad
|
pushad
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
sub esp, drbar.stack_data
|
sub esp, drbar.stack_data
|
||||||
mov [drbar.color], edi
|
mov [drbar.color], edi
|
||||||
sub edx, ebx
|
sub edx, ebx
|
||||||
@@ -643,13 +641,12 @@ vesa20_drawbar:
|
|||||||
; shr ebx, 3
|
; shr ebx, 3
|
||||||
imul eax, ebx
|
imul eax, ebx
|
||||||
add edx, eax
|
add edx, eax
|
||||||
add edx, [LFBAddress]
|
|
||||||
; pointer to pixel map
|
; pointer to pixel map
|
||||||
mov eax, [drbar.abs_cy]
|
mov eax, [drbar.abs_cy]
|
||||||
imul eax, [Screen_Max_X]
|
imul eax, [Screen_Max_X]
|
||||||
add eax, [drbar.abs_cy]
|
add eax, [drbar.abs_cy]
|
||||||
add eax, [drbar.abs_cx]
|
add eax, [drbar.abs_cx]
|
||||||
add eax, WinMapAddress
|
add eax, [_WinMapAddress]
|
||||||
xchg eax, ebp
|
xchg eax, ebp
|
||||||
; get process number
|
; get process number
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [CURRENT_TASK]
|
||||||
@@ -674,8 +671,9 @@ align 4
|
|||||||
.new_x:
|
.new_x:
|
||||||
cmp byte [ebp], bl
|
cmp byte [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
mov [edx], bh
|
|
||||||
mov [edx + 1], ax
|
mov [LFB_BASE+edx], bh
|
||||||
|
mov [LFB_BASE+edx + 1], ax
|
||||||
.skip:
|
.skip:
|
||||||
; add pixel
|
; add pixel
|
||||||
add edx, 3
|
add edx, 3
|
||||||
@@ -710,7 +708,8 @@ align 4
|
|||||||
.new_x:
|
.new_x:
|
||||||
cmp byte [ebp], bl
|
cmp byte [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
mov [edx], eax
|
|
||||||
|
mov [LFB_BASE+edx], eax
|
||||||
.skip:
|
.skip:
|
||||||
; add pixel
|
; add pixel
|
||||||
add edx, 4
|
add edx, 4
|
||||||
@@ -737,62 +736,9 @@ align 4
|
|||||||
mov [EGA_counter],1
|
mov [EGA_counter],1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;voodoodbcplimit:
|
align 4
|
||||||
|
|
||||||
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
|
|
||||||
|
|
||||||
|
|
||||||
; pusha
|
|
||||||
|
|
||||||
; xor edx,edx
|
|
||||||
; mov eax,ebp
|
|
||||||
; mov ebx,[Screen_Max_X] ; Screen_X_size
|
|
||||||
; inc ebx ; +1
|
|
||||||
; sub eax,WinMapAddress ; -AddrBuffer
|
|
||||||
; div ebx ;
|
|
||||||
; mov ebx,eax ; ebx:=Y
|
|
||||||
; mov eax,edx ; eax:=X
|
|
||||||
; call cplimit
|
|
||||||
|
|
||||||
; test ecx,ecx
|
|
||||||
; jne dbcpl12
|
|
||||||
; popa
|
|
||||||
; clc
|
|
||||||
; ret
|
|
||||||
; dbcpl12:
|
|
||||||
; popa
|
|
||||||
; stc
|
|
||||||
; ret
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;dbcplimit:
|
|
||||||
|
|
||||||
; pusha
|
|
||||||
|
|
||||||
; xor edx,edx
|
|
||||||
; mov ebx,[Screen_Max_X]
|
|
||||||
; inc ebx
|
|
||||||
; sub eax,WinMapAddress
|
|
||||||
; div ebx
|
|
||||||
; mov ebx,eax
|
|
||||||
; mov eax,edx
|
|
||||||
; call cplimit
|
|
||||||
|
|
||||||
; test ecx,ecx
|
|
||||||
; jne dbcpl1
|
|
||||||
; popa
|
|
||||||
; clc
|
|
||||||
; ret
|
|
||||||
; dbcpl1:
|
|
||||||
; popa
|
|
||||||
; stc
|
|
||||||
; ret
|
|
||||||
|
|
||||||
|
|
||||||
vesa20_drawbackground_tiled:
|
vesa20_drawbackground_tiled:
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
pushad
|
pushad
|
||||||
; External loop for all y from start to end
|
; External loop for all y from start to end
|
||||||
mov ebx, [draw_data+32+RECT.top] ; y start
|
mov ebx, [draw_data+32+RECT.top] ; y start
|
||||||
@@ -810,10 +756,11 @@ dp2:
|
|||||||
jz @f
|
jz @f
|
||||||
add ebp, eax
|
add ebp, eax
|
||||||
@@:
|
@@:
|
||||||
add ebp, [LFBAddress]
|
add ebp, LFB_BASE
|
||||||
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
|
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
|
||||||
call calculate_edi
|
call calculate_edi
|
||||||
xchg edi, ebp
|
xchg edi, ebp
|
||||||
|
add ebp, [_WinMapAddress]
|
||||||
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
|
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
|
||||||
; 2) Calculate offset in background memory block
|
; 2) Calculate offset in background memory block
|
||||||
push eax
|
push eax
|
||||||
@@ -842,7 +789,7 @@ dp2:
|
|||||||
; esi -> bgr memory, edi -> output
|
; esi -> bgr memory, edi -> output
|
||||||
; ebp = offset in WinMapAddress
|
; ebp = offset in WinMapAddress
|
||||||
dp3:
|
dp3:
|
||||||
cmp [ebp+WinMapAddress], dl
|
cmp [ebp], dl
|
||||||
jnz nbgp
|
jnz nbgp
|
||||||
movsb
|
movsb
|
||||||
movsb
|
movsb
|
||||||
@@ -881,7 +828,7 @@ dp4:
|
|||||||
|
|
||||||
|
|
||||||
vesa20_drawbackground_stretch:
|
vesa20_drawbackground_stretch:
|
||||||
call [disable_mouse]
|
call [_display.disable_mouse]
|
||||||
pushad
|
pushad
|
||||||
; Helper variables
|
; Helper variables
|
||||||
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
|
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
|
||||||
@@ -917,7 +864,6 @@ vesa20_drawbackground_stretch:
|
|||||||
jz @f
|
jz @f
|
||||||
add ebp, eax
|
add ebp, eax
|
||||||
@@:
|
@@:
|
||||||
add ebp, [LFBAddress]
|
|
||||||
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
|
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
|
||||||
call calculate_edi
|
call calculate_edi
|
||||||
xchg edi, ebp
|
xchg edi, ebp
|
||||||
@@ -985,7 +931,8 @@ sdp3:
|
|||||||
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
|
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
|
||||||
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
|
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
|
||||||
sdp3a:
|
sdp3a:
|
||||||
cmp [ebp+WinMapAddress], byte 1
|
mov eax, [_WinMapAddress]
|
||||||
|
cmp [ebp+eax], byte 1
|
||||||
jnz snbgp
|
jnz snbgp
|
||||||
mov eax, [bgr_cur_line+esi]
|
mov eax, [bgr_cur_line+esi]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
@@ -993,9 +940,11 @@ sdp3a:
|
|||||||
mov ebx, [bgr_next_line+esi]
|
mov ebx, [bgr_next_line+esi]
|
||||||
call [overlapping_of_points_ptr]
|
call [overlapping_of_points_ptr]
|
||||||
.novert:
|
.novert:
|
||||||
mov [edi], ax
|
|
||||||
|
mov [LFB_BASE+edi], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [edi+2], al
|
|
||||||
|
mov [LFB_BASE+edi+2], al
|
||||||
snbgp:
|
snbgp:
|
||||||
cmp [ScreenBPP], byte 25
|
cmp [ScreenBPP], byte 25
|
||||||
sbb edi, -4
|
sbb edi, -4
|
||||||
|
@@ -175,8 +175,8 @@ checkVga_N13:
|
|||||||
cld
|
cld
|
||||||
m13pix:
|
m13pix:
|
||||||
lodsd
|
lodsd
|
||||||
cmp eax,0
|
test eax,eax
|
||||||
je .save_pixel
|
jz .save_pixel
|
||||||
push eax
|
push eax
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
and eax,(128+64+32) ; blue
|
and eax,(128+64+32) ; blue
|
||||||
@@ -259,8 +259,8 @@ VGA_draw_32_pixels:
|
|||||||
mov cl,8
|
mov cl,8
|
||||||
.convert_pixels_to_VGA:
|
.convert_pixels_to_VGA:
|
||||||
lodsd ; eax = 24bit colour
|
lodsd ; eax = 24bit colour
|
||||||
cmp eax,0
|
test eax,eax
|
||||||
je .end
|
jz .end
|
||||||
rol eax,8
|
rol eax,8
|
||||||
mov al,ch
|
mov al,ch
|
||||||
ror eax,8
|
ror eax,8
|
||||||
@@ -335,8 +335,8 @@ VGA_putpixel:
|
|||||||
pushfd
|
pushfd
|
||||||
; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
|
; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
cmp eax,0
|
test eax,eax
|
||||||
je .p13cont
|
jz .p13cont
|
||||||
cmp al,85
|
cmp al,85
|
||||||
jbe .p13green
|
jbe .p13green
|
||||||
or dl,0x01
|
or dl,0x01
|
||||||
|
@@ -24,15 +24,16 @@ uglobal
|
|||||||
old_screen_height dd ?
|
old_screen_height dd ?
|
||||||
endg
|
endg
|
||||||
|
|
||||||
cmp eax,13 ; CALL VIDEOMODE DRIVER FUNCTIONS
|
; cmp eax,13 ; CALL VIDEOMODE DRIVER FUNCTIONS
|
||||||
jne .no_vmode_drv_access
|
dec ebx
|
||||||
|
jnz .no_vmode_drv_access
|
||||||
pushd [Screen_Max_X] [Screen_Max_Y]
|
pushd [Screen_Max_X] [Screen_Max_Y]
|
||||||
popd [old_screen_height] [old_screen_width]
|
popd [old_screen_height] [old_screen_width]
|
||||||
or eax,-1 ; If driver is absent then eax does not change
|
or eax,-1 ; If driver is absent then eax does not change
|
||||||
call (VMODE_BASE+0x100) ; Entry point of video driver
|
call (VMODE_BASE+0x100) ; Entry point of video driver
|
||||||
mov [esp+36],eax
|
mov [esp+36-4],eax
|
||||||
mov [esp+24],ebx
|
mov [esp+24-4],ebx
|
||||||
mov [esp+32],ecx
|
mov [esp+32-4],ecx
|
||||||
; mov [esp+28],edx
|
; mov [esp+28],edx
|
||||||
mov eax,[old_screen_width]
|
mov eax,[old_screen_width]
|
||||||
mov ebx,[old_screen_height]
|
mov ebx,[old_screen_height]
|
||||||
@@ -46,8 +47,8 @@ endg
|
|||||||
sub [screen_workarea.bottom],ebx
|
sub [screen_workarea.bottom],ebx
|
||||||
|
|
||||||
call repos_windows
|
call repos_windows
|
||||||
mov eax, 0
|
xor eax,eax
|
||||||
mov ebx, 0
|
xor ebx,ebx
|
||||||
mov ecx, [Screen_Max_X]
|
mov ecx, [Screen_Max_X]
|
||||||
mov edx, [Screen_Max_Y]
|
mov edx, [Screen_Max_Y]
|
||||||
call calculatescreen
|
call calculatescreen
|
||||||
|
Reference in New Issue
Block a user