Added libc functions

This commit is contained in:
Fabio Scotto di Santolo
2025-11-30 18:37:12 +01:00
parent 8f026965ca
commit 3a102f1e61
5 changed files with 168 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
#include "kernel.h"
#include "common.h"
extern uint8_t __bss[], __bss_end[], __stack_top[];
@@ -32,10 +33,14 @@ void putchar(char c)
void kernel_main(void)
{
const char *s = "\n\nHello World!\n";
for (int i = 0; s[i] != '\0'; i++) {
putchar(s[i]);
}
const char *s = "Hello World!";
printf("\nString = '%s'\n", s);
printf("\nPositive Integer = %d\n", 42);
printf("\nNegative Integer = %d\n", -42);
printf("\nHexadecimal = %x\n", 0xdeadbeef);
printf("offsetof(sbiret, error) = %x\n", offsetof(sbiret, error));
printf("offsetof(sbiret, value) = %x\n", offsetof(sbiret, value));
while(1) {
// wfi -> wait for interrupt