Lots of work on the build system
This commit is contained in:
@@ -48,6 +48,4 @@ typedef __uintmax_t uintmax_t;
|
||||
typedef __intptr_t intptr_t;
|
||||
typedef __uintptr_t uintptr_t;
|
||||
|
||||
typedef
|
||||
|
||||
#endif /* STDINT_H_ */
|
||||
|
||||
30
photon/libc/include/stdio.h
Normal file
30
photon/libc/include/stdio.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef STDIO_H_
|
||||
#define STDIO_H_
|
||||
|
||||
#include <sys/_fconst.h>
|
||||
|
||||
#if defined(__FILENAME_MAX)
|
||||
#define FILENAME_MAX __FILENAME_MAX
|
||||
#else
|
||||
#define FILENAME_MAX 1024
|
||||
#endif
|
||||
|
||||
#define SEEK_SET __SEEK_SET
|
||||
#define SEEK_CUR __SEEK_CUR
|
||||
#define SEEK_END __SEEK_END
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct __io_file FILE;
|
||||
|
||||
extern FILE *stdin;
|
||||
extern FILE *stdout;
|
||||
extern FILE *stderr;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
20
photon/libc/sys/linux/__fio.h
Normal file
20
photon/libc/sys/linux/__fio.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef SYS_LINUX___FIO_H_
|
||||
#define SYS_LINUX___FIO_H_
|
||||
|
||||
#define __FIO_BUFSZ 512
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct __io_file {
|
||||
char buf[__FIO_BUFSZ];
|
||||
unsigned int buf_idx;
|
||||
unsigned int fd;
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
10
photon/libc/sys/linux/_fconst.h
Normal file
10
photon/libc/sys/linux/_fconst.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef SYS_LINUX__FCONST_H_
|
||||
#define SYS_LINUX__FCONST_H_
|
||||
|
||||
#define __FILENAME_MAX 1024
|
||||
|
||||
#define __SEEK_SET 0
|
||||
#define __SEEK_CUR 1
|
||||
#define __SEEK_END 2
|
||||
|
||||
#endif
|
||||
16
photon/libc/sys/linux/fio.c
Normal file
16
photon/libc/sys/linux/fio.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "__fio.h"
|
||||
|
||||
struct __io_file __stdin = {};
|
||||
struct __io_file __stdout = {};
|
||||
struct __io_file __stderr = {};
|
||||
|
||||
struct __io_file *stdin = &__stdin;
|
||||
struct __io_file *stdout = &__stdout;
|
||||
struct __io_file *stderr = &__stderr;
|
||||
|
||||
void __fio_init()
|
||||
{
|
||||
__stdin.fd = 0;
|
||||
__stdout.fd = 1;
|
||||
__stderr.fd = 2;
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
.global _start
|
||||
.type _start, @function
|
||||
|
||||
.extern __fio_init
|
||||
.type __fio_init, @function
|
||||
|
||||
.extern main
|
||||
.type main, @function
|
||||
|
||||
@@ -9,6 +12,7 @@ _start:
|
||||
pop %rdi
|
||||
mov %rsp, %rsi
|
||||
andq $-16, %rsp
|
||||
call __fio_init
|
||||
call main
|
||||
movq %rax, %rdi
|
||||
movq $60, %rax
|
||||
|
||||
Reference in New Issue
Block a user