- 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/resource.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libsys.h"
|
#include "libsys.h"
|
||||||
|
|
||||||
@@ -150,9 +151,8 @@ void _cg_putchar(char c)
|
|||||||
|
|
||||||
void _exit (int exitcode)
|
void _exit (int exitcode)
|
||||||
{
|
{
|
||||||
sputs("_exit(");
|
fflush(stdout);
|
||||||
print_word(exitcode);
|
fflush(stderr);
|
||||||
sputs(")\n");
|
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,29 +239,31 @@ int settimeofday(const struct timeval *tp, const struct timezone *tzp)
|
|||||||
caddr_t sbrk(int incr)
|
caddr_t sbrk(int incr)
|
||||||
{
|
{
|
||||||
extern char end;
|
extern char end;
|
||||||
|
extern char stack_ptr;
|
||||||
static char *heap_end;
|
static char *heap_end;
|
||||||
char *prev_heap_end;
|
char *prev_heap_end;
|
||||||
|
|
||||||
if (heap_end == 0)
|
if (heap_end == 0)
|
||||||
|
{
|
||||||
heap_end = &end;
|
heap_end = &end;
|
||||||
|
}
|
||||||
|
|
||||||
prev_heap_end = heap_end;
|
prev_heap_end = heap_end;
|
||||||
// if (heap_end + incr > stack_ptr)
|
if (heap_end + incr > &stack_ptr)
|
||||||
// {
|
{
|
||||||
// sputs("Heap and stack collision\r\n");
|
// sputs("Heap and stack collision\n");
|
||||||
// abort();
|
// 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");
|
||||||
// sputs("\n");
|
exit(1);
|
||||||
// print_word((int)prev_heap_end);
|
}
|
||||||
// sputs("\n");
|
|
||||||
heap_end += incr;
|
heap_end += incr;
|
||||||
return (caddr_t) prev_heap_end;
|
return (caddr_t) prev_heap_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstat(int file, struct stat *st)
|
int fstat(int file, struct stat *st)
|
||||||
{
|
{
|
||||||
// sputs("Fstat()\n");
|
// sputs("fstat\n");
|
||||||
st->st_mode = S_IFCHR;
|
st->st_mode = S_IFCHR;
|
||||||
st->st_blksize = 0;
|
st->st_blksize = 0;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -269,41 +271,49 @@ int fstat(int file, struct stat *st)
|
|||||||
|
|
||||||
int lseek(int file, int ptr, int dir)
|
int lseek(int file, int ptr, int dir)
|
||||||
{
|
{
|
||||||
sputs("Lseek()\n");
|
// sputs("lseek\n");
|
||||||
|
|
||||||
errno = ESPIPE;
|
errno = ESPIPE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int open(const char *name, int flags, int mode)
|
int open(const char *name, int flags, int mode)
|
||||||
{
|
{
|
||||||
sputs("Open()\n");
|
// sputs("open\n");
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int close(int file)
|
int close(int file)
|
||||||
{
|
{
|
||||||
sputs("Close()\n");
|
// sputs("close\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int read(int file, char *ptr, int len)
|
int read(int file, char *ptr, int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char c;
|
||||||
|
|
||||||
// sputs("Read()\n");
|
// sputs("read\n");
|
||||||
for (i = 0; i < len; i++)
|
i = 0;
|
||||||
|
while (i < len)
|
||||||
{
|
{
|
||||||
ptr[i] = readchar();
|
c = readchar();
|
||||||
if ((ptr[i] == '\n') || (ptr[i] == '\r'))
|
if ((c == 0x0D) || (c == 0x0A))
|
||||||
{
|
{
|
||||||
i++;
|
|
||||||
writechar(0x0D);
|
writechar(0x0D);
|
||||||
writechar(0x0A);
|
writechar(0x0A);
|
||||||
|
if (i==0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ptr[i++] = c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
writechar(ptr[i]);
|
else
|
||||||
|
{
|
||||||
|
ptr[i++] = c;
|
||||||
|
writechar(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,12 @@
|
|||||||
//#define STDOUT_FUNCTION _cg_putchar // Video character
|
//#define STDOUT_FUNCTION _cg_putchar // Video character
|
||||||
//#define STDERR_FUNCTION _putchar // Serial output
|
//#define STDERR_FUNCTION _putchar // Serial output
|
||||||
|
|
||||||
|
#ifndef STDOUT_FUNCTION
|
||||||
#define STDOUT_FUNCTION _putchar // Serial output
|
#define STDOUT_FUNCTION _putchar // Serial output
|
||||||
|
#endif
|
||||||
|
#ifndef STDERR_FUNCTION
|
||||||
#define STDERR_FUNCTION _putchar // Serial output
|
#define STDERR_FUNCTION _putchar // Serial output
|
||||||
|
#endif
|
||||||
|
|
||||||
UINT32 CP0_SR_read(void);
|
UINT32 CP0_SR_read(void);
|
||||||
void CP0_SR_write(UINT32 val);
|
void CP0_SR_write(UINT32 val);
|
||||||
|
|||||||
Reference in New Issue
Block a user