aboutsummaryrefslogtreecommitdiff
path: root/src/userspace/programs/init.c
blob: 1d53ee87484eb4b44bb96a03c747b617971fe1bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdio.h>
#include <stdlib.h>
#include <common.h>
#include <syscall.h>
#include <unistd.h>
#include <gui.h>

void main()
{
	if (get_pid() != 2) {
		printf("Wrong PID!\n");
		exit(1);
	}

	// TODO: Fix page fault when mallocing
	printf("Initializing userspace...\n");

	// TODO: Fix occasional race conditions with cli/sti
	// TODO: Fix scheduler turning off randomly..
	u32 x;
	u32 f = fork();
	if (f == 0) {
		printf("Waiting...\n");
		wait(&x);
	} else {
		printf("Executing...\n");
		exec("/bin/sh");
	}

	while (1) {
		//printf("B");
	};
}