Interface cleanup
This commit is contained in:
parent
024d772be8
commit
8af18644a3
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <queue.h>
|
||||
#include <scheduler.h>
|
||||
#include <memory.h>
|
||||
#include <stdint.h>
|
||||
|
||||
struct thread
|
||||
{
|
||||
@ -11,25 +11,6 @@ struct thread
|
||||
QUEUE_SPOT(READYQ);
|
||||
};
|
||||
|
||||
#define TCB_OFFSET (PAGE_SIZE - sizeof(struct thread))
|
||||
#define SWTCH_STACK_SIZE (0x8*8)
|
||||
|
||||
struct thread_stack
|
||||
{
|
||||
uint8_t stack[TCB_OFFSET-SWTCH_STACK_SIZE];
|
||||
uint64_t RBP;
|
||||
uint64_t RBX;
|
||||
uint64_t R12;
|
||||
uint64_t R13;
|
||||
uint64_t R14;
|
||||
uint64_t R15;
|
||||
uint64_t RBP2;
|
||||
uint64_t ret;
|
||||
|
||||
struct thread tcb;
|
||||
}__attribute__((packed));
|
||||
|
||||
#define thread_stack(th) (struct thread_stack *)((uintptr_t)th - TCB_OFFSET)
|
||||
|
||||
struct thread *new_thread(void (*function)(void));
|
||||
void yield();
|
||||
|
@ -1,5 +1,26 @@
|
||||
#include <thread.h>
|
||||
#include <scheduler.h>
|
||||
#include <memory.h>
|
||||
|
||||
#define TCB_OFFSET (PAGE_SIZE - sizeof(struct thread))
|
||||
#define SWTCH_STACK_SIZE (0x8*8)
|
||||
|
||||
struct thread_stack
|
||||
{
|
||||
uint8_t stack[TCB_OFFSET-SWTCH_STACK_SIZE];
|
||||
uint64_t RBP;
|
||||
uint64_t RBX;
|
||||
uint64_t R12;
|
||||
uint64_t R13;
|
||||
uint64_t R14;
|
||||
uint64_t R15;
|
||||
uint64_t RBP2;
|
||||
uint64_t ret;
|
||||
|
||||
struct thread tcb;
|
||||
}__attribute__((packed));
|
||||
|
||||
#define thread_stack(th) (struct thread_stack *)((uintptr_t)th - TCB_OFFSET)
|
||||
|
||||
struct thread boot_thread;
|
||||
struct thread *_current_thread = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user