Subversion Repositories Kolibri OS

Rev

Rev 431 | Rev 488 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 431 Rev 465
Line 1... Line 1...
1
$Revision: 431 $
1
$Revision: 465 $
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;                                                              ;;
3
;;                                                              ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 8... Line -...
8
 
-
 
9
DRV_ENTRY    equ  1
-
 
10
DRV_EXIT     equ -1
8
 
11
DRV_COMPAT   equ  4  ;minimal required drivers version
9
DRV_COMPAT   equ  5  ;minimal required drivers version
Line 12... Line 10...
12
DRV_CURRENT  equ  4  ;current drivers model version
10
DRV_CURRENT  equ  5  ;current drivers model version
Line 13... Line 11...
13
 
11
 
14
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
12
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
Line 132... Line 130...
132
	   jmp .main
130
	   jmp .main
Line 133... Line 131...
133
 
131
 
134
align 16
132
align 16
135
.main:
133
.main:
136
	   save_ring3_context
134
	   save_ring3_context
137
	   mov	 bx, os_data
135
           mov   bx, app_data  ;os_data
138
	   mov	 ds, bx
136
	   mov	 ds, bx
Line 139... Line 137...
139
	   mov	 es, bx
137
	   mov	 es, bx
140
 
138
 
Line 159... Line 157...
159
 
157
 
160
align 4
158
align 4
Line 161... Line 159...
161
proc get_notify stdcall, p_ev:dword
159
proc get_notify stdcall, p_ev:dword
162
 
160
 
163
.wait:
-
 
164
           mov ebx,[CURRENT_TASK]
161
.wait:
165
           shl ebx,8
162
           mov ebx,[current_slot]
166
           test dword [ebx+SLOT_BASE+0xA8],EVENT_NOTIFY
163
           test dword [ebx+APPDATA.event_mask],EVENT_NOTIFY
167
	   jz @f
164
	   jz @f
168
           and dword [ebx+SLOT_BASE+0xA8], not EVENT_NOTIFY
165
           and dword [ebx+APPDATA.event_mask], not EVENT_NOTIFY
169
	   mov edi, [p_ev]
166
	   mov edi, [p_ev]
170
	   mov dword [edi], EV_INTR
167
	   mov dword [edi], EV_INTR
171
           mov eax, [ebx+SLOT_BASE+APPDATA.event]
168
           mov eax, [ebx+APPDATA.event]
172
	   mov dword [edi+4], eax
169
	   mov dword [edi+4], eax
173
	   ret
170
	   ret
174
@@:
171
@@:
Line 254... Line 251...
254
; retval
251
; retval
255
;  eax= error code
252
;  eax= error code
Line 256... Line 253...
256
 
253
 
257
align 4
254
align 4
258
srv_handlerEx:
255
srv_handlerEx:
259
           test ebx, ebx
256
           cmp ebx, OS_BASE
260
           jz .fail
-
 
Line 261... Line 257...
261
           add ebx, new_app_base
257
           jae .fail
262
 
258
 
263
           mov eax, [ebx+handle]
259
           mov eax, [ebx+handle]
Line 264... Line 260...
264
           cmp [eax+SRV.magic], ' SRV'
260
           cmp [eax+SRV.magic], ' SRV'
265
	   jne .fail
261
	   jne .fail
Line 266... Line -...
266
 
-
 
267
           cmp [eax+SRV.size], SRV_SIZE
-
 
268
	   jne .fail
-
 
269
 
262
 
270
           add [ebx+input], new_app_base
263
           cmp [eax+SRV.size], SRV_SIZE
271
           add [ebx+output], new_app_base
264
	   jne .fail
272
 
265
 
273
           stdcall [eax+SRV.srv_proc], ebx
266
           stdcall [eax+SRV.srv_proc], ebx
Line 408... Line 401...
408
             name    dd ?
401
             name    dd ?
409
           endl
402
           endl
Line 410... Line 403...
410
 
403
 
411
           xor eax, eax
404
           xor eax, eax
412
           mov ebx, [file_name]
405
           mov ebx, [file_name]
413
           sub ebx, new_app_base
406
    ;       sub ebx, new_app_base
414
           mov ecx, [info]
407
           mov ecx, [info]
Line 415... Line 408...
415
           sub ecx, new_app_base
408
    ;       sub ecx, new_app_base
416
 
409
 
417
           mov [cmd], 5
410
           mov [cmd], 5
418
           mov [offset], eax
411
           mov [offset], eax
Line 422... Line 415...
422
           mov byte [buff+4], al
415
           mov byte [buff+4], al
423
           mov [name], ebx
416
           mov [name], ebx
Line 424... Line 417...
424
 
417
 
425
           mov eax, 70
418
           mov eax, 70
426
           lea ebx, [cmd]
419
           lea ebx, [cmd]
427
           sub ebx, new_app_base
420
     ;      sub ebx, new_app_base
428
           int 0x40
421
           int 0x40
429
           ret
422
           ret
Line 430... Line 423...
430
endp
423
endp
Line 445... Line 438...
445
           xor eax, eax
438
           xor eax, eax
446
           mov ebx, [file_name]
439
           mov ebx, [file_name]
447
           mov ecx, [off]
440
           mov ecx, [off]
448
           mov edx, [bytes]
441
           mov edx, [bytes]
449
           mov esi, [buffer]
442
           mov esi, [buffer]
450
           sub ebx, new_app_base
-
 
451
           sub esi, new_app_base
-
 
Line 452... Line 443...
452
 
443
 
453
           mov [cmd], eax
444
           mov [cmd], eax
454
           mov [offset], ecx
445
           mov [offset], ecx
455
           mov [offset+4], eax
446
           mov [offset+4], eax
Line 459... Line 450...
459
           mov [name], ebx
450
           mov [name], ebx
Line 460... Line 451...
460
 
451
 
461
           pushad
452
           pushad
462
           push eax
453
           push eax
463
           lea eax, [cmd]
-
 
464
           sub eax, new_app_base
454
           lea eax, [cmd]
465
           call file_system_lfn
455
           call file_system_lfn
466
           pop eax
456
           pop eax
467
           popad
457
           popad
468
           ret
458
           ret
Line 917... Line 907...
917
           jnz .copy
907
           jnz .copy
918
           add edi, [eax+CFS.SizeOfRawData]
908
           add edi, [eax+CFS.SizeOfRawData]
919
           jmp .next
909
           jmp .next
920
.copy:
910
.copy:
921
           add esi, edx
911
           add esi, edx
922
           add edi, new_app_base
912
    ;       add edi, new_app_base
923
           mov ecx, [eax+CFS.SizeOfRawData]
913
           mov ecx, [eax+CFS.SizeOfRawData]
924
           cld
914
           cld
925
           rep movsb
915
           rep movsb
926
.next:
916
.next:
927
           add edi, 15-new_app_base
917
           add edi, 15 ;-new_app_base
928
           and edi, not 15
918
           and edi, -16
929
           add eax, COFF_SECTION_SIZE
919
           add eax, COFF_SECTION_SIZE
930
           dec ebx
920
           dec ebx
931
           jnz @B
921
           jnz @B
Line 932... Line 922...
932
 
922
 
Line 1004... Line 994...
1004
           call malloc
994
           call malloc
1005
           pop ebx
995
           pop ebx
1006
           test eax, eax
996
           test eax, eax
1007
           jz .fail
997
           jz .fail
Line 1008... Line 998...
1008
 
998
 
1009
           mov ecx,[CURRENT_TASK]
-
 
1010
           shl ecx,8
999
           mov ecx,[current_slot]
Line 1011... Line 1000...
1011
           add ecx, SLOT_BASE+APP_OBJ_OFFSET
1000
           add ecx, APP_OBJ_OFFSET
1012
 
1001
 
1013
           pushfd
1002
           pushfd
1014
           cli
1003
           cli
Line 1046... Line 1035...
1046
 
1035
 
1047
           call free           ;release object memory
1036
           call free           ;release object memory
Line -... Line 1037...
-
 
1037
           ret
-
 
1038
 
-
 
1039
 
-
 
1040
 
-
 
1041
if 0
-
 
1042
 
-
 
1043
irq:
1048
           ret
1044
 
1049
 
1045
.irq0:
1050
 
1046
           pusfd
1051
;szSound        db 'SOUND',0
1047
           pushad
-
 
1048
           push IRQ_0
1052
;szInfinity     db 'INFINITY',0
1049
           jmp .master
1053
szHwMouse      db 'ATI2D',0
1050
.irq_1:
1054
 
1051
           pusfd
1055
szSTART        db 'START',0
1052
           pushad
-
 
1053
           push IRQ_1
1056
szEXPORTS      db 'EXPORTS',0
1054
           jmp .master
-
 
1055
 
1057
szIMPORTS      db 'IMPORTS',0
1056
.master:
-
 
1057
           mov ax, app_data
1058
 
1058
           mov ds, eax
-
 
1059
           mov es, eax
-
 
1060
           mov ebx, [esp+4]  ;IRQ_xx
1059
msg_unresolved db 'unresolved ',0
1061
           mov eax, [irq_handlers+ebx+4]
-
 
1062
           call intr_handler
-
 
1063
           mov ecx, [esp+4]
-
 
1064
           cmp [irq_actids+ecx*4], 0
-
 
1065
           je @F
1060
msg_module     db 'in module ',0
1066
           in al, 0x21
-
 
1067
           bts eax, ecx
-
 
1068
           out 0x21, al
1061
msg_version    db 'incompatible driver version',13,10,0
1069
           mov al, 0x20
1062
msg_www        db 'please visit www.kolibrios.org',13,10,0
1070
           out 0x20, al
-
 
1071
           jmp .restart
-
 
1072
 
-
 
1073
.slave:
-
 
1074
           mov ax, app_data
-
 
1075
           mov ds, eax
-
 
1076
           mov es, eax
-
 
1077
           mov ebx, [esp+4]  ;IRQ_xx
1063
msg_CR         db  13,10,0
1078
           mov eax, [irq_handlers+ebx+4]
-
 
1079
           call intr_handler
-
 
1080
           mov ecx, [esp+4]
-
 
1081
           sub ecx, 8
-
 
1082
           cmp [irq_actids+ecx*4], 0
-
 
1083
           je @F
1064
 
1084
           in al, 0xA1
-
 
1085
           bts eax, ecx
-
 
1086
           out 0xA1, al
-
 
1087
           mov al, 0x20
-
 
1088
           out 0xA0, al
-
 
1089
           out 0x20, al
1065
align 4
1090
.restart:
-
 
1091
           mov ebx, [next_slot]
-
 
1092
           test ebx, ebx
-
 
1093
           jz @F
-
 
1094
           mov [next_task],0
-
 
1095
           mov esi, [prev_slot]
-
 
1096
           call do_change_task
-
 
1097
           add esp, 4
-
 
1098
           iretd
-
 
1099
 
-
 
1100
end if
-
 
1101