Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#23 #24 対応 #25

Merged
merged 2 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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