This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
OS_Project/Part4/10_scheduler/hello.c
Jonathan Turner f9879ab449 added part 4
2023-11-29 14:16:15 -05:00

56 lines
1.1 KiB
C

#include "./cpu/types.h"
#include "./libc/globals.h"
#include "./cpu/isr.h"
#include "./cpu/idt.h"
#include "./cpu/ports.h"
#include "./cpu/timer.h"
#include "./drivers/keyboard.h"
#include "./drivers/screen.h"
#include "./libc/mem.h"
#include "./libc/string.h"
#include "./libc/function.h"
void start_( void)
{
int pid = 0;
char c[16];
kprint("Process ");
hex_to_ascii( (u32 ) pid, c);
kprint( c);
kprint("has been entered. Hey there.\n");
return;
}
void user_input(char *input) {
if (strcmp(input, "END") == 0) {
kprint("Stopping the CPU. Bye!\n");
asm volatile("hlt");
} else if (strcmp(input, "ADD") == 0) {
u32 *n0; n0 = (u32 *) 16; n0++;
node *n1; n1 = NULL;
kmalloc( 20, 0, (u32 *) &n1);
n1->id = global_id++;
n1->base = global_id*100;
n1->size = global_id*10;
n1->next = NULL;
n1->previous = NULL;
kprint("ADDED: ");
char c[16];
hex_to_ascii( (u32 ) n1, c);
kprint( c);
kprint( " id: ");
hex_to_ascii( n1->id, c);
kprint( c);
} else if (strcmp(input, "ZOO") == 0) {
kprint("ZOO.\n");
}
kprint("You said: ");
kprint(input);
kprint("\n> ");
}