Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5130 → Rev 5131

/programs/develop/libraries/menuetlibc/src/libc/ansi/stdlib/malloc.c
5,7 → 5,6
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <menuet/sem.h>
 
typedef struct BLOCK {
size_t size;
23,7 → 22,7
#define ALIGN 8
#define SMALL (NUMSMALL*ALIGN)
 
DECLARE_STATIC_SEM(malloc_mutex)
static int malloc_mutex = 0;
 
static BLOCK *slop = 0;
static BLOCK *freelist[30];
33,12 → 32,13
 
static inline void malloc_lock(void)
{
sem_lock(&malloc_mutex);
while (__sync_lock_test_and_set(&malloc_mutex, 1))
__menuet__delay100(1);
}
 
static inline void malloc_unlock(void)
{
sem_unlock(&malloc_mutex);
__sync_lock_release(&malloc_mutex);
}
 
#define MIN_SAVE_EXTRA 64
/programs/develop/libraries/menuetlibc/stub/Tupfile.lua
1,2 → 1,3
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("crt0_coff.asm", "fasm %f %o", "crt0.o")
tup.rule("crt0_coff_dynstack.asm", "fasm %f %o", "crt0_dynstack.o")
/programs/develop/libraries/menuetlibc/stub/crt0_coff_dynstack.asm
0,0 → 1,63
CATCH_NULL_CALL = 0
 
format MS COFF
section '.text' code readable executable
public start
;EXTRN _edata
EXTRN ___menuet__app_param_area
EXTRN ___menuet__app_path_area
EXTRN ___crt1_startup
EXTRN ___memsize
start:
public ___menuet__app_header
public ___menuet__memsize
section '.A' code readable executable
___menuet__app_header:
db 'MENUET01'
dd 0x01
dd do_start
; dd _edata
dd 0
___menuet__memsize:
dd ___memsize
dd app_stack
dd ___menuet__app_param_area
dd ___menuet__app_path_area
 
do_start:
push 68
pop eax
push 11
pop ebx
push eax
int 0x40
pop eax
inc ebx
mov ecx, 0x100000
int 0x40
lea esp, [eax+ecx]
if CATCH_NULL_CALL
mov byte [0], 0xE9
mov dword [1], _libc_null_call-5
end if
jmp ___crt1_startup
 
if CATCH_NULL_CALL
EXTRN ___libc_null_call
 
_libc_null_call:
push eax
push ebx
push ecx
push edx
push esi
push edi
push ebp
call ___libc_null_call
mov eax,-1
int 0x40
end if
 
section '.bss' readable writeable
rb 0x100
app_stack: