mirror of
https://github.com/XunilGroup/XunilOS.git
synced 2026-04-25 19:59:02 +02:00
Make Doom run by improving and fixing libc stubs, adding proper heap
allocation, adding a timer, a framebuffer swap, rectangle and buffer draw syscall, moving the header files to the correct directory, disabling stack protection, AVX and MMX, while enabling SSE, fix interrupt handler popping in the wrong order, improve load_segment_to_memory alignment, add load_from_ptr to framebuffer for very quick drawing, serial_print as well as render font in consolewriter, zero the memory in sbrk, add a fake file system and methods to libxunil for DOOM, add correct printf, vsnprintf add _start which calls the main function in libxunil, mark all registers as used inside syscalls for no memory corruption, add build_helloworld.sh script
This commit is contained in:
1
user/libxunil/include/inttypes.h
Normal file
1
user/libxunil/include/inttypes.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <stdint.h>
|
||||
44
user/libxunil/include/stdio.h
Normal file
44
user/libxunil/include/stdio.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef struct FILE FILE;
|
||||
|
||||
extern FILE *stdin;
|
||||
extern FILE *stdout;
|
||||
extern FILE *stderr;
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
|
||||
FILE *fopen(const char *path, const char *mode);
|
||||
int fclose(FILE *fp);
|
||||
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *fp);
|
||||
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *fp);
|
||||
int fseek(FILE *fp, long offset, int whence);
|
||||
long ftell(FILE *fp);
|
||||
int fflush(FILE *fp);
|
||||
char *fgets(char *s, int size, FILE *fp);
|
||||
int fputs(const char *s, FILE *fp);
|
||||
int feof(FILE *fp);
|
||||
int ferror(FILE *fp);
|
||||
int remove(const char *path);
|
||||
int rename(const char *path, const char *new_path);
|
||||
|
||||
int printf(const char *fmt, ...);
|
||||
int puts(const char *s);
|
||||
int putchar(int c);
|
||||
|
||||
int fprintf(FILE *fp, const char *fmt, ...);
|
||||
int sprintf(char *buf, const char *fmt, ...);
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...);
|
||||
int vsnprintf(char *buf, size_t size, const char *fmt, va_list ap);
|
||||
int vfprintf(FILE *fp, const char *fmt, va_list ap);
|
||||
ssize_t write(int fd, const void *buf, size_t count);
|
||||
void exit(int code);
|
||||
|
||||
int sscanf(const char *str, const char *format, ...);
|
||||
24
user/libxunil/include/stdlib.h
Normal file
24
user/libxunil/include/stdlib.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
|
||||
void *malloc(size_t size);
|
||||
void *calloc(size_t nmemb, size_t size);
|
||||
void *realloc(void *ptr, size_t size);
|
||||
void free(void *ptr);
|
||||
|
||||
void exit(int status);
|
||||
void abort(void);
|
||||
|
||||
int atoi(const char *s);
|
||||
long atol(const char *s);
|
||||
double atof(const char *s);
|
||||
long strtol(const char *s, char **endptr, int base);
|
||||
double strtod(const char *s, char **endptr);
|
||||
|
||||
char *getenv(const char *name);
|
||||
void qsort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void *));
|
||||
int abs(int x);
|
||||
int system(const char *cmd);
|
||||
int draw_pixel(uint32_t x, uint32_t y, uint32_t color);
|
||||
int framebuffer_swap();
|
||||
22
user/libxunil/include/string.h
Normal file
22
user/libxunil/include/string.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <stddef.h>
|
||||
|
||||
void *memset(void *s, int c, size_t n);
|
||||
void *memcpy(void *dst, const void *src, size_t n);
|
||||
void *memmove(void *dst, const void *src, size_t n);
|
||||
int memcmp(const void *s1, const void *s2, size_t n);
|
||||
void *memchr(const void *s, int c, size_t n);
|
||||
|
||||
size_t strlen(const char *s);
|
||||
char *strcpy(char *dst, const char *src);
|
||||
char *strncpy(char *dst, const char *src, size_t n);
|
||||
char *strcat(char *dst, const char *src);
|
||||
char *strncat(char *dst, const char *src, size_t n);
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
char *strchr(const char *s, int c);
|
||||
char *strrchr(const char *s, int c);
|
||||
char *strstr(const char *haystack, const char *needle);
|
||||
char *strtok(char *str, const char *delim);
|
||||
char *strdup(const char *s);
|
||||
char *strerror(int errnum);
|
||||
8
user/libxunil/include/strings.h
Normal file
8
user/libxunil/include/strings.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include <stddef.h>
|
||||
|
||||
int strcasecmp(const char *s1, const char *s2);
|
||||
int strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
void bzero(void *s, size_t n);
|
||||
void bcopy(const void *src, void *dest, size_t n);
|
||||
int bcmp(const void *s1, const void *s2, size_t n);
|
||||
Reference in New Issue
Block a user