Interface cleanup

This commit is contained in:
Thomas Lovén 2018-02-15 12:09:37 +01:00
parent 024d772be8
commit 8af18644a3
2 changed files with 22 additions and 20 deletions

View File

@ -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();

View File

@ -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;