Some threading code cleanup

This commit is contained in:
2018-01-16 19:52:38 +01:00
parent 251b5f71c9
commit c26434f814
3 changed files with 20 additions and 23 deletions

View File

@@ -15,25 +15,22 @@ struct tcb
struct thread
{
union {
uint8_t stack[TCB_OFFSET];
struct {
uint8_t _stck[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;
};
};
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 tcb tcb;
};
}__attribute__((packed));
struct thread *current_thread;
#define CURRENT_THREAD() (current_thread)
#define GET_CURRENT_THREAD() (current_thread)
#define SET_CURRENT_THREAD(thread) current_thread = (thread)
struct thread *new_thread(void (*function)(void));
void yield();