Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
thread.h File Reference
#include "autoconf.h"
#include "hal/cpu/register.h"
#include "procc/process.h"
#include <spinlock.h>

Go to the source code of this file.

Data Structures

struct  thread
 
struct  thread_slot_t
 
struct  thread_bucket
 

Macros

#define THREAD_MAKE_ID(id, gen)
 
#define THREAD_GET_ID(tid)
 
#define THREAD_GET_GEN(tid)
 

Typedefs

typedef struct thread_bucket thread_bucket_t
 

Enumerations

enum  : uint16_t { THREAD_USER = (1 << 0) , THREAD_PREEMPT_ENABLE = (1 << 1) }
 
enum  {
  THREAD_STATE_CREATE = 0 , THREAD_STATE_READY = 1 , THREAD_STATE_RUNNING = 2 , THREAD_STATE_BLOCKED = 3 ,
  THREAD_STATE_TERMINATED = 4 , THREAD_STATE_HAL = 5
}
 

Functions

struct thread __attribute__ ((aligned(64)))
 
thread_tcreate_thread (volatile uintptr_t *page, uintptr_t entry, uintptr_t stack, uint16_t core_affinity, uint8_t priority, uint16_t flags)
 
void vxThreadExit (void)
 

Variables

typedef __attribute__
 
thread_id id
 
uint16_t core_affinity
 
volatile uintptr_tpage
 
uint8_t state
 
uint8_t priority
 
uint16_t flags
 
uint64_t stack
 
uint64_t last_run_time
 
boolean_t has_update_run_time
 
uintptr_t entry_addr
 
uint16_t current_core_id
 
process_t * process
 
uint32_tclear_child_tid
 
uint32_t uuid
 
uint64_t fs_base
 
uint64_t gs_base
 
uint8_t _pad [12]
 
uintptr_t kernel_rsp
 
uintptr_t kernel_stack_base
 
uintptr_t kernel_stack_top
 
bool in_kernel_sleep
 
bool wake_pending
 
cpu_register_t reg
 

Macro Definition Documentation

◆ THREAD_GET_GEN

#define THREAD_GET_GEN ( tid)
Value:
((uint32_t)((tid) >> 32))
unsigned int uint32_t
Definition type.h:19

Definition at line 71 of file thread.h.

◆ THREAD_GET_ID

#define THREAD_GET_ID ( tid)
Value:
((uint32_t)((tid) & 0xFFFFFFFFULL) - 1)

Definition at line 70 of file thread.h.

◆ THREAD_MAKE_ID

#define THREAD_MAKE_ID ( id,
gen )
Value:
((uint64_t)(gen) << 32 | ((uint64_t)(id) + 1))
thread_id id
Definition thread.h:1
unsigned long uint64_t
Definition type.h:25

Definition at line 69 of file thread.h.

Typedef Documentation

◆ thread_bucket_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : uint16_t
Enumerator
THREAD_USER 
THREAD_PREEMPT_ENABLE 

Definition at line 11 of file thread.h.

◆ anonymous enum

anonymous enum
Enumerator
THREAD_STATE_CREATE 
THREAD_STATE_READY 
THREAD_STATE_RUNNING 
THREAD_STATE_BLOCKED 
THREAD_STATE_TERMINATED 
THREAD_STATE_HAL 

Definition at line 16 of file thread.h.

Function Documentation

◆ __attribute__()

struct thread __attribute__ ( (aligned(64)) )

Definition at line 1 of file core.h.

◆ create_thread()

◆ vxThreadExit()

void vxThreadExit ( void )

Definition at line 70 of file thread.c.

Variable Documentation

◆ __attribute__

typedef __attribute__

◆ _pad

uint8_t _pad[12]

Definition at line 18 of file thread.h.

◆ clear_child_tid

uint32_t* clear_child_tid

Definition at line 14 of file thread.h.

◆ core_affinity

uint16_t core_affinity

Definition at line 1 of file thread.h.

◆ current_core_id

uint16_t current_core_id

Definition at line 10 of file thread.h.

◆ entry_addr

uintptr_t entry_addr

Definition at line 9 of file thread.h.

◆ flags

uint16_t flags

Definition at line 5 of file thread.h.

◆ fs_base

uint64_t fs_base

Definition at line 16 of file thread.h.

◆ gs_base

uint64_t gs_base

Definition at line 17 of file thread.h.

◆ has_update_run_time

boolean_t has_update_run_time

Definition at line 8 of file thread.h.

◆ id

Definition at line 0 of file thread.h.

◆ in_kernel_sleep

bool in_kernel_sleep

Definition at line 24 of file thread.h.

◆ kernel_rsp

uintptr_t kernel_rsp

Definition at line 21 of file thread.h.

Referenced by __attribute__().

◆ kernel_stack_base

uintptr_t kernel_stack_base

Definition at line 22 of file thread.h.

◆ kernel_stack_top

uintptr_t kernel_stack_top

Definition at line 23 of file thread.h.

◆ last_run_time

uint64_t last_run_time

Definition at line 7 of file thread.h.

◆ page

volatile uintptr_t* page

Definition at line 2 of file thread.h.

◆ priority

uint8_t priority

Definition at line 4 of file thread.h.

◆ process

process_t* process

Definition at line 13 of file thread.h.

◆ reg

cpu_register_t reg

Definition at line 27 of file thread.h.

◆ stack

uint64_t stack

Definition at line 6 of file thread.h.

◆ state

uint8_t state

Definition at line 3 of file thread.h.

◆ uuid

uint32_t uuid

Definition at line 15 of file thread.h.

◆ wake_pending

bool wake_pending

Definition at line 25 of file thread.h.