AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
proc.c
Go to the documentation of this file.
1
5
6#include <core/system.h>
7#include <core/arch.h>
8#include <core/panic.h>
9#include <mm/pmap.h>
10#include <sys/proc.h>
11#include <sys/sched.h>
12
14
15/*
16 * Sets up the architecture's part of init's thread, to start at its
17 * program's entry point. Panics if there's no memory.
18 */
20{
21 struct aarch64_thread *arch = aarch64_thread_new();
22
23 if (!arch)
24 panic("no memory for init's thread");
25
26 arch->pc = proc->entry;
27 arch->sp = USER_STACK;
28
29 struct thread *thread = (struct thread *) proc->threads.head->value;
30 thread->arch = arch;
31}
#define USER_STACK
Definition arch.h:60
struct aarch64_thread * aarch64_thread_new(void)
Makes a thread's aarch64 state, with its kernel stack.
Definition thread.c:30
void arch_proc_init(struct proc *proc)
Sets up the architecture's part of a new process's thread (init's, at boot): its kernel stack,...
Definition proc.c:19
#define panic(s)
Definition panic.h:15
A thread's aarch64 state (thread->arch).
Definition arch.h:25
uint64_t sp
Definition arch.h:37
uint64_t pc
Definition arch.h:37
A process.
Definition proc.h:75
struct queue threads
its threads
Definition proc.h:136
uintptr_t entry
its program's entry point
Definition proc.h:126
void * value
Definition queue.h:20
struct qnode * head
Definition queue.h:31
A thread.
Definition thread.h:23
void * arch
the architecture's own data: its registers, its kernel stack
Definition thread.h:84