Rev 8962 | Rev 9183 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8962 | Rev 9045 | ||
---|---|---|---|
Line 75... | Line 75... | ||
75 | format binary as "mnt" |
75 | format binary as "mnt" |
Line 76... | Line 76... | ||
76 | 76 | ||
77 | include 'macros.inc' |
77 | include 'macros.inc' |
Line 78... | Line 78... | ||
78 | include 'struct.inc' |
78 | include 'struct.inc' |
Line 79... | Line 79... | ||
79 | 79 | ||
80 | $Revision: 8962 $ |
80 | $Revision: 9045 $ |
Line 1417... | Line 1417... | ||
1417 | display_number: |
1417 | display_number: |
1418 | ; add check pointers |
1418 | ; add check pointers |
1419 | test bl, bl |
1419 | test bl, bl |
1420 | jz @f |
1420 | jz @f |
1421 | stdcall is_region_userspace, ecx, 1 |
1421 | stdcall is_region_userspace, ecx, 1 |
1422 | jnz @f |
1422 | jz @f |
1423 | ret |
1423 | ret |
1424 | @@: |
1424 | @@: |
1425 | test esi, 0x08000000 |
1425 | test esi, 0x08000000 |
1426 | jz @f |
1426 | jz @f |
1427 | stdcall is_region_userspace, edi, 1 |
1427 | stdcall is_region_userspace, edi, 1 |
1428 | jnz @f |
1428 | jz @f |
1429 | ret |
1429 | ret |
1430 | @@: |
1430 | @@: |
1431 | ;It is not optimization |
1431 | ;It is not optimization |
1432 | mov eax, ebx |
1432 | mov eax, ebx |
1433 | mov ebx, ecx |
1433 | mov ebx, ecx |
Line 1765... | Line 1765... | ||
1765 | dec ecx |
1765 | dec ecx |
1766 | jnz .shift |
1766 | jnz .shift |
Line 1767... | Line 1767... | ||
1767 | 1767 | ||
1768 | ; if given memory address belongs to kernel then error |
1768 | ; if given memory address belongs to kernel then error |
1769 | stdcall is_region_userspace, ebx, 128 |
1769 | stdcall is_region_userspace, ebx, 128 |
Line 1770... | Line 1770... | ||
1770 | jz .addr_error |
1770 | jnz .addr_error |
1771 | 1771 | ||
1772 | mov eax, keymap |
1772 | mov eax, keymap |
1773 | mov ecx, 128 |
1773 | mov ecx, 128 |
Line 1778... | Line 1778... | ||
1778 | ; 2 = layout with pressed Shift |
1778 | ; 2 = layout with pressed Shift |
1779 | dec ecx |
1779 | dec ecx |
1780 | jnz .alt |
1780 | jnz .alt |
Line 1781... | Line 1781... | ||
1781 | 1781 | ||
1782 | stdcall is_region_userspace, ebx, 128 |
1782 | stdcall is_region_userspace, ebx, 128 |
Line 1783... | Line 1783... | ||
1783 | jz .addr_error |
1783 | jnz .addr_error |
1784 | 1784 | ||
1785 | mov eax, keymap_shift |
1785 | mov eax, keymap_shift |
1786 | mov ecx, 128 |
1786 | mov ecx, 128 |
Line 1791... | Line 1791... | ||
1791 | ; 3 = layout with pressed Alt |
1791 | ; 3 = layout with pressed Alt |
1792 | dec ecx |
1792 | dec ecx |
1793 | jne .country |
1793 | jne .country |
Line 1794... | Line 1794... | ||
1794 | 1794 | ||
1795 | stdcall is_region_userspace, ebx, 128 |
1795 | stdcall is_region_userspace, ebx, 128 |
Line 1796... | Line 1796... | ||
1796 | jz .addr_error |
1796 | jnz .addr_error |
1797 | 1797 | ||
1798 | mov eax, keymap_alt |
1798 | mov eax, keymap_alt |
1799 | mov ecx, 128 |
1799 | mov ecx, 128 |
Line 2457... | Line 2457... | ||
2457 | sysfn_getdiskinfo: ; 18.11 = get disk info table |
2457 | sysfn_getdiskinfo: ; 18.11 = get disk info table |
2458 | dec ecx |
2458 | dec ecx |
2459 | jnz .exit |
2459 | jnz .exit |
2460 | .small_table: |
2460 | .small_table: |
2461 | stdcall is_region_userspace, edx, DRIVE_DATA_SIZE |
2461 | stdcall is_region_userspace, edx, DRIVE_DATA_SIZE |
2462 | jz .exit |
2462 | jnz .exit |
2463 | mov edi, edx |
2463 | mov edi, edx |
2464 | mov esi, DRIVE_DATA |
2464 | mov esi, DRIVE_DATA |
2465 | mov ecx, DRIVE_DATA_SIZE ;10 |
2465 | mov ecx, DRIVE_DATA_SIZE ;10 |
2466 | cld |
2466 | cld |
2467 | rep movsb |
2467 | rep movsb |
Line 2473... | Line 2473... | ||
2473 | ret |
2473 | ret |
2474 | ;------------------------------------------------------------------------------ |
2474 | ;------------------------------------------------------------------------------ |
2475 | sysfn_getversion: ; 18.13 = get kernel ID and version |
2475 | sysfn_getversion: ; 18.13 = get kernel ID and version |
2476 | ; if given memory address belongs to kernel then error |
2476 | ; if given memory address belongs to kernel then error |
2477 | stdcall is_region_userspace, ecx, version_end-version_inf |
2477 | stdcall is_region_userspace, ecx, version_end-version_inf |
2478 | jz .addr_error |
2478 | jnz .addr_error |
Line 2479... | Line 2479... | ||
2479 | 2479 | ||
2480 | mov edi, ecx |
2480 | mov edi, ecx |
2481 | mov esi, version_inf |
2481 | mov esi, version_inf |
2482 | mov ecx, version_end-version_inf |
2482 | mov ecx, version_end-version_inf |
Line 2836... | Line 2836... | ||
2836 | cmp ebx, 5 ; BLOCK MOVE TO BGR |
2836 | cmp ebx, 5 ; BLOCK MOVE TO BGR |
2837 | jnz nosb5 |
2837 | jnz nosb5 |
Line 2838... | Line 2838... | ||
2838 | 2838 | ||
2839 | ; add check pointer |
2839 | ; add check pointer |
2840 | stdcall is_region_userspace, ecx, esi |
2840 | stdcall is_region_userspace, ecx, esi |
Line 2841... | Line 2841... | ||
2841 | jz .fin |
2841 | jnz .fin |
2842 | 2842 | ||
2843 | cmp [img_background], static_background_data |
2843 | cmp [img_background], static_background_data |
2844 | jnz @f |
2844 | jnz @f |
Line 3189... | Line 3189... | ||
3189 | ; +26 dword used mem |
3189 | ; +26 dword used mem |
3190 | ; +30 dword PID , process idenfification number |
3190 | ; +30 dword PID , process idenfification number |
3191 | ; |
3191 | ; |
3192 | ; if given memory address belongs to kernel then error |
3192 | ; if given memory address belongs to kernel then error |
3193 | stdcall is_region_userspace, ebx, 0x4C |
3193 | stdcall is_region_userspace, ebx, 0x4C |
3194 | jz .addr_error |
3194 | jnz .addr_error |
Line 3195... | Line 3195... | ||
3195 | 3195 | ||
3196 | cmp ecx, -1 ; who am I ? |
3196 | cmp ecx, -1 ; who am I ? |
3197 | jne .no_who_am_i |
3197 | jne .no_who_am_i |
3198 | mov ecx, [current_slot_idx] |
3198 | mov ecx, [current_slot_idx] |
Line 4399... | Line 4399... | ||
4399 | shr ecx, 16 |
4399 | shr ecx, 16 |
4400 | imul eax, ecx |
4400 | imul eax, ecx |
4401 | lea eax, [eax*3] |
4401 | lea eax, [eax*3] |
4402 | stdcall is_region_userspace, ebx, eax |
4402 | stdcall is_region_userspace, ebx, eax |
4403 | pop ecx |
4403 | pop ecx |
4404 | jz sys_putimage.exit |
4404 | jnz sys_putimage.exit |
Line 4405... | Line 4405... | ||
4405 | 4405 | ||
4406 | sys_putimage: |
4406 | sys_putimage: |
4407 | test ecx, 0x80008000 |
4407 | test ecx, 0x80008000 |
4408 | jnz .exit |
4408 | jnz .exit |
Line 4449... | Line 4449... | ||
4449 | mov ax, cx |
4449 | mov ax, cx |
4450 | shr ecx, 16 |
4450 | shr ecx, 16 |
4451 | imul eax, ecx |
4451 | imul eax, ecx |
4452 | stdcall is_region_userspace, ebx, eax |
4452 | stdcall is_region_userspace, ebx, eax |
4453 | pop ecx |
4453 | pop ecx |
4454 | jz sys_putimage.exit |
4454 | jnz sys_putimage.exit |
Line 4455... | Line 4455... | ||
4455 | 4455 | ||
4456 | mov eax, [current_slot_idx] |
4456 | mov eax, [current_slot_idx] |
4457 | shl eax, 8 |
4457 | shl eax, 8 |
4458 | add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top] |
4458 | add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top] |
Line 5204... | Line 5204... | ||
5204 | align 4 |
5204 | align 4 |
Line 5205... | Line 5205... | ||
5205 | 5205 | ||
Line 5206... | Line 5206... | ||
5206 | syscall_writetext: ; WriteText |
5206 | syscall_writetext: ; WriteText |
5207 | 5207 | ||
Line 5208... | Line 5208... | ||
5208 | stdcall is_region_userspace, edx, esi |
5208 | stdcall is_region_userspace, edx, esi |
5209 | jz .err |
5209 | jnz .err |
5210 | 5210 | ||
5211 | mov eax, [TASK_BASE] |
5211 | mov eax, [TASK_BASE] |
Line 5228... | Line 5228... | ||
5228 | xor edi, edi |
5228 | xor edi, edi |
5229 | jmp dtext |
5229 | jmp dtext |
Line 5230... | Line 5230... | ||
5230 | 5230 | ||
5231 | @@: ; check pointer |
5231 | @@: ; check pointer |
5232 | stdcall is_region_userspace, edi, 0 |
5232 | stdcall is_region_userspace, edi, 0 |
5233 | jz .err |
5233 | jnz .err |
5234 | jmp dtext |
5234 | jmp dtext |
5235 | .err: |
5235 | .err: |
Line 5236... | Line 5236... | ||
5236 | ret |
5236 | ret |
Line 5401... | Line 5401... | ||
5401 | 5401 | ||
5402 | mov ebp, edx |
5402 | mov ebp, edx |
5403 | lea ebp, [ebp*3] |
5403 | lea ebp, [ebp*3] |
5404 | imul ebp, esi |
5404 | imul ebp, esi |
5405 | stdcall is_region_userspace, edi, ebp |
5405 | stdcall is_region_userspace, edi, ebp |
Line 5406... | Line 5406... | ||
5406 | jz .exit |
5406 | jnz .exit |
5407 | 5407 | ||
5408 | mov ebp, edx |
5408 | mov ebp, edx |
Line 5472... | Line 5472... | ||
5472 | mov ebp, edx |
5472 | mov ebp, edx |
Line 5473... | Line 5473... | ||
5473 | 5473 | ||
5474 | lea ebp, [ebp*4] |
5474 | lea ebp, [ebp*4] |
5475 | imul ebp, esi |
5475 | imul ebp, esi |
5476 | stdcall is_region_userspace, edi, ebp |
5476 | stdcall is_region_userspace, edi, ebp |
Line 5477... | Line 5477... | ||
5477 | jz .exit |
5477 | jnz .exit |
Line 5478... | Line 5478... | ||
5478 | 5478 | ||
5479 | mov ebp, edx |
5479 | mov ebp, edx |
Line 5752... | Line 5752... | ||
5752 | ; @param base Base address of region |
5752 | ; @param base Base address of region |
5753 | ; @param len Lenght of region |
5753 | ; @param len Lenght of region |
5754 | ; @return ZF = 1 if region in userspace memory, |
5754 | ; @return ZF = 1 if region in userspace memory, |
5755 | ; ZF = 0 otherwise |
5755 | ; ZF = 0 otherwise |
5756 | proc is_region_userspace stdcall, base:dword, len:dword |
5756 | proc is_region_userspace stdcall, base:dword, len:dword |
5757 | push eax ebx |
5757 | push eax |
5758 | mov eax, [base] |
5758 | mov eax, [base] |
Line 5759... | Line 5759... | ||
5759 | 5759 | ||
5760 | cmp eax, OS_BASE |
5760 | cmp eax, OS_BASE-1 |
Line 5761... | Line 5761... | ||
5761 | ja @f |
5761 | ja @f ; zf |
- | 5762 | ||
5762 | 5763 | add eax, [len] |
|
5763 | add eax, [len] |
5764 | jc @f ; zf |
Line 5764... | Line 5765... | ||
5764 | cmp eax, OS_BASE |
5765 | cmp eax, OS_BASE |
5765 | ja @f |
- | |
5766 | 5766 | ja @f ; zf |
|
5767 | mov eax, 1 |
- | |
5768 | jmp .ret |
- | |
5769 | @@: |
- | |
5770 | xor eax, eax |
5767 | |
5771 | .ret: |
5768 | cmp eax, eax ; ZF |
5772 | test eax, eax |
5769 | @@: |
Line 5773... | Line 5770... | ||
5773 | pop ebx eax |
5770 | pop eax |
5774 | ret |
5771 | ret |