Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1227 → Rev 1228

/uspace/trunk/init/init.c
94,12 → 94,12
static void test_mremap(void)
{
printf("Writing to good memory\n");
mremap(&_heap, 120000, 0);
as_area_resize(&_heap, 120000, 0);
printf("%P\n", ((char *)&_heap));
printf("%P\n", ((char *)&_heap) + 80000);
*(((char *)&_heap) + 80000) = 10;
printf("Making small\n");
mremap(&_heap, 16000, 0);
as_area_resize(&_heap, 16000, 0);
printf("Failing..\n");
*((&_heap) + 80000) = 10;
 
305,7 → 305,7
// test_hangup();
// test_slam();
printf("Userspace task, taskid=%llX\n", get_task_id());
printf("Userspace task, taskid=%llX\n", task_get_id());
 
futex_initialize(&ftx, 1);
if (futex_down(&ftx) < 0)
/uspace/trunk/libc/include/task.h
33,6 → 33,6
 
typedef uint64_t task_id_t;
 
extern task_id_t get_task_id(void);
extern task_id_t task_get_id(void);
 
#endif
/uspace/trunk/libc/include/unistd.h
37,8 → 37,8
 
extern ssize_t write(int fd, const void * buf, size_t count);
extern void _exit(int status);
void *mmap(void *address, size_t size, int flags);
void *mremap(void *address, size_t size, int flags);
void *as_area_create(void *address, size_t size, int flags);
void *as_area_resize(void *address, size_t size, int flags);
void *sbrk(ssize_t incr);
 
#endif
/uspace/trunk/libc/generic/task.c
29,11 → 29,11
#include <task.h>
#include <libc.h>
 
task_id_t get_task_id(void)
task_id_t task_get_id(void)
{
task_id_t task_id;
 
(void) __SYSCALL1(SYS_GET_TASK_ID, (sysarg_t) &task_id);
(void) __SYSCALL1(SYS_TASK_GET_ID, (sysarg_t) &task_id);
 
return task_id;
}
/uspace/trunk/libc/generic/mmap.c
29,7 → 29,7
#include <libc.h>
#include <unistd.h>
 
/** mmap syscall
/** Create address space area.
*
* @param address Virtual address where to place new address space area.
* @param size Size of the area.
37,12 → 37,12
*
* @return address on success, (void *) -1 otherwise.
*/
void *mmap(void *address, size_t size, int flags)
void *as_area_create(void *address, size_t size, int flags)
{
return (void *) __SYSCALL3(SYS_MMAP, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
return (void *) __SYSCALL3(SYS_AS_AREA_CREATE, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
}
 
/** mremap syscall
/** Resize address space area.
*
* @param address Virtual address pointing into already existing address space area.
* @param size New requested size of the area.
50,9 → 50,9
*
* @return address on success, (void *) -1 otherwise.
*/
void *mremap(void *address, size_t size, int flags)
void *as_area_resize(void *address, size_t size, int flags)
{
return (void *) __SYSCALL3(SYS_MREMAP, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
return (void *) __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
}
 
static size_t heapsize = 0;
78,7 → 78,7
if (incr < 0 && incr+heapsize > heapsize)
return NULL;
 
res = mremap(&_heap, heapsize + incr,0);
res = as_area_resize(&_heap, heapsize + incr,0);
if (!res)
return NULL;