- TTY driver
- VGA driver
- kernel's main function
- Makefiles

*NOTE*: iceOS not works at this stage.
This commit is contained in:
ice-bit
2019-07-03 18:12:57 +02:00
parent bb59c7532f
commit bec03e3d1b
13 changed files with 328 additions and 13 deletions

10
kernel/libc/Makefile Normal file
View File

@@ -0,0 +1,10 @@
OBJS = stdio.o string.o
CC = i686-elf-gcc # cross-compiler
CFLAGS = -m32 -fno-stack-protector -ffreestanding -Wall -Wextra -Werror -g -c
all:${OBJS}
%.o: %.c
$(CC) $(CFLAGS) $< -o $@

View File

@@ -1,7 +1,6 @@
#include "stdio.h"
#include "string.h"
#include "drivers/shell.h"
#include "../drivers/tty.h"
int printf(const char *format, ...) {
char buf[20],c,*s;
@@ -20,32 +19,36 @@ int printf(const char *format, ...) {
case 'i':
val = va_arg(ap, int);
itoa(val, buf, 10);
printk(buf);
kprint(buf);
break;
case 'x':
uval = va_arg(ap, uint32_t);
uitoa(uval, buf, 16);
printk(buf);
kprint(buf);
break;
case 'd':
uval = va_arg(ap, uint32_t);
uitoa(uval, buf, 10);
printk(buf);
kprint(buf);
break;
case 'c':
s = va_arg(ap, char*);
printk_c(&c, 1);
kprint_c(&c, 1, WHITE, BLACK);
break;
case 's':
s = va_arg(ap, char*);
printk(s);
kprint(s);
break;
default:
printk_c((char*)format+1, 1);
kprint_c((char*)format+1, 1, WHITE, BLACK);
}
} else
printk_c((char*)format+1, 1);
kprint_c((char*)format+1, 1, WHITE, BLACK);
}
va_end(ap);
return 0;
}
void puts(int8_t *buf) {
printf("%s\n", buf);
}

View File

@@ -1,10 +1,19 @@
/**************************************
* iceOS Kernel *
* Developed by Marco 'icebit' Cetica *
* (c) 2019 *
* Released under GPLv3 *
* https://github.com/ice-bit/iceOS *
***************************************/
#ifndef _STDIO_H_
#define _STDIO_H
#define _STDIO_H_
#include <stdint.h>
#include <stddef.h>
#include <stdarg.h>
int printf(const char *format, ...);
void puts(uint8_t *buf);
#endif