_write working, _fstat upload/download not working

This commit is contained in:
felsabbagh3
2019-11-12 13:39:33 -05:00
parent ef83285c6c
commit ba3722c4bb
13 changed files with 25884 additions and 25609 deletions

View File

@@ -1,27 +0,0 @@
#include "fileio.h"
void __attribute__ ((section (".FileIO"))) vx_close()
{
}
void __attribute__ ((section (".FileIO"))) vx_fstat()
{
}
void __attribute__ ((section (".FileIO"))) vx_isatty()
{
}
void __attribute__ ((section (".FileIO"))) vx_read()
{
}
void __attribute__ ((section (".FileIO"))) vx_write()
{
}

View File

@@ -3,19 +3,19 @@
#define FILE_IOO
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
// #include <sys/stat.h>
// #include <errno.h>
// #include <stdio.h>
void vx_close();
// void vx_close();
void vx_fstat();
// void vx_fstat();
void vx_isatty();
// void vx_isatty();
void vx_read();
// void vx_read();
void vx_write();
// void vx_write();

48
runtime/fileIo/fileio.s Normal file
View File

@@ -0,0 +1,48 @@
# .section .FileIO
# .type vx_close, @function
# .global vx_close
# vx_close:
# nop
# ret
# nop
# nop
# .type vx_fstat, @function
# .global vx_fstat
# vx_fstat:
# nop
# ret
# nop
# nop
# .type vx_isatty, @function
# .global vx_isatty
# vx_isatty:
# nop
# ret
# nop
# nop
# .type vx_read, @function
# .global vx_read
# vx_read:
# nop
# ret
# nop
# nop
# .type vx_write, @function
# .global vx_write
# vx_write:
# nop
# ret
# nop
# nop

View File

@@ -13,7 +13,7 @@ VX_INT = ../../intrinsics/vx_intrinsics.s
VX_IO = ../../io/vx_io.s ../../io/vx_io.c
VX_API = ../../vx_api/vx_api.c
VX_TEST = ../../tests/tests.c
VX_FIO = ../../fileio/fileio.c
VX_FIO = ../../fileio/fileio.s
VX_MAIN = ./vx_nl_main.c

View File

@@ -13,7 +13,7 @@ SECTIONS
. = 0x70000000;
.FileIO :
{
*(.FileIO)
}
. = 0x80000000;
.text :

View File

@@ -24,9 +24,6 @@ int main()
printf("printf: Newlib Main %d\n", 456);
vx_close();
return 0;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -18,11 +18,17 @@
#define FILE_IO_WRITE 0x71000000
#define FILE_IO_READ 0x72000000
typedef void (*funct_t)(void);
funct_t trap_to_simulator = (funct_t) 0x70000000;
void upload(char ** ptr, char * src, int size)
{
char * drain = *ptr;
*drain = size;
*((int *) drain) = size;
drain += 4;
@@ -66,11 +72,29 @@ int _fstat(int file, struct stat * st)
upload((char **) &write_buffer, (char *) &cmd_id, sizeof(int));
upload((char **) &write_buffer, (char *) &file , sizeof(int));
vx_fstat();
trap_to_simulator();
char * read_buffer = (char *) FILE_IO_READ;
download((char **) &read_buffer, (char *) st);
struct stat newSt;
download((char **) &read_buffer, (char *) &st);
// st->st_mode = S_IFCHR;
vx_printf("st_mode: ", st->st_mode);
vx_printf("st_dev: ", st->st_dev);
vx_printf("st_ino: ", st->st_ino);
vx_printf("st_uid: ", st->st_uid);
vx_printf("st_gid: ", st->st_gid);
vx_printf("st_rdev: ", st->st_rdev);
vx_printf("st_size: ", st->st_size);
vx_printf("st_blksize: ", st->st_blksize);
vx_printf("st_blocks: ", st->st_blocks);
// st->st_mode = newSt.st_mode;
return 0;
}
int _isatty (int file)
@@ -100,11 +124,10 @@ int _write (int file, char *buf, int nbytes)
upload((char **) &write_buffer, (char *) &cmd_id, sizeof(int));
upload((char **) &write_buffer, (char *) &file , sizeof(int));
upload((char **) &write_buffer, (char *) buf , nbytes);
vx_write();
trap_to_simulator();
// int i;