[−][src]Struct sunrise_kernel::process::thread_local_storage::TLSPage
Manages a page containing 8 TLS
A TLS being only 0x200 bytes, the kernel aggregates the TLSs of a same process in groups of 8 so that they fit in one page.
Memory leak
Dropping this struct will leak the page, until the process is killed and all its memory is freed. See TLSManager for more on this topic.
Fields
page_address: VirtualAddress
Address of the page, in UserLand.
usage: [u8; 1]
Bitmap indicating if the TLS is in use (1
) or free (0
).
Implementations
impl TLSPage
[src]
fn new(pmemory: &mut ProcessMemory) -> Result<Self, KernelError>
[src]
Allocates a new page holing 8 TLS.
The page is user read-write, and its memory type is ThreadLocal
.
Error
Fails if the allocation fails.
fn allocate_tls(&mut self) -> Option<VirtualAddress>
[src]
Finds an available slot in the TLSPage, bzero it, marks it allocated, and gives back a pointer to it.
If no slot was available, this function returns None
.
The returned TLS still has to be bzeroed, has it may contain the data of a previous thread.
fn free_tls(&mut self, address: VirtualAddress)
[src]
Marks a TLS in this TLSPage as free so it can be used by the next spawned thread.
Panics
Panics if address
does not fall in this TLSPage, not a valid offset, or marked already free.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TLSPage
impl Send for TLSPage
impl Sync for TLSPage
impl Unpin for TLSPage
impl UnwindSafe for TLSPage
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,