Subversion Repositories Kolibri OS

Rev

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

Rev 8270 Rev 8329
Line 69... Line 69...
69
format binary as "mnt"
69
format binary as "mnt"
Line 70... Line 70...
70
 
70
 
71
include 'macros.inc'
71
include 'macros.inc'
Line 72... Line 72...
72
include 'struct.inc'
72
include 'struct.inc'
Line 73... Line 73...
73
 
73
 
74
$Revision: 8270 $
74
$Revision: 8329 $
Line 1745... Line 1745...
1745
; 1 = normal layout
1745
; 1 = normal layout
1746
        dec     ecx
1746
        dec     ecx
1747
        jnz     .shift
1747
        jnz     .shift
Line 1748... Line 1748...
1748
 
1748
 
1749
        ; if given memory address belongs to kernel then error
-
 
1750
        push    ebx 
-
 
1751
        mov     eax, ebx
-
 
1752
        mov     ebx, 128
1749
        ; if given memory address belongs to kernel then error
1753
        call    is_region_userspace
-
 
1754
        pop     ebx
-
 
1755
        test    eax, eax
1750
        stdcall is_region_userspace, ebx, 128
Line 1756... Line 1751...
1756
        jz      .addr_error
1751
        jz      .addr_error
1757
 
1752
 
1758
        mov     eax, keymap
1753
        mov     eax, keymap
Line 1763... Line 1758...
1763
.shift:
1758
.shift:
1764
; 2 = layout with pressed Shift
1759
; 2 = layout with pressed Shift
1765
        dec     ecx
1760
        dec     ecx
1766
        jnz     .alt
1761
        jnz     .alt
Line 1767... Line -...
1767
 
-
 
1768
        push    ebx 
-
 
1769
        mov     eax, ebx
-
 
1770
        mov     ebx, 128
1762
 
1771
        call    is_region_userspace
-
 
1772
        pop     ebx
-
 
1773
        test    eax, eax
1763
        stdcall is_region_userspace, ebx, 128
Line 1774... Line 1764...
1774
        jz      .addr_error
1764
        jz      .addr_error
1775
 
1765
 
1776
        mov     eax, keymap_shift
1766
        mov     eax, keymap_shift
Line 1781... Line 1771...
1781
.alt:
1771
.alt:
1782
; 3 = layout with pressed Alt
1772
; 3 = layout with pressed Alt
1783
        dec     ecx
1773
        dec     ecx
1784
        jne     .country
1774
        jne     .country
Line 1785... Line -...
1785
 
-
 
1786
        push    ebx 
-
 
1787
        mov     eax, ebx
-
 
1788
        mov     ebx, 128
1775
 
1789
        call    is_region_userspace
-
 
1790
        pop     ebx
-
 
1791
        test    eax, eax
1776
        stdcall is_region_userspace, ebx, 128
Line 1792... Line 1777...
1792
        jz      .addr_error
1777
        jz      .addr_error
1793
 
1778
 
1794
        mov     eax, keymap_alt
1779
        mov     eax, keymap_alt
Line 2466... Line 2451...
2466
        and     dword [esp+32], 0
2451
        and     dword [esp+32], 0
2467
        ret
2452
        ret
2468
;------------------------------------------------------------------------------
2453
;------------------------------------------------------------------------------
2469
sysfn_getversion:       ; 18.13 = get kernel ID and version
2454
sysfn_getversion:       ; 18.13 = get kernel ID and version
2470
        ; if given memory address belongs to kernel then error
2455
        ; if given memory address belongs to kernel then error
2471
        mov     eax, ecx
-
 
2472
        mov     ebx, version_end-version_inf
2456
        stdcall is_region_userspace, ecx, version_end-version_inf
2473
        call    is_region_userspace
-
 
2474
        test    eax, eax
-
 
2475
        jz      .addr_error
2457
        jz      .addr_error
Line 2476... Line 2458...
2476
 
2458
 
2477
        mov     edi, ecx
2459
        mov     edi, ecx
2478
        mov     esi, version_inf
2460
        mov     esi, version_inf
Line 3180... Line 3162...
3180
;  +22 dword     start in mem
3162
;  +22 dword     start in mem
3181
;  +26 dword     used mem
3163
;  +26 dword     used mem
3182
;  +30 dword     PID , process idenfification number
3164
;  +30 dword     PID , process idenfification number
3183
;
3165
;
3184
        ; if given memory address belongs to kernel then error
3166
        ; if given memory address belongs to kernel then error
3185
        push    ebx
-
 
3186
        mov     eax, ebx
-
 
3187
        mov     ebx, 0x4C
-
 
3188
        call    is_region_userspace
3167
        stdcall is_region_userspace, ebx, 0x4C
3189
        pop     ebx
-
 
3190
        test    eax, eax
-
 
3191
        jz      .addr_error
3168
        jz      .addr_error
Line 3192... Line 3169...
3192
 
3169
 
3193
        cmp     ecx, -1 ; who am I ?
3170
        cmp     ecx, -1 ; who am I ?
3194
        jne     .no_who_am_i
3171
        jne     .no_who_am_i
Line 5699... Line 5676...
5699
align 4
5676
align 4
5700
undefined_syscall:                      ; Undefined system call
5677
undefined_syscall:                      ; Undefined system call
5701
        mov     [esp + 32], dword -1
5678
        mov     [esp + 32], dword -1
5702
        ret
5679
        ret
Line 5703... Line -...
5703
 
-
 
5704
align 4
5680
 
-
 
5681
; check if given memory region lays in lower 2gb (userspace memory) or not
5705
; check if given memory region lays in lower 2gb (userspace memory) or not
5682
align 4
-
 
5683
proc is_region_userspace stdcall, base:dword, len:dword
5706
is_region_userspace:
5684
; in:
5707
; in:  eax = base
5685
;      base = base address of region
5708
;      ebx = len
5686
;      len = lenght of region
-
 
5687
; out: ZF = 1 if region in userspace memory
5709
; out: eax = 1 if region in userspace memory, 0 if not
5688
;      ZF = 0 otherwise
-
 
5689
        push    eax ebx
Line 5710... Line 5690...
5710
        push    esi edi ecx
5690
        mov     eax, [base]
5711
 
5691
 
Line -... Line 5692...
-
 
5692
        cmp     eax, OS_BASE
-
 
5693
        ja      @f
-
 
5694
 
-
 
5695
        mov     ebx, 0xFFFFFFFF
-
 
5696
        sub     ebx, [base]
-
 
5697
        inc     ebx
5712
        cmp     eax, OS_BASE
5698
        cmp     [len], ebx
5713
        ja      @f
5699
        ja      @f
5714
 
5700
 
Line 5715... Line 5701...
5715
        add     eax, ebx
5701
        add     eax, [len]
5716
        cmp     eax, OS_BASE
5702
        cmp     eax, OS_BASE
5717
        ja      @f
5703
        ja      @f
5718
 
5704
 
5719
        mov     eax, 1
5705
        mov     eax, 1
-
 
5706
        jmp     .ret
5720
        jmp     .ret
5707
@@:
5721
@@:
5708
        xor     eax, eax
-
 
5709
.ret:
Line 5722... Line 5710...
5722
        xor     eax, eax
5710
        test    eax, eax
5723
.ret:
5711
        pop     ebx eax
5724
        pop     ecx edi esi
5712
        ret