Subversion Repositories Kolibri OS

Rev

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

Rev 862 Rev 864
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 862 $
8
$Revision: 864 $
9
 
9
 
10
 
10
 
Line 35... Line 35...
35
 
35
 
Line 36... Line 36...
36
           ret
36
           ret
Line 37... Line -...
37
 
-
 
38
proc map_io_mem stdcall, base:dword, size:dword, flags:dword
37
 
-
 
38
proc map_io_mem stdcall, base:dword, size:dword, flags:dword
39
 
39
 
40
           push ebx
40
           push edi
41
           push edi
41
 
42
           mov eax, [size]
42
           mov ecx, [size]
-
 
43
           add ecx, 4095
43
           add eax, 4095
44
           and ecx, -4096
44
           and eax, -4096
45
           mov [size], ecx
45
           mov [size], eax
46
           xor edx, edx
46
           stdcall alloc_kernel_space, eax
-
 
Line 47... Line 47...
47
           test eax, eax
47
           call @mem_alloc@8
48
           jz .fail
48
           test eax, eax
-
 
49
           jz .fail
-
 
50
 
-
 
51
           mov edx, eax
49
           push eax
52
           mov edi, eax
50
 
-
 
51
           mov edi, 0x1000
-
 
52
           mov ebx, eax
53
           shr edi, 10
-
 
54
           add edi, page_tabs
53
           mov ecx,[size]
55
 
54
           mov edx, [base]
56
           mov ecx, [size]
55
           shr eax, 12
57
           shr ecx, 12
56
           shr ecx, 12
-
 
57
           and edx, -4096
-
 
58
           or edx, [flags]
-
 
59
@@:
-
 
60
           mov [page_tabs+eax*4], edx
58
           mov eax, [base]
61
          ; push eax
-
 
62
          ; invlpg [ebx]
59
           and eax, -4096
63
          ; pop eax
60
           or eax, [flags]
Line 64... Line -...
64
           inc eax
-
 
65
           add ebx, edi
61
@@:
66
           add edx, edi
62
           stosd
67
           loop @B
63
           add eax, 0x1000
68
 
64
           loop @B
69
           pop eax
65
 
70
           mov edx, [base]
-
 
71
           and edx, 4095
66
           mov eax, [base]
72
           add eax, edx
67
           and eax, 4095
Line 73... Line 68...
73
.fail:
68
           add eax, edx
74
           pop edi
69
.fail:
Line 192... Line 187...
192
           endl
187
           endl
Line 193... Line 188...
193
 
188
 
194
           cmp dword [LFBAddress], -1
189
           cmp dword [LFBAddress], -1
195
           jne @f
190
           jne @f
196
           mov [BOOT_VAR+0x901c],byte 2
191
           mov [BOOT_VAR+0x901c],byte 2
197
           stdcall _alloc_pages, 0x280000 shr 12
192
           mov ecx, 0x280000
-
 
193
           mov edx, PG_SW
198
           add eax, OS_BASE
194
           call @mem_alloc@8
199
           mov [LFBAddress], eax
195
           mov [LFBAddress], eax
200
           ret
196
           ret
201
@@:
197
@@:
202
           test [SCR_MODE],word 0100000000000000b
198
           test [SCR_MODE],word 0100000000000000b
Line 475... Line 471...
475
.check_ptab:
471
.check_ptab:
476
           mov edx, [_sys_pdbr + ebx*4]
472
           mov edx, [_sys_pdbr + ebx*4]
477
           test edx, PG_MAP
473
           test edx, PG_MAP
478
           jnz @F
474
           jnz @F
Line -... Line 475...
-
 
475
 
479
 
476
           xor ecx, ecx
480
           call _alloc_page
477
           call @core_alloc@4
481
           test eax, eax
478
           test eax, eax
Line 482... Line 479...
482
           jz .fail
479
           jz .fail
483
 
480
 
Line 787... Line 784...
787
           mov [buf_size], esi
784
           mov [buf_size], esi
Line 788... Line 785...
788
 
785
 
789
           mov ecx, [ipc_tmp]
786
           mov ecx, [ipc_tmp]
790
           cmp esi, 0x40000-0x1000 ; size of [ipc_tmp] minus one page
787
           cmp esi, 0x40000-0x1000 ; size of [ipc_tmp] minus one page
791
           jbe @f
788
           jbe @f
792
           push eax esi edi
789
           push eax
-
 
790
           lea ecx, [esi+0x1000]
793
           add esi,0x1000
791
           xor edx, edx
794
           stdcall alloc_kernel_space,esi
792
           call @mem_alloc@8
795
           mov ecx, eax
793
           mov ecx, eax
796
           pop edi esi eax
794
           pop eax
797
@@:
795
@@:
798
           mov [used_buf], ecx
796
           mov [used_buf], ecx
799
           stdcall map_mem, ecx, [SLOT_BASE+eax+0xB8],\
797
           stdcall map_mem, ecx, [SLOT_BASE+eax+0xB8],\
Line 818... Line 816...
818
           mov ecx, [msg_size]
816
           mov ecx, [msg_size]
Line 819... Line 817...
819
 
817
 
820
           mov [edi+4], ecx
818
           mov [edi+4], ecx
821
           add edi, 8
819
           add edi, 8
822
           mov esi, [msg_addr]
-
 
823
       ;    add esi, new_app_base
820
           mov esi, [msg_addr]
824
           cld
821
           cld
Line 825... Line 822...
825
           rep movsb
822
           rep movsb
826
 
823
 
Line 1152... Line 1149...
1152
proc create_ring_buffer stdcall, size:dword, flags:dword
1149
proc create_ring_buffer stdcall, size:dword, flags:dword
1153
           locals
1150
           locals
1154
             buf_ptr  dd ?
1151
             buf_ptr  dd ?
1155
           endl
1152
           endl
Line 1156... Line 1153...
1156
 
1153
 
1157
           mov eax, [size]
1154
           mov ecx, [size]
1158
           test eax, eax
1155
           test ecx, 4095
Line 1159... Line 1156...
1159
           jz .fail
1156
           jnz .fail
-
 
1157
 
1160
 
1158
           add ecx, ecx
1161
           add eax, eax
1159
           xor edx, edx
1162
           stdcall alloc_kernel_space, eax
-
 
1163
           test eax, eax
-
 
1164
           jz .fail
-
 
1165
 
-
 
1166
           push ebx
1160
           call @mem_alloc@8
-
 
1161
           test eax, eax
Line 1167... Line -...
1167
 
-
 
1168
           mov [buf_ptr], eax
-
 
1169
 
1162
           mov [buf_ptr], eax
Line -... Line 1163...
-
 
1163
           jz .fail
-
 
1164
 
-
 
1165
           push ebx
-
 
1166
 
-
 
1167
           xor ecx, ecx
1170
           mov ebx, [size]
1168
           mov edx, [size]
1171
           shr ebx, 12
1169
           shr edx, 12
Line -... Line 1170...
-
 
1170
           mov ebx, edx
1172
           push ebx
1171
           dec edx
1173
 
1172
           bsr ecx, edx
Line 1174... Line -...
1174
           stdcall _alloc_pages, ebx
-
 
1175
           pop ecx
-
 
1176
 
1173
           inc ecx
1177
           test eax, eax
-
 
1178
           jz .mm_fail
1174
 
1179
 
1175
           call @core_alloc@4
1180
           push edi
-
 
1181
 
1176
           test eax, eax
1182
           or eax, [flags]
1177
           jz .mm_fail
1183
           mov edi, [buf_ptr]
1178
 
1184
           mov ebx, [buf_ptr]
1179
           or eax,  [flags]
1185
           mov edx, ecx
1180
           mov edx, [buf_ptr]
1186
           shl edx, 2
-
 
1187
           shr edi, 10
1181
           lea ecx, [ebx*4]
1188
@@:
1182
           shr edx, 10
1189
           mov [page_tabs+edi], eax
1183
@@:
Line 1190... Line 1184...
1190
           mov [page_tabs+edi+edx], eax
1184
           mov [page_tabs+edx], eax
1191
           add eax, 0x1000
-
 
1192
           add ebx, 0x1000
1185
           mov [page_tabs+edx+ecx], eax
1193
           add edi, 4
1186
           add eax, 0x1000
1194
           dec ecx
1187
           add edx, 4
1195
           jnz @B
1188
           dec ebx
1196
 
-
 
1197
           mov eax, [buf_ptr]
1189
           jnz @B
-
 
1190
 
1198
           pop edi
1191
           mov eax, [buf_ptr]
1199
           pop ebx
1192
           pop ebx
1200
           ret
1193
           ret