Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
thread.h File Reference
#include "autoconf.h"
#include <register.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(thread_id)
 
#define THREAD_GET_GEN(thread_id)
 

Typedefs

typedef uint64_t thread_id
 
typedef struct thread thread_t
 
typedef struct thread_bucket thread_bucket_t
 

Enumerations

enum  { THREAD_USER = (1 << 0) , THREAD_KERNEL = ~(1 << 0) , THREAD_PREEMPT_ENABLE = (1 << 1) , THREAD_PREEMPT_DISABLE = ~(1 << 1) }
 
enum  {
  THREAD_STATE_CREATE = 0 , THREAD_STATE_READY = 1 , THREAD_STATE_RUNNING = 2 , THREAD_STATE_HAL = 3 ,
  THREAD_STATE_TERMINATED = 3
}
 

Functions

struct thread __attribute__ ((aligned(64)))
 
thread_id vxCreateThread (const uintptr_t entry, uint16_t core_affinity, uint8_t priority, uint16_t flags)
 
void vxThreadExit ()
 

Variables

typedef __attribute__
 
thread_id id
 
uint16_t core_affinity
 
uint8_t state
 
uint8_t priority
 
uint16_t flags
 
uint64_t last_run_time
 
uint32_t uuid
 
boolean_t has_update_run_time
 
uint8_t _pad1 [64 - 29]
 
uintptr_t entry_addr
 
uint64_t stack
 
cpu_register_t reg
 

Macro Definition Documentation

◆ THREAD_GET_GEN

#define THREAD_GET_GEN ( thread_id)
Value:
((uint32_t) ((thread_id) >> 32))
uint64_t thread_id
Definition thread.h:12
unsigned int uint32_t
Definition type.h:19

Definition at line 62 of file thread.h.

◆ THREAD_GET_ID

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

Definition at line 61 of file thread.h.

Referenced by vxUpdateThreadSlot().

◆ 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 60 of file thread.h.

Referenced by thrAcquireNewSlot().

Typedef Documentation

◆ thread_bucket_t

◆ thread_id

Definition at line 12 of file thread.h.

◆ thread_t

typedef struct thread thread_t

Definition at line 29 of file thread.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
THREAD_STATE_CREATE 
THREAD_STATE_READY 
THREAD_STATE_RUNNING 
THREAD_STATE_HAL 
THREAD_STATE_TERMINATED 

Definition at line 21 of file thread.h.

◆ anonymous enum

anonymous enum
Enumerator
THREAD_USER 
THREAD_KERNEL 
THREAD_PREEMPT_ENABLE 
THREAD_PREEMPT_DISABLE 

Definition at line 14 of file thread.h.

Function Documentation

◆ __attribute__()

struct thread __attribute__ ( (aligned(64)) )

Definition at line 1 of file core.h.

◆ vxCreateThread()

thread_id vxCreateThread ( const uintptr_t entry,
uint16_t core_affinity,
uint8_t priority,
uint16_t flags )

References core_affinity, flags, and priority.

◆ vxThreadExit()

void vxThreadExit ( )

Variable Documentation

◆ __attribute__

struct xhci_input_ctx __attribute__

Definition at line 47 of file msi.c.

◆ _pad1

uint8_t _pad1[64 - 29]

Definition at line 9 of file thread.h.

◆ core_affinity

uint16_t core_affinity

Definition at line 2 of file thread.h.

Referenced by create_thread(), and vxCreateThread().

◆ entry_addr

uintptr_t entry_addr

Definition at line 12 of file thread.h.

Referenced by elf_prepare_stack(), and execve().

◆ flags

◆ has_update_run_time

boolean_t has_update_run_time

Definition at line 8 of file thread.h.

◆ id

Definition at line 1 of file thread.h.

Referenced by update_core_gs().

◆ last_run_time

uint64_t last_run_time

Definition at line 6 of file thread.h.

◆ priority

uint8_t priority

Definition at line 4 of file thread.h.

Referenced by create_thread(), and vxCreateThread().

◆ reg

◆ stack

◆ state

uint8_t state

Definition at line 3 of file thread.h.

◆ uuid

uint32_t uuid

Definition at line 7 of file thread.h.