Subversion Repositories Kolibri OS

Rev

Rev 10002 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10002 Rev 10008
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2022. 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: 10002 $
8
$Revision: 10008 $
Line 9... Line -...
9
 
-
 
10
 
-
 
11
GREEDY_KERNEL  = 0
-
 
12
 
-
 
13
struct  APP_HEADER_00_
-
 
14
        banner          dq ?
-
 
15
        version         dd ?    ;+8
-
 
16
        start           dd ?    ;+12
-
 
17
        i_end           dd ?    ;+16
-
 
18
        mem_size        dd ?    ;+20
9
 
19
        i_param         dd ?    ;+24
10
 
20
ends
11
GREEDY_KERNEL  = 0
21
 
12
 
22
struct  APP_HEADER_01_
13
struct  APP_HEADER_01_
Line 214... Line 205...
214
endp
205
endp
Line 215... Line 206...
215
 
206
 
216
align 4
207
align 4
217
test_app_header:
208
test_app_header:
218
       virtual at eax
-
 
219
         APP_HEADER_00 APP_HEADER_00_
-
 
220
       end virtual
-
 
221
       virtual at eax
209
       virtual at eax
222
         APP_HEADER_01 APP_HEADER_01_
210
         APP_HEADER_01 APP_HEADER_01_
Line 223... Line 211...
223
       end virtual
211
       end virtual
224
 
212
 
225
        cmp     dword [eax], 'MENU'
213
        cmp     dword [eax], 'MENU'
226
        jne     .fail
214
        jne     .fail
Line 227... Line -...
227
        cmp     word [eax+4], 'ET'
-
 
228
        jne     .fail
-
 
229
 
-
 
230
        cmp     [eax+6], word '00'
-
 
231
        jne     .check_01_header
-
 
232
 
-
 
233
        mov     ecx, [APP_HEADER_00.start]
-
 
234
        mov     [ebx + APP_HDR.eip], ecx
-
 
235
        mov     edx, [APP_HEADER_00.mem_size]
-
 
236
        mov     [ebx + APP_HDR._emem], edx
-
 
237
 
-
 
238
        cmp     edx, [APP_HEADER_00.i_end]
-
 
239
        jb      .fail
-
 
240
 
-
 
241
        cmp     edx, OS_BASE ;check memory
-
 
242
        jae     .fail
-
 
243
        mov     ecx, [pg_data.pages_free]
-
 
244
        shl     ecx, 12 ; ecx * 4kb
-
 
245
        cmp     edx, ecx
-
 
246
        jae     .fail
-
 
247
 
-
 
248
        shr     edx, 1
-
 
249
        sub     edx, 0x10
-
 
250
        mov     [ebx + APP_HDR.esp], edx
-
 
251
        mov     ecx, [APP_HEADER_00.i_param]
-
 
252
        mov     [ebx + APP_HDR.cmdline], ecx
-
 
253
        mov     [ebx + APP_HDR.path], 0
-
 
254
        mov     edx, [APP_HEADER_00.i_end]
-
 
255
        mov     [ebx + APP_HDR._edata], edx
-
 
256
        ret
-
 
257
 
215
        cmp     word [eax+4], 'ET'
258
 .check_01_header:
216
        jne     .fail
259
 
217
 
260
        cmp     [eax+6], word '01'
218
        cmp     [eax+6], word '01'
261
        je      @f
219
        je      @f
Line 845... Line 803...
845
        mov     edi, [ebp + APP_HDR._emem]
803
        mov     edi, [ebp + APP_HDR._emem]
846
        add     edi, PAGE_SIZE-1
804
        add     edi, PAGE_SIZE-1
847
        and     edi, -PAGE_SIZE
805
        and     edi, -PAGE_SIZE
848
        sub     edi, ecx
806
        sub     edi, ecx
849
        dec     edi
807
        dec     edi
850
        cmp     word [6], '00'
-
 
851
        jne     @f
-
 
852
        mov     [APP_HEADER_00_.i_param], edi
-
 
853
        jmp     .copy_cmdline
-
 
854
@@:
808
 
855
        mov     [APP_HEADER_01_.i_param], edi
809
        mov     [APP_HEADER_01_.i_param], edi
856
.copy_cmdline:
810
.copy_cmdline:
857
        inc     ecx  ; keep in mind about 0 in the end
811
        inc     ecx  ; keep in mind about 0 in the end
858
        stdcall is_region_userspace, edi, ecx
812
        stdcall is_region_userspace, edi, ecx
859
        jnz     .check_tls_header
813
        jnz     .check_tls_header