- minor changes
Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@367 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <sys/resource.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "libsys.h"
|
||||
|
||||
@@ -150,9 +151,8 @@ void _cg_putchar(char c)
|
||||
|
||||
void _exit (int exitcode)
|
||||
{
|
||||
sputs("_exit(");
|
||||
print_word(exitcode);
|
||||
sputs(")\n");
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
while(1);
|
||||
}
|
||||
|
||||
@@ -239,29 +239,31 @@ int settimeofday(const struct timeval *tp, const struct timezone *tzp)
|
||||
caddr_t sbrk(int incr)
|
||||
{
|
||||
extern char end;
|
||||
extern char stack_ptr;
|
||||
static char *heap_end;
|
||||
char *prev_heap_end;
|
||||
|
||||
if (heap_end == 0)
|
||||
{
|
||||
heap_end = &end;
|
||||
}
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
// if (heap_end + incr > stack_ptr)
|
||||
// {
|
||||
// sputs("Heap and stack collision\r\n");
|
||||
// abort();
|
||||
// }
|
||||
|
||||
// sputs("\n");
|
||||
// print_word((int)prev_heap_end);
|
||||
// sputs("\n");
|
||||
if (heap_end + incr > &stack_ptr)
|
||||
{
|
||||
// sputs("Heap and stack collision\n");
|
||||
// sputs("Stack Ptr = ");print_word(&stack_ptr);sputs("\n");
|
||||
// sputs("Heap end = ");print_word(heap_end);sputs("\n");
|
||||
// sputs("Increment = ");print_word(incr);sputs("\n");
|
||||
exit(1);
|
||||
}
|
||||
heap_end += incr;
|
||||
return (caddr_t) prev_heap_end;
|
||||
}
|
||||
|
||||
int fstat(int file, struct stat *st)
|
||||
{
|
||||
// sputs("Fstat()\n");
|
||||
// sputs("fstat\n");
|
||||
st->st_mode = S_IFCHR;
|
||||
st->st_blksize = 0;
|
||||
return 0;
|
||||
@@ -269,41 +271,49 @@ int fstat(int file, struct stat *st)
|
||||
|
||||
int lseek(int file, int ptr, int dir)
|
||||
{
|
||||
sputs("Lseek()\n");
|
||||
|
||||
// sputs("lseek\n");
|
||||
errno = ESPIPE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int open(const char *name, int flags, int mode)
|
||||
{
|
||||
sputs("Open()\n");
|
||||
// sputs("open\n");
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int close(int file)
|
||||
{
|
||||
sputs("Close()\n");
|
||||
// sputs("close\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int read(int file, char *ptr, int len)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
|
||||
// sputs("Read()\n");
|
||||
for (i = 0; i < len; i++)
|
||||
// sputs("read\n");
|
||||
i = 0;
|
||||
while (i < len)
|
||||
{
|
||||
ptr[i] = readchar();
|
||||
if ((ptr[i] == '\n') || (ptr[i] == '\r'))
|
||||
c = readchar();
|
||||
if ((c == 0x0D) || (c == 0x0A))
|
||||
{
|
||||
i++;
|
||||
writechar(0x0D);
|
||||
writechar(0x0A);
|
||||
if (i==0)
|
||||
continue;
|
||||
|
||||
ptr[i++] = c;
|
||||
break;
|
||||
}
|
||||
writechar(ptr[i]);
|
||||
else
|
||||
{
|
||||
ptr[i++] = c;
|
||||
writechar(c);
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,12 @@
|
||||
//#define STDOUT_FUNCTION _cg_putchar // Video character
|
||||
//#define STDERR_FUNCTION _putchar // Serial output
|
||||
|
||||
#ifndef STDOUT_FUNCTION
|
||||
#define STDOUT_FUNCTION _putchar // Serial output
|
||||
#endif
|
||||
#ifndef STDERR_FUNCTION
|
||||
#define STDERR_FUNCTION _putchar // Serial output
|
||||
#endif
|
||||
|
||||
UINT32 CP0_SR_read(void);
|
||||
void CP0_SR_write(UINT32 val);
|
||||
|
||||
Reference in New Issue
Block a user