mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-24 22:07:41 -04:00
Fixed malloc problem
This commit is contained in:
parent
f01936dc92
commit
597165d4e1
1 changed files with 13 additions and 11 deletions
|
@ -237,8 +237,8 @@ static int head_end = (int) 0x20000000;
|
||||||
|
|
||||||
void * _sbrk (int nbytes)
|
void * _sbrk (int nbytes)
|
||||||
{
|
{
|
||||||
//vx_print_str("Hello from _sbrk\n");
|
vx_print_str("Hello from _sbrk\n");
|
||||||
//vx_printf("nbytes: ", nbytes);
|
vx_printf("nbytes: ", nbytes);
|
||||||
|
|
||||||
//if (nbytes < 0) //vx_print_str("nbytes less than zero\n");
|
//if (nbytes < 0) //vx_print_str("nbytes less than zero\n");
|
||||||
// printf("nBytes: %d\n", nbytes);
|
// printf("nBytes: %d\n", nbytes);
|
||||||
|
@ -248,19 +248,21 @@ void * _sbrk (int nbytes)
|
||||||
nbytes = nbytes * -1;
|
nbytes = nbytes * -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbytes > 10240)
|
vx_printf("New nbytes: ", nbytes);
|
||||||
{
|
|
||||||
nbytes = 10240;
|
// if (nbytes > 10240)
|
||||||
}
|
// {
|
||||||
|
// nbytes = 10240;
|
||||||
|
// }
|
||||||
|
|
||||||
// if (((unsigned) head_end) > ((unsigned) (heap_ptr + nbytes)))
|
// if (((unsigned) head_end) > ((unsigned) (heap_ptr + nbytes)))
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
int base = heap_start;
|
int base = heap_start;
|
||||||
heap_start += nbytes;
|
heap_start += nbytes;
|
||||||
////vx_print_str("_sbrk returning: ");
|
vx_print_str("_sbrk returning: ");
|
||||||
//vx_print_hex((unsigned) base);
|
vx_print_hex((unsigned) base);
|
||||||
////vx_print_str("\n");
|
vx_print_str("\n");
|
||||||
return (void *) base;
|
return (void *) base;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -303,7 +305,7 @@ int _open(const char *name, int flags, int mode)
|
||||||
|
|
||||||
void _kill()
|
void _kill()
|
||||||
{
|
{
|
||||||
vx_print_str("ERROR: _kill not yet implemented\n");
|
vx_tmc(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned _getpid()
|
unsigned _getpid()
|
||||||
|
@ -320,7 +322,7 @@ static int curr_time = 0;
|
||||||
|
|
||||||
int _gettimeofday()
|
int _gettimeofday()
|
||||||
{
|
{
|
||||||
vx_print_str("ERROR: _gettimeofday not yet implemented\n");
|
// vx_print_str("ERROR: _gettimeofday not yet implemented\n");
|
||||||
return curr_time++;
|
return curr_time++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue