mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
使process模块能以O3优化下运行
This commit is contained in:
@ -18,8 +18,9 @@
|
||||
#include <filesystem/VFS/VFS.h>
|
||||
#include <common/wait_queue.h>
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize("O0")
|
||||
// #pragma GCC push_options
|
||||
// #pragma GCC optimize("O0")
|
||||
|
||||
// 进程最大可拥有的文件描述符数量
|
||||
#define PROC_MAX_FD_NUM 16
|
||||
|
||||
@ -214,17 +215,21 @@ struct tss_struct
|
||||
.io_map_base_addr = 0 \
|
||||
}
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize("O0")
|
||||
// 获取当前的pcb
|
||||
struct process_control_block *get_current_pcb()
|
||||
{
|
||||
struct process_control_block *current = NULL;
|
||||
// 利用了当前pcb和栈空间总大小为32k大小对齐,将rsp低15位清空,即可获得pcb的起始地址
|
||||
barrier();
|
||||
__asm__ __volatile__("andq %%rsp, %0 \n\t"
|
||||
: "=r"(current)
|
||||
: "0"(~32767UL));
|
||||
barrier();
|
||||
return current;
|
||||
};
|
||||
|
||||
#pragma GCC pop_options
|
||||
#define current_pcb get_current_pcb()
|
||||
|
||||
#define GET_CURRENT_PCB \
|
||||
@ -351,7 +356,7 @@ int kernel_thread(unsigned long (*fn)(unsigned long), unsigned long arg, unsigne
|
||||
asm volatile("movq %0, %%cr3 \n\t" ::"r"(next_pcb->mm->pgd) \
|
||||
: "memory"); \
|
||||
} while (0)
|
||||
// flush_tlb(); \
|
||||
// flush_tlb();
|
||||
|
||||
// 获取当前cpu id
|
||||
#define proc_current_cpu_id (current_pcb->cpu_id)
|
||||
@ -365,4 +370,3 @@ extern struct mm_struct initial_mm;
|
||||
extern struct thread_struct initial_thread;
|
||||
extern union proc_union initial_proc_union;
|
||||
extern struct process_control_block *initial_proc[MAX_CPU_NUM];
|
||||
#pragma GCC pop_options
|
Reference in New Issue
Block a user