summaryrefslogtreecommitdiff
path: root/lib/libc/internal/arch/x86_64/tcb.c
blob: 6e1f0c159305f52aef53d16469acae7e9ae608ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <libc/tcb.h>

__attribute__((__always_inline__)) void __libc_tcb_set(uint64_t tcb)
{
	__asm__ volatile("wrfsbase %0" ::"r"(tcb));
}

__attribute__((__always_inline__)) void *__libc_tcb_get(void)
{
	void *tcb;
	__asm__ volatile("rdfsbase %0" : "=r"(tcb));
	return tcb;
}