diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/c/gdt.c | 2 | ||||
| -rw-r--r-- | src/c/heap.c | 2 | ||||
| -rw-r--r-- | src/c/idt.c | 6 | ||||
| -rw-r--r-- | src/c/irq.c | 4 | ||||
| -rw-r--r-- | src/c/kernel.c | 4 | ||||
| -rw-r--r-- | src/c/keyboard.c | 6 | ||||
| -rw-r--r-- | src/c/paging.c | 2 | ||||
| -rw-r--r-- | src/c/stack_protector.c | 4 | ||||
| -rw-r--r-- | src/c/stdio.c | 4 | ||||
| -rw-r--r-- | src/c/string.c | 2 | ||||
| -rw-r--r-- | src/c/timer.c | 6 | ||||
| -rw-r--r-- | src/c/tty.c | 8 | ||||
| -rw-r--r-- | src/c/vga.c | 8 | ||||
| -rw-r--r-- | src/include/asm.h | 2 | ||||
| -rw-r--r-- | src/include/errno.h | 0 | ||||
| -rw-r--r-- | src/include/heap.h | 2 | ||||
| -rw-r--r-- | src/include/stdio.h | 26 | ||||
| -rw-r--r-- | src/include/stdlib.h | 15 | ||||
| -rw-r--r-- | src/include/string.h | 17 | ||||
| -rw-r--r-- | src/include/sys/types.h | 4 | ||||
| -rw-r--r-- | src/include/time.h | 0 | ||||
| -rw-r--r-- | src/include/unistd.h | 14 | ||||
| -rw-r--r-- | src/include/vga.h | 2 |
23 files changed, 103 insertions, 37 deletions
diff --git a/src/c/gdt.c b/src/c/gdt.c index 739fe70..a9a745c 100644 --- a/src/c/gdt.c +++ b/src/c/gdt.c @@ -1,4 +1,4 @@ -#include"../include/types.h" +#include<types.h> struct gdt_entry { diff --git a/src/c/heap.c b/src/c/heap.c index 2683269..3e1ba24 100644 --- a/src/c/heap.c +++ b/src/c/heap.c @@ -1,4 +1,4 @@ -#include"../include/types.h" +#include<types.h> typedef struct _KHEAPBLOCKBM { struct _KHEAPBLOCKBM *next; diff --git a/src/c/idt.c b/src/c/idt.c index d12015e..005a05c 100644 --- a/src/c/idt.c +++ b/src/c/idt.c @@ -1,6 +1,6 @@ -#include"../include/types.h" -#include"../include/irq.h" -#include"../include/asm.h" +#include<types.h> +#include<irq.h> +#include<asm.h> #define INTERRUPT_GATE_32 0x8E diff --git a/src/c/irq.c b/src/c/irq.c index 2a1c4d4..62b53ee 100644 --- a/src/c/irq.c +++ b/src/c/irq.c @@ -1,5 +1,5 @@ -#include"../include/stdio.h" -#include"../include/asm.h" +#include<stdio.h> +#include<asm.h> #define INTERRUPT_GATE_32 0x8e diff --git a/src/c/kernel.c b/src/c/kernel.c index a00c242..df12193 100644 --- a/src/c/kernel.c +++ b/src/c/kernel.c @@ -1,5 +1,5 @@ -#include"../include/stdio.h" -#include"../include/heap.h" +#include<stdio.h> +#include<heap.h> void terminal_initialize(void); void init_idt_table(void); diff --git a/src/c/keyboard.c b/src/c/keyboard.c index d573472..5da3239 100644 --- a/src/c/keyboard.c +++ b/src/c/keyboard.c @@ -1,6 +1,6 @@ -#include"../include/types.h" -#include"../include/asm.h" -#include"../include/stdio.h" +#include<types.h> +#include<asm.h> +#include<stdio.h> #define BUFFER_SIZE 200 char buffer[BUFFER_SIZE]; diff --git a/src/c/paging.c b/src/c/paging.c index becc79d..660ee8c 100644 --- a/src/c/paging.c +++ b/src/c/paging.c @@ -1,4 +1,4 @@ -#include"../include/types.h" +#include<types.h> extern void loadPageDirectory(uint32_t*); extern void enablePaging(); diff --git a/src/c/stack_protector.c b/src/c/stack_protector.c index 3289cec..9ce3cba 100644 --- a/src/c/stack_protector.c +++ b/src/c/stack_protector.c @@ -1,5 +1,5 @@ -#include <stdint.h> -#include"../include/stdio.h" +#include<stdint.h> +#include<stdio.h> #if UINT32_MAX == UINTPTR_MAX #define STACK_CHK_GUARD 0xe2dee396 diff --git a/src/c/stdio.c b/src/c/stdio.c index 83d2b0a..36fd140 100644 --- a/src/c/stdio.c +++ b/src/c/stdio.c @@ -1,5 +1,5 @@ -#include"../include/types.h" -#include"../include/string.h" +#include<types.h> +#include<string.h> #include<stdarg.h> void terminal_putchar(char c); diff --git a/src/c/string.c b/src/c/string.c index ff2821a..6a3a96b 100644 --- a/src/c/string.c +++ b/src/c/string.c @@ -1,4 +1,4 @@ -#include"../include/types.h" +#include<types.h> size_t stringlen(char *str) { diff --git a/src/c/timer.c b/src/c/timer.c index edeea21..0b4ddaa 100644 --- a/src/c/timer.c +++ b/src/c/timer.c @@ -1,6 +1,6 @@ -#include"../include/types.h" -#include"../include/asm.h" -#include"../include/stdio.h" +#include<types.h> +#include<asm.h> +#include<stdio.h> void add_idt_entry(size_t num,uint32_t offset); diff --git a/src/c/tty.c b/src/c/tty.c index c473fa1..c7e5f44 100644 --- a/src/c/tty.c +++ b/src/c/tty.c @@ -1,7 +1,7 @@ -#include"../include/types.h" -#include"../include/string.h" -#include"../include/stdio.h" -#include"../include/vga.h" +#include<types.h> +#include<string.h> +#include<stdio.h> +#include<vga.h> #define CMD_LENGTH 20 diff --git a/src/c/vga.c b/src/c/vga.c index 8c1824b..e61cd7f 100644 --- a/src/c/vga.c +++ b/src/c/vga.c @@ -1,7 +1,7 @@ -#include"../include/types.h" -#include"../include/string.h" -#include"../include/asm.h" -#include"../include/vga.h" +#include<types.h> +#include<string.h> +#include<asm.h> +#include<vga.h> size_t terminal_row; size_t terminal_column; diff --git a/src/include/asm.h b/src/include/asm.h index 1d61b88..9f2a9e6 100644 --- a/src/include/asm.h +++ b/src/include/asm.h @@ -1,7 +1,7 @@ #ifndef ASM_H #define ASM_H -#include"types.h" +#include<types.h> extern uint8_t ioport_in(uint8_t port); extern void ioport_out(uint8_t port, char data); diff --git a/src/include/errno.h b/src/include/errno.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/include/errno.h diff --git a/src/include/heap.h b/src/include/heap.h index 11478aa..fa32f26 100644 --- a/src/include/heap.h +++ b/src/include/heap.h @@ -1,7 +1,7 @@ #ifndef HEAP_H #define HEAP_H -#include"types.h" +#include<types.h> void kheapinit(); int kheapaddblock(uintptr_t addr,uint32_t size,uint32_t bsize); diff --git a/src/include/stdio.h b/src/include/stdio.h index 2d0aa8a..45c9215 100644 --- a/src/include/stdio.h +++ b/src/include/stdio.h @@ -1,6 +1,28 @@ -#ifndef STDIO_H -#define STDIO_H +#ifndef _STDIO_H +#define _STDIO_H +#include <stdarg.h> +#include <stddef.h> +#define SEEK_SET 0 +typedef struct { int unused; } FILE; +#ifdef __cplusplus +extern "C" { +#endif +extern FILE* stderr; +#define stderr stderr +int fclose(FILE*); +int fflush(FILE*); +FILE* fopen(const char*, const char*); +int fprintf(FILE*, const char*, ...); +size_t fread(void*, size_t, size_t, FILE*); +int fseek(FILE*, long, int); +long ftell(FILE*); +size_t fwrite(const void*, size_t, size_t, FILE*); +void setbuf(FILE*, char*); +int vfprintf(FILE*, const char*, va_list); void printf(char *str, ...); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/include/stdlib.h b/src/include/stdlib.h new file mode 100644 index 0000000..a0afe38 --- /dev/null +++ b/src/include/stdlib.h @@ -0,0 +1,15 @@ +#ifndef _STDLIB_H +#define _STDLIB_H +#ifdef __cplusplus +extern "C" { +#endif +void abort(void); +int atexit(void (*)(void)); +int atoi(const char*); +void free(void*); +char* getenv(const char*); +void* malloc(size_t); +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/include/string.h b/src/include/string.h index 500f545..bef5854 100644 --- a/src/include/string.h +++ b/src/include/string.h @@ -1,7 +1,18 @@ -#ifndef STRING_H -#define STRING_H +#ifndef _STRING_H +#define _STRING_H +#include <stddef.h> +#ifdef __cplusplus +extern "C" { +#endif +void* memcpy(void*, const void*, size_t); +void* memset(void*, int, size_t); +char* strcpy(char*, const char*); +size_t strlen(const char*); +#ifdef __cplusplus +} +#endif -#include"types.h" +#include<types.h> size_t stringlen(char *str); bool stringcmp(char *str1,char *str2); diff --git a/src/include/sys/types.h b/src/include/sys/types.h new file mode 100644 index 0000000..4f55189 --- /dev/null +++ b/src/include/sys/types.h @@ -0,0 +1,4 @@ +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H +typedef int pid_t; +#endif diff --git a/src/include/time.h b/src/include/time.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/include/time.h diff --git a/src/include/unistd.h b/src/include/unistd.h new file mode 100644 index 0000000..a6bfee0 --- /dev/null +++ b/src/include/unistd.h @@ -0,0 +1,14 @@ +#ifndef _UNISTD_H +#define _UNISTD_H +#include <sys/types.h> +#ifdef __cplusplus +extern "C" { +#endif +int execv(const char*, char* const[]); +int execve(const char*, char* const[], char* const[]); +int execvp(const char*, char* const[]); +pid_t fork(void); +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/include/vga.h b/src/include/vga.h index 93d5df3..eb43644 100644 --- a/src/include/vga.h +++ b/src/include/vga.h @@ -1,7 +1,7 @@ #ifndef VGA_H #define VGA_H -#include"types.h" +#include<types.h> static const size_t VGA_WIDTH = 80; static const size_t VGA_HEIGHT = 25; |
