kolibrios/programs/fs/kfar/trunk/tools.inc
Evgeny Grechnikov (Diamond) 822a9715c4 * Modified sysfunction 65 (see documentation), use new KFAR
* Deleted useless sysfunction 59 (syscalls trace)
* Load vmode.mdr via new file subsystem
* KFar 0.2

git-svn-id: svn://kolibrios.org@314 a494cfbc-eb01-0410-851d-a64ba20cac60
2007-02-02 15:09:14 +00:00

70 lines
1.4 KiB
PHP

xmalloc:
; in: eax=size
; out: eax=pointer or NULL
call mf_alloc
.common:
test eax, eax
jnz @f
call SayNoMem
xor eax, eax
@@:
ret
xrealloc:
; in: eax=pointer, ebx=new size
; out: eax=pointer or NULL
call mf_realloc
jmp xmalloc.common
get_error_msg:
; in: eax=error code
; out: eax=pointer to message (in static buffer)
push esi edi
mov edi, error_msg
cmp eax, 11
ja .no1
mov esi, [errors1+eax*4]
jmp .copy
.no1:
cmp eax, 30
jb .no2
cmp eax, 32
ja .no2
mov esi, [errors2+(eax-30)*4]
.copy:
lodsb
stosb
test al, al
jnz .copy
.ret:
mov eax, error_msg
pop edi esi
ret
.no2:
mov esi, aUnknownError
push eax
@@:
lodsb
stosb
test al, al
jnz @b
pop eax
push edx ecx
test eax, eax
jns @f
mov byte [edi], '-'
inc edi
neg eax
@@:
xor edx, edx
mov ecx, 10
div ecx
add edx, '0'
mov byte [edi], dl
inc edi
test eax, eax
jnz @b
pop ecx edx
stosb
jmp .ret