forked from mgaillard/RaspberryPI_OS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkmain.c
42 lines (33 loc) · 716 Bytes
/
kmain.c
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
34
35
36
37
38
39
40
41
42
#include <inttypes.h>
#include "util.h"
#include "syscall.h"
#include "sched.h"
#include "hw.h"
#include "asm_tools.h"
int user_process()
{
int i = 0;
for(;;)
{
i++;
}
return EXIT_SUCCESS;
}
int kmain( void )
{
int status;
struct pcb_s* process;
sched_init();
process = create_process((func_t*)&user_process);
// ******************************************
// switch CPU to USER mode
// ******************************************
ENABLE_IRQ();
__asm("cps 0x10");
// USER Program
// ******************************************
//On attend la terminaison de notre processus.
status = sys_wait(process);
status++;
return 0;
}