ptos: ke: Add per-processor scheduler queue + PBI packer
Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
@@ -88,4 +88,7 @@ HalKpcrP2Init(KPCR *Kpcr)
|
||||
: "i" (GDT_TSS)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
/* Initialize the scheduler queue */
|
||||
SCHED_QUEUE_INIT(&Kpcr->SchedQueue);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <ptdef.h>
|
||||
#include <ex/pool.h>
|
||||
#include <ke/sched.h>
|
||||
#include <machine/mcb.h>
|
||||
|
||||
/*
|
||||
@@ -19,11 +20,13 @@
|
||||
*
|
||||
* @Id: Logical processor ID assigned by us
|
||||
* @PoolRegion: Allocator pool region
|
||||
* @SchedQueue: Per-core scheduler queue
|
||||
* @Mcb: Machine core block
|
||||
*/
|
||||
typedef struct {
|
||||
USHORT Id;
|
||||
POOL_REGION PoolRegion;
|
||||
SCHED_QUEUE SchedQueue;
|
||||
MCB Mcb;
|
||||
} KPCR;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Chloe M.
|
||||
* Provided under the BSD-3 clause.
|
||||
*
|
||||
* Description: Scheduler management
|
||||
* Author: Chloe M.
|
||||
*/
|
||||
|
||||
#ifndef _KE_SCHED_H_
|
||||
#define _KE_SCHED_H_ 1
|
||||
|
||||
#include <ps/thread.h>
|
||||
#include <ptdef.h>
|
||||
#include <queue.h>
|
||||
|
||||
/*
|
||||
* Represents a scheduler queue that threads can be pulled
|
||||
* from and added to.
|
||||
*
|
||||
* @ThreadQueue: Represents the actual queue that holds threads
|
||||
* @QueueEntries: Represents the number of entries in the queue
|
||||
*/
|
||||
typedef struct {
|
||||
TAILQ_HEAD(, _THREAD) ThreadQueue;
|
||||
USIZE QueueEntries;
|
||||
} SCHED_QUEUE;
|
||||
|
||||
/* Macro used to initialize the scheduler queue */
|
||||
#define SCHED_QUEUE_INIT(SQ_P) \
|
||||
TAILQ_INIT(&(SQ_P)->ThreadQueue); \
|
||||
(SQ_P)->QueueEntries = 0;
|
||||
|
||||
#endif /* !_KE_SCHED_H_ */
|
||||
Reference in New Issue
Block a user