The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
user_space.h File Reference
#include "common/stdint.h"
#include "kernel/memory/vma.h"
#include "kernel/sync/mutex.h"
#include "kernel/cpu/cpu.h"
#include "arch/arch.h"

Go to the source code of this file.

Data Structures

struct  user_space
 the user half of an address space: the page tables, the areas (vma.h) and the program break. More...

Typedefs

typedef struct user_space user_space_t
 the user half of an address space: the page tables, the areas (vma.h) and the program break.

Functions

user_space_t * user_space_create (void)
 make an empty user space with one user.
user_space_t * user_space_get (user_space_t *space)
 add a user to a space (a new thread that shares it).
void user_space_put (user_space_t *space)
 remove a user from a space.
void user_space_activate (user_space_t *space)
 load the page tables of a space on the core that runs the call, and keep the cpu_mask of the old and the new space right: a TLB shootdown goes to the cores in the mask.
bool user_space_on_cpu (const user_space_t *space, uint32_t core)
 true if the core has the space loaded now.

Typedef Documentation

◆ user_space_t

typedef struct user_space user_space_t

the user half of an address space: the page tables, the areas (vma.h) and the program break.

the threads of a process use one user space together; it is freed when the last of them lets it go.

Function Documentation

◆ user_space_create()

user_space_t * user_space_create ( void )

make an empty user space with one user.

Returns
the space, or NULL if there is no memory.

◆ user_space_get()

user_space_t * user_space_get ( user_space_t * space)

add a user to a space (a new thread that shares it).

Parameters
spacethe space.
Returns
space.

◆ user_space_put()

void user_space_put ( user_space_t * space)

remove a user from a space.

the last user frees it: its pages, its page tables and the object. a process that lets go of its own space must load other page tables first (user_space_activate), because a thread on another core can free the space at once.

Parameters
spacethe space, or NULL (nothing is done).

◆ user_space_activate()

void user_space_activate ( user_space_t * space)

load the page tables of a space on the core that runs the call, and keep the cpu_mask of the old and the new space right: a TLB shootdown goes to the cores in the mask.

every change of address space goes through here. call it with interrupts off.

Parameters
spacethe space, or NULL for the kernel's page tables.

◆ user_space_on_cpu()

bool user_space_on_cpu ( const user_space_t * space,
uint32_t core )

true if the core has the space loaded now.

Parameters
spacethe space.
corethe index of the core.