mirror of
https://github.com/xomboverlord/buildtools.git
synced 2026-04-09 13:39:13 +02:00
merge with gcc 4.5.0 support and binutils per-version patches from xomb branch
This commit is contained in:
@@ -69,11 +69,23 @@ wait(int *status) {
|
||||
* returns 0 if not. Since we're hooked up to a
|
||||
* serial port, we'll say yes and return a 1.
|
||||
*/
|
||||
|
||||
|
||||
int gibOpen(const char* name, unsigned int nameLen, char readOnly);
|
||||
int gibRead(int fd, void* buf, unsigned int len);
|
||||
int gibWrite(int fd, void* buf, unsigned int len);
|
||||
unsigned long long initHeap();
|
||||
|
||||
|
||||
int
|
||||
isatty(fd)
|
||||
int fd;
|
||||
{
|
||||
return (1);
|
||||
if(fd < 3){
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +128,12 @@ stat(const char* file, struct stat *st) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
link(char *old, char *new) {
|
||||
errno = EMLINK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
unlink(char *name) {
|
||||
errno = ENOENT;
|
||||
@@ -123,21 +141,9 @@ unlink(char *name) {
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
write(int file, char *ptr, int len) {
|
||||
//XXX: write to stdout
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// --- Memory ---
|
||||
|
||||
/* _end is set in the linker command file */
|
||||
extern caddr_t _end;
|
||||
|
||||
#define PAGE_SIZE 4096ULL
|
||||
#define PAGE_MASK 0xFFFFFFFFFFFFF000ULL
|
||||
#define HEAP_ADDR (((unsigned long long)&_end + PAGE_SIZE) & PAGE_MASK)
|
||||
|
||||
/*
|
||||
* sbrk -- changes heap size size. Get nbytes more
|
||||
@@ -146,20 +152,25 @@ extern caddr_t _end;
|
||||
*/
|
||||
caddr_t
|
||||
sbrk(int nbytes){
|
||||
static caddr_t heap_ptr = NULL;
|
||||
static unsigned long long heap_ptr = 0;
|
||||
caddr_t base;
|
||||
|
||||
// TODO: REPLACE allocPage with a call to a page allocator
|
||||
int temp;
|
||||
|
||||
if(heap_ptr == NULL){
|
||||
heap_ptr = (caddr_t)HEAP_ADDR;
|
||||
if(heap_ptr == 0){
|
||||
heap_ptr = initHeap();
|
||||
}
|
||||
|
||||
base = heap_ptr;
|
||||
base = (caddr_t)heap_ptr;
|
||||
|
||||
if(((unsigned long long)heap_ptr & ~PAGE_MASK) != 0ULL){
|
||||
temp = (PAGE_SIZE - ((unsigned long long)heap_ptr & ~PAGE_MASK));
|
||||
if(nbytes < 0){
|
||||
heap_ptr -= nbytes;
|
||||
return base;
|
||||
}
|
||||
|
||||
if( (heap_ptr & ~PAGE_MASK) != 0ULL){
|
||||
temp = (PAGE_SIZE - (heap_ptr & ~PAGE_MASK));
|
||||
|
||||
if( nbytes < temp ){
|
||||
heap_ptr += nbytes;
|
||||
@@ -192,6 +203,9 @@ sbrk(int nbytes){
|
||||
|
||||
|
||||
// --- Other ---
|
||||
int gettimeofday(struct timeval *p, void *z){
|
||||
return -1;
|
||||
}
|
||||
|
||||
//int times(struct tms *buf) {
|
||||
//int gettimeofday(struct timeval *p, struct timezone *z){
|
||||
|
||||
Reference in New Issue
Block a user