Subversion Repositories HelenOS-historic

Rev

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

Rev 1357 Rev 1363
Line 67... Line 67...
67
{
67
{
68
    return __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t ) address);
68
    return __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t ) address);
69
}
69
}
70
 
70
 
71
static size_t heapsize = 0;
71
static size_t heapsize = 0;
-
 
72
static size_t maxheapsize = (size_t)(-1);
72
/* Start of heap linker symbol */
73
/* Start of heap linker symbol */
73
extern char _heap;
74
extern char _heap;
74
 
75
 
75
/** Sbrk emulation
76
/** Sbrk emulation
76
 *
77
 *
Line 89... Line 90...
89
    if (incr > 0 && incr+heapsize < heapsize)
90
    if (incr > 0 && incr+heapsize < heapsize)
90
        return NULL;
91
        return NULL;
91
    /* Check for too small values */
92
    /* Check for too small values */
92
    if (incr < 0 && incr+heapsize > heapsize)
93
    if (incr < 0 && incr+heapsize > heapsize)
93
        return NULL;
94
        return NULL;
-
 
95
    /* Check for user limit */
-
 
96
    if ((maxheapsize!=(size_t)(-1)) && (heapsize + incr)>maxheapsize) return NULL;
94
 
97
 
95
    rc = as_area_resize(&_heap, heapsize + incr,0);
98
    rc = as_area_resize(&_heap, heapsize + incr,0);
96
    if (rc != 0)
99
    if (rc != 0)
97
        return NULL;
100
        return NULL;
98
   
101
   
Line 101... Line 104...
101
 
104
 
102
    heapsize += incr;
105
    heapsize += incr;
103
 
106
 
104
    return res;
107
    return res;
105
}
108
}
-
 
109
 
-
 
110
void *set_maxheapsize(size_t mhs)
-
 
111
{
-
 
112
    maxheapsize=mhs;
-
 
113
    /* Return pointer to area not managed by sbrk */
-
 
114
    return (void *)&_heap + maxheapsize;
-
 
115
 
-
 
116
}