550W Document
550W, a high-end OS
|
#include <asm/context.h>
#include <common/elf.h>
#include <lib/list.h>
#include <os/cpu.h>
#include <os/lock.h>
#include <os/mm.h>
#include <os/sync.h>
#include <os/time.h>
类 | |
struct | prior |
struct | rusage |
struct | pcb |
宏定义 | |
#define | NUM_MAX_PCB_NAME 20 |
#define | NUM_MAX_PROCESS 16 |
#define | NUM_MAX_CHILD 5 |
#define | NUM_MAX_CHILD_THREADS 5 |
#define | NUM_MAX_TASK (1 + NUM_MAX_CHILD + NUM_MAX_CHILD_THREADS) * NUM_MAX_PROCESS |
#define | NUM_MAX_LOCK 16 |
#define | NUM_MAX_MBOX 16 |
#define | WNOHANG 0x00000001 |
#define | WUNTRACED 0x00000002 |
#define | WSTOPPED WUNTRACED |
#define | WEXITED 0x00000004 |
#define | WCONTINUED 0x00000008 |
#define | WNOWAIT 0x01000000 /* Don't reap, just poll status. */ |
#define | __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */ |
#define | __WALL 0x40000000 /* Wait on all children, regardless of type */ |
#define | __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */ |
#define | PRIO_MIN (-20) |
#define | PRIO_MAX 20 |
#define | PRIO_PROCESS 0 |
#define | PRIO_PGRP 1 |
#define | PRIO_USER 2 |
#define | CSIGNAL 0x000000ff /* signal mask to be sent at exit */ |
#define | CLONE_VM 0x00000100 /* set if VM shared between processes */ |
#define | CLONE_FS 0x00000200 /* set if fs info shared between processes */ |
#define | CLONE_FILES 0x00000400 /* set if open files shared between processes */ |
#define | CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ |
#define | CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */ |
#define | CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ |
#define | CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ |
#define | CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ |
#define | CLONE_THREAD 0x00010000 /* Same thread group? */ |
#define | CLONE_NEWNS 0x00020000 /* New mount namespace group */ |
#define | CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ |
#define | CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ |
#define | CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ |
#define | CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ |
#define | CLONE_DETACHED 0x00400000 /* Unused, ignored */ |
#define | CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ |
#define | CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ |
#define | CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace */ |
#define | CLONE_NEWUTS 0x04000000 /* New utsname namespace */ |
#define | CLONE_NEWIPC 0x08000000 /* New ipc namespace */ |
#define | CLONE_NEWUSER 0x10000000 /* New user namespace */ |
#define | CLONE_NEWPID 0x20000000 /* New pid namespace */ |
#define | CLONE_NEWNET 0x40000000 /* New network namespace */ |
#define | CLONE_IO 0x80000000 /* Clone io context */ |
类型定义 | |
typedef void(* | void_task) () |
typedef struct prior | prior_t |
typedef enum task_status | task_status_t |
typedef enum task_type | task_type_t |
typedef enum enqueue_way | enqueue_way_t |
typedef enum dequeue_way | dequeue_way_t |
typedef enum unblock_way | unblock_way_t |
typedef struct rusage | rusage_t |
typedef struct pcb | pcb_t |
枚举 | |
enum | task_status { TASK_BLOCKED , TASK_RUNNING , TASK_READY , TASK_EXITED } |
enum | task_type { KERNEL_PROCESS , KERNEL_THREAD , USER_PROCESS , USER_THREAD } |
enum | enqueue_way { ENQUEUE_LIST , ENQUEUE_TIMER_LIST } |
enum | dequeue_way { DEQUEUE_LIST , DEQUEUE_LIST_STRATEGY } |
enum | unblock_way { UNBLOCK_TO_LIST_FRONT , UNBLOCK_TO_LIST_BACK , UNBLOCK_ONLY , UNBLOCK_TO_LIST_STRATEGY } |
函数 | |
void | k_pcb_init () |
void | switch_to (pcb_t *prev, pcb_t *next) |
long | k_pcb_scheduler (void) |
void | k_pcb_block (list_head *, list_head *queue, enqueue_way_t way) |
void | k_pcb_unblock (list_head *, list_head *, unblock_way_t way) |
long | k_pcb_getpid (void) |
void | k_pcb_sleep (void *chan, spin_lock_t *lk) |
void | k_pcb_wakeup (void *chan) |
long | sys_sched_yield (void) |
long | sys_nanosleep (nanotime_val_t *rqtp, nanotime_val_t *rmtp) |
long | sys_spawn (const char *file_name) |
long | sys_fork (void) |
long | sys_exec (const char *file_name, const char *argv[], const char *envp[]) |
long | sys_execve (const char *file_name, const char *argv[], const char *envp[]) |
long | sys_clone (unsigned long flags, void *stack, pid_t *parent_tid, void *tls, pid_t *child_tid) |
long | sys_kill (pid_t pid) |
long | sys_exit (int error_code) |
long | sys_wait4 (pid_t pid, int *stat_addr, int options, rusage_t *ru) |
long | sys_process_show () |
long | sys_setpriority (int which, int who, int niceval) |
long | sys_getpriority (int which, int who) |
long | sys_getpid (void) |
[SYSCALL] getpid: get current task process id 更多... | |
long | sys_getppid (void) |
[SYSCALL] getppid: get parent of current task pid 更多... | |
long | sys_sched_setaffinity (pid_t pid, unsigned int len, const uint8_t *user_mask_ptr) |
long | sys_sched_getaffinity (pid_t pid, unsigned int len, uint8_t *user_mask_ptr) |
变量 | |
pcb_mbox_t | pcb_mbox [NUM_MAX_PROCESS] |
pcb_t *volatile | current_running0 |
pcb_t *volatile | current_running1 |
pcb_t *volatile *volatile | current_running |
list_head | ready_queue |
list_head | block_queue |
pcb_t | pcb [NUM_MAX_TASK] |
const ptr_t | pid0_stack |
const ptr_t | pid0_stack2 |
pcb_t | pid0_pcb |
pcb_t | pid0_pcb2 |
pid_t | freepid [NUM_MAX_TASK] |
#define __WALL 0x40000000 /* Wait on all children, regardless of type */ |
#define __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */ |
#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */ |
#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ |
#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ |
#define CLONE_DETACHED 0x00400000 /* Unused, ignored */ |
#define CLONE_FILES 0x00000400 /* set if open files shared between processes */ |
#define CLONE_FS 0x00000200 /* set if fs info shared between processes */ |
#define CLONE_IO 0x80000000 /* Clone io context */ |
#define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace */ |
#define CLONE_NEWIPC 0x08000000 /* New ipc namespace */ |
#define CLONE_NEWNET 0x40000000 /* New network namespace */ |
#define CLONE_NEWNS 0x00020000 /* New mount namespace group */ |
#define CLONE_NEWPID 0x20000000 /* New pid namespace */ |
#define CLONE_NEWUSER 0x10000000 /* New user namespace */ |
#define CLONE_NEWUTS 0x04000000 /* New utsname namespace */ |
#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ |
#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ |
#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */ |
#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ |
#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ |
#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ |
#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ |
#define CLONE_THREAD 0x00010000 /* Same thread group? */ |
#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ |
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ |
#define CLONE_VM 0x00000100 /* set if VM shared between processes */ |
#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ |
#define NUM_MAX_CHILD 5 |
#define NUM_MAX_CHILD_THREADS 5 |
#define NUM_MAX_LOCK 16 |
#define NUM_MAX_MBOX 16 |
#define NUM_MAX_PCB_NAME 20 |
#define NUM_MAX_PROCESS 16 |
#define NUM_MAX_TASK (1 + NUM_MAX_CHILD + NUM_MAX_CHILD_THREADS) * NUM_MAX_PROCESS |
#define PRIO_MAX 20 |
#define PRIO_MIN (-20) |
#define PRIO_PGRP 1 |
#define PRIO_PROCESS 0 |
#define PRIO_USER 2 |
#define WCONTINUED 0x00000008 |
#define WEXITED 0x00000004 |
#define WNOHANG 0x00000001 |
#define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ |
#define WSTOPPED WUNTRACED |
#define WUNTRACED 0x00000002 |
typedef enum dequeue_way dequeue_way_t |
typedef enum enqueue_way enqueue_way_t |
typedef enum task_status task_status_t |
typedef enum task_type task_type_t |
typedef enum unblock_way unblock_way_t |
typedef void(* void_task) () |
enum dequeue_way |
enum enqueue_way |
enum task_status |
enum task_type |
enum unblock_way |
void k_pcb_block | ( | list_head * | pcb_node, |
list_head * | queue, | ||
enqueue_way_t | way | ||
) |
long k_pcb_getpid | ( | void | ) |
void k_pcb_init | ( | ) |
long k_pcb_scheduler | ( | void | ) |
void k_pcb_sleep | ( | void * | chan, |
spin_lock_t * | lk | ||
) |
void k_pcb_unblock | ( | list_head * | from_queue, |
list_head * | to_queue, | ||
unblock_way_t | way | ||
) |
void k_pcb_wakeup | ( | void * | chan | ) |
long sys_clone | ( | unsigned long | flags, |
void * | stack, | ||
pid_t * | parent_tid, | ||
void * | tls, | ||
pid_t * | child_tid | ||
) |
long sys_exec | ( | const char * | file_name, |
const char * | argv[], | ||
const char * | envp[] | ||
) |
long sys_execve | ( | const char * | file_name, |
const char * | argv[], | ||
const char * | envp[] | ||
) |
long sys_exit | ( | int | error_code | ) |
long sys_fork | ( | void | ) |
long sys_getpid | ( | void | ) |
[SYSCALL] getpid: get current task process id
long sys_getppid | ( | void | ) |
[SYSCALL] getppid: get parent of current task pid
long sys_getpriority | ( | int | which, |
int | who | ||
) |
long sys_kill | ( | pid_t | pid | ) |
long sys_nanosleep | ( | nanotime_val_t * | rqtp, |
nanotime_val_t * | rmtp | ||
) |
long sys_process_show | ( | ) |
long sys_sched_getaffinity | ( | pid_t | pid, |
unsigned int | len, | ||
uint8_t * | user_mask_ptr | ||
) |
long sys_sched_setaffinity | ( | pid_t | pid, |
unsigned int | len, | ||
const uint8_t * | user_mask_ptr | ||
) |
long sys_sched_yield | ( | void | ) |
long sys_setpriority | ( | int | which, |
int | who, | ||
int | niceval | ||
) |
long sys_spawn | ( | const char * | file_name | ) |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |