mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-13 14:36:37 -04:00
Fix warnings
This commit is contained in:
parent
085f49e6cc
commit
b2012b3669
@ -25,6 +25,7 @@ inline void thor_assert(bool condition, const char* message){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inline void thor_unreachable(const char* message) __attribute__((noreturn));
|
||||||
inline void thor_unreachable(const char* message){
|
inline void thor_unreachable(const char* message){
|
||||||
__thor_unreachable(message);
|
__thor_unreachable(message);
|
||||||
__builtin_unreachable();
|
__builtin_unreachable();
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
namespace scheduler {
|
namespace scheduler {
|
||||||
|
|
||||||
constexpr const size_t MAX_PRIORITY = 3;
|
constexpr const size_t MAX_PRIORITY = 4;
|
||||||
constexpr const size_t MIN_PRIORITY = 0;
|
constexpr const size_t MIN_PRIORITY = 1;
|
||||||
constexpr const size_t PRIORITY_LEVELS = MAX_PRIORITY - MIN_PRIORITY + 1;
|
constexpr const size_t PRIORITY_LEVELS = MAX_PRIORITY - MIN_PRIORITY + 1;
|
||||||
constexpr const size_t DEFAULT_PRIORITY = 2;
|
constexpr const size_t DEFAULT_PRIORITY = 3;
|
||||||
|
|
||||||
typedef size_t pid_t;
|
typedef size_t pid_t;
|
||||||
|
|
||||||
|
@ -44,6 +44,10 @@ std::array<process_control_t, scheduler::MAX_PROCESS> pcb;
|
|||||||
//Define one run queue for each priority level
|
//Define one run queue for each priority level
|
||||||
std::array<std::vector<scheduler::pid_t>, scheduler::PRIORITY_LEVELS> run_queues;
|
std::array<std::vector<scheduler::pid_t>, scheduler::PRIORITY_LEVELS> run_queues;
|
||||||
|
|
||||||
|
std::vector<scheduler::pid_t>& run_queue(size_t priority){
|
||||||
|
return run_queues[priority - scheduler::MIN_PRIORITY];
|
||||||
|
}
|
||||||
|
|
||||||
bool started = false;
|
bool started = false;
|
||||||
|
|
||||||
constexpr const size_t TURNOVER = 10;
|
constexpr const size_t TURNOVER = 10;
|
||||||
@ -104,7 +108,7 @@ void queue_process(scheduler::pid_t pid){
|
|||||||
|
|
||||||
process.state = scheduler::process_state::READY;
|
process.state = scheduler::process_state::READY;
|
||||||
|
|
||||||
run_queues[process.process.priority].push_back(pid);
|
run_queue(process.process.priority).push_back(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler::process_t& create_kernel_task(char* user_stack, char* kernel_stack, void (*fun)()){
|
scheduler::process_t& create_kernel_task(char* user_stack, char* kernel_stack, void (*fun)()){
|
||||||
@ -174,7 +178,7 @@ size_t select_next_process(){
|
|||||||
|
|
||||||
//1. Run a process of higher priority, if any
|
//1. Run a process of higher priority, if any
|
||||||
for(size_t p = scheduler::MAX_PRIORITY; p > current_priority; --p){
|
for(size_t p = scheduler::MAX_PRIORITY; p > current_priority; --p){
|
||||||
for(auto pid : run_queues[p]){
|
for(auto pid : run_queue(p)){
|
||||||
if(pcb[pid].state == scheduler::process_state::READY){
|
if(pcb[pid].state == scheduler::process_state::READY){
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
@ -183,7 +187,7 @@ size_t select_next_process(){
|
|||||||
|
|
||||||
//2. Run the next process of the same priority
|
//2. Run the next process of the same priority
|
||||||
|
|
||||||
auto& current_run_queue = run_queues[current_priority];
|
auto& current_run_queue = run_queue(current_priority);
|
||||||
|
|
||||||
size_t next_index = 0;
|
size_t next_index = 0;
|
||||||
for(size_t i = 0; i < current_run_queue.size(); ++i){
|
for(size_t i = 0; i < current_run_queue.size(); ++i){
|
||||||
@ -207,7 +211,7 @@ size_t select_next_process(){
|
|||||||
//3. Run a process of lower priority
|
//3. Run a process of lower priority
|
||||||
|
|
||||||
for(size_t p = current_priority - 1; p >= scheduler::MIN_PRIORITY; --p){
|
for(size_t p = current_priority - 1; p >= scheduler::MIN_PRIORITY; --p){
|
||||||
for(auto pid : run_queues[p]){
|
for(auto pid : run_queue(p)){
|
||||||
if(pcb[pid].state == scheduler::process_state::READY){
|
if(pcb[pid].state == scheduler::process_state::READY){
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
@ -720,7 +720,7 @@ void readelf_command(const std::vector<std::string>& params){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void exec_command(const std::vector<std::string>& params){
|
void exec_command(const std::vector<std::string>&){
|
||||||
//Fake exec just to start() the scheduler
|
//Fake exec just to start() the scheduler
|
||||||
scheduler::exec("");
|
scheduler::exec("");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user