123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- #pragma once
- #include <common/wait_queue.h>
- #define PROC_MAX_FD_NUM 16
- #define STACK_SIZE 32768
- #define PROC_RUNNING (1 << 0)
- #define PROC_INTERRUPTIBLE (1 << 1)
- #define PROC_UNINTERRUPTIBLE (1 << 2)
- #define PROC_ZOMBIE (1 << 3)
- #define PROC_STOPPED (1 << 4)
- #define KERNEL_CS (0x08)
- #define KERNEL_DS (0x10)
- #define USER_CS (0x28)
- #define USER_DS (0x30)
- #define CLONE_FS (1UL << 0)
- #define CLONE_SIGNAL (1UL << 1)
- #define CLONE_VM (1UL << 2)
- #define PCB_NAME_LEN 16
- struct thread_struct
- {
-
- ul rbp;
-
- ul rip;
-
- ul rsp;
- ul fs, gs;
- ul cr2;
-
- ul trap_num;
-
- ul err_code;
- };
- #define PF_KTHREAD (1UL << 0)
- #define PF_NEED_SCHED (1UL << 1)
- #define PF_VFORK (1UL << 2)
- #define PF_KFORK (1UL << 3)
- #define PF_NOFREEZE (1UL << 4)
- struct process_control_block
- {
-
- volatile long state;
-
- unsigned long flags;
- int64_t preempt_count;
- long signal;
- long cpu_id;
- char name[PCB_NAME_LEN];
-
- struct mm_struct *mm;
-
- struct thread_struct *thread;
-
- struct List list;
-
-
-
-
-
-
- uint64_t addr_limit;
- long pid;
- long priority;
- int64_t virtual_runtime;
-
-
- struct vfs_file_t *fds[PROC_MAX_FD_NUM];
-
- struct process_control_block *next_pcb;
-
- struct process_control_block *parent_pcb;
- int32_t exit_code;
- uint32_t policy;
- wait_queue_node_t wait_child_proc_exit;
-
- void *worker_private;
- };
- union proc_union
- {
- struct process_control_block pcb;
- ul stack[STACK_SIZE / sizeof(ul)];
- } __attribute__((aligned(8)));
- struct tss_struct
- {
- unsigned int reserved0;
- ul rsp0;
- ul rsp1;
- ul rsp2;
- ul reserved1;
- ul ist1;
- ul ist2;
- ul ist3;
- ul ist4;
- ul ist5;
- ul ist6;
- ul ist7;
- ul reserved2;
- unsigned short reserved3;
-
- unsigned short io_map_base_addr;
- } __attribute__((packed));
|