Skip to content

Commit

Permalink
Merge pull request #25 from ytoi/master
Browse files Browse the repository at this point in the history
#23 #24 対応
  • Loading branch information
esm-tmori committed May 11, 2020
2 parents 2a4d370 + da4280c commit 20e1643
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# カーネルに関する定義
#
KERNEL_DIRS := $(KERNEL_DIRS) $(TARGETDIR)
KERNEL_COBJS := $(KERNEL_COBJS) target_config.o tlsf.o athrill-libgcc.o
KERNEL_COBJS := $(KERNEL_COBJS) target_config.o tlsf.o athrill-libgcc.o athrill-syscall.o
#KERNEL_ASMOBJS := $(KERNEL_ASMOBJS)

#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#include "athrill_syscall.h"

Expand Down Expand Up @@ -51,30 +52,54 @@ void __srefill_r(void)
{

}
void _fflush_r(void)
int _EXFUN(_fflush_r, (struct _reent *_a, FILE *_b))
{

// TODO:
return -1;
}
void _cleanup_r(void)
{

}
void fflush(void)

static const char *ev3rtfs_top_dir = "_ev3rtfs";
static int is_top_dir_set = 0;

FILE * _EXFUN(fopen, (const char *__restrict file_name, const char *__restrict mode))
{
if ( !is_top_dir_set ) {
// check and set top_dir(only for first time)
if ( athrill_set_virtfs_top(ev3rtfs_top_dir) == -1 ) {
return 0;
}
is_top_dir_set = 1;
}
return (FILE *)athrill_posix_fopen((sys_addr)file_name,(sys_addr)mode);
}
int fclose(FILE *fp)
{
return athrill_posix_fclose((sys_addr)fp);
}

size_t _EXFUN(fread, (_PTR __restrict buf, size_t size, size_t n, FILE *__restrict fp))
{
return athrill_posix_fread((sys_addr)buf, size, n, (sys_addr)fp);
}

int fopen(void *fp, char *flag)
size_t _EXFUN(fwrite, (const _PTR __restrict buf, size_t size, size_t n, FILE * fp))
{
//TODO syscall
return 0;
return athrill_posix_fwrite((sys_addr)buf, size, n, (sys_addr)fp);
}
int fclose(void *fp)


int _EXFUN(fflush, (FILE *fp))
{
//TODO syscall
return 0;
return athrill_posix_fflush((sys_addr)fp);
}
void *fdopen(int fd, const char *flag)



FILE * _EXFUN(fdopen, (int a, const char *b))
{
//TODO syscall
return NULL;
Expand Down

0 comments on commit 20e1643

Please sign in to comment.