FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
userland.h File Reference

The Header file for userland/userspace. More...

#include <basics.h>
#include <syscalls.h>
Include dependency graph for userland.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  glibc_128bits_t
union  glibc_dtv_t
struct  glibc_tcb_head_t
struct  glibc_tls_block_t
struct  auxv_pair_t

Macros

#define USER_STACK_SIZE   (16 * 1024)
#define USER_HEAP_SIZE   (1 * 1024 * 1024)
#define USER_MMAP_SIZE   (4 * 1024 * 1024)
#define USER_CODE_VADDR   0x0000400000000000ULL
#define USER_HEAP_VADDR   0x0000400010000000ULL
#define USER_MMAP_VADDR   (USER_HEAP_VADDR + USER_HEAP_SIZE)
#define USER_TLS_VADDR   (USER_MMAP_VADDR + USER_MMAP_SIZE)
#define USER_TLS_REGION_SIZE   (16 * 1024)
#define USER_PHDR_VADDR   (USER_TLS_VADDR + USER_TLS_REGION_SIZE)
#define USER_STACK_TOP   0x00007FFFFFFFF000ULL
#define LINUX_AT_NULL   0
#define LINUX_AT_PHDR   3
#define LINUX_AT_PHENT   4
#define LINUX_AT_PHNUM   5
#define LINUX_AT_PAGESZ   6
#define LINUX_AT_BASE   7
#define LINUX_AT_FLAGS   8
#define LINUX_AT_ENTRY   9
#define LINUX_AT_UID   11
#define LINUX_AT_EUID   12
#define LINUX_AT_GID   13
#define LINUX_AT_EGID   14
#define LINUX_AT_PLATFORM   15
#define LINUX_AT_HWCAP   16
#define LINUX_AT_HWCAP2   26
#define LINUX_AT_CLKTCK   17
#define LINUX_AT_SECURE   23
#define LINUX_AT_RANDOM   25
#define LINUX_AT_EXECFN   31
#define IA32_FS_BASE_MSR   0xC0000100
#define USER_AUXV_MAX   18

Functions

void enter_userland_at (uint64_t entry_point)
int userland_exec (const char *path, int argc, const char *const *argv, const char *const *envp)
void userland_heap_init (void)
uint64_t userland_brk (uint64_t requested_break)
uint64_t userland_mmap_anon (uint64_t length)
bool userland_prepare_exit (syscall_frame_t *frame, uint64_t exit_code)
bool userland_is_running (void)
void userland_abort_from_exception (uint64_t int_no, uint64_t err_code, uint64_t fault_rip) __attribute__((noreturn))
void sh_exec (void)

Detailed Description

The Header file for userland/userspace.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2025-10-03

Definition in file userland.h.

Macro Definition Documentation

◆ IA32_FS_BASE_MSR

#define IA32_FS_BASE_MSR   0xC0000100

Definition at line 48 of file userland.h.

◆ LINUX_AT_BASE

#define LINUX_AT_BASE   7

Definition at line 34 of file userland.h.

◆ LINUX_AT_CLKTCK

#define LINUX_AT_CLKTCK   17

Definition at line 44 of file userland.h.

◆ LINUX_AT_EGID

#define LINUX_AT_EGID   14

Definition at line 40 of file userland.h.

◆ LINUX_AT_ENTRY

#define LINUX_AT_ENTRY   9

Definition at line 36 of file userland.h.

◆ LINUX_AT_EUID

#define LINUX_AT_EUID   12

Definition at line 38 of file userland.h.

◆ LINUX_AT_EXECFN

#define LINUX_AT_EXECFN   31

Definition at line 47 of file userland.h.

◆ LINUX_AT_FLAGS

#define LINUX_AT_FLAGS   8

Definition at line 35 of file userland.h.

◆ LINUX_AT_GID

#define LINUX_AT_GID   13

Definition at line 39 of file userland.h.

◆ LINUX_AT_HWCAP

#define LINUX_AT_HWCAP   16

Definition at line 42 of file userland.h.

◆ LINUX_AT_HWCAP2

#define LINUX_AT_HWCAP2   26

Definition at line 43 of file userland.h.

◆ LINUX_AT_NULL

#define LINUX_AT_NULL   0

Definition at line 29 of file userland.h.

◆ LINUX_AT_PAGESZ

#define LINUX_AT_PAGESZ   6

Definition at line 33 of file userland.h.

◆ LINUX_AT_PHDR

#define LINUX_AT_PHDR   3

Definition at line 30 of file userland.h.

◆ LINUX_AT_PHENT

#define LINUX_AT_PHENT   4

Definition at line 31 of file userland.h.

◆ LINUX_AT_PHNUM

#define LINUX_AT_PHNUM   5

Definition at line 32 of file userland.h.

◆ LINUX_AT_PLATFORM

#define LINUX_AT_PLATFORM   15

Definition at line 41 of file userland.h.

◆ LINUX_AT_RANDOM

#define LINUX_AT_RANDOM   25

Definition at line 46 of file userland.h.

◆ LINUX_AT_SECURE

#define LINUX_AT_SECURE   23

Definition at line 45 of file userland.h.

◆ LINUX_AT_UID

#define LINUX_AT_UID   11

Definition at line 37 of file userland.h.

◆ USER_AUXV_MAX

#define USER_AUXV_MAX   18

Definition at line 49 of file userland.h.

◆ USER_CODE_VADDR

#define USER_CODE_VADDR   0x0000400000000000ULL

Definition at line 21 of file userland.h.

◆ USER_HEAP_SIZE

#define USER_HEAP_SIZE   (1 * 1024 * 1024)

Definition at line 18 of file userland.h.

◆ USER_HEAP_VADDR

#define USER_HEAP_VADDR   0x0000400010000000ULL

Definition at line 22 of file userland.h.

◆ USER_MMAP_SIZE

#define USER_MMAP_SIZE   (4 * 1024 * 1024)

Definition at line 19 of file userland.h.

◆ USER_MMAP_VADDR

#define USER_MMAP_VADDR   (USER_HEAP_VADDR + USER_HEAP_SIZE)

Definition at line 23 of file userland.h.

◆ USER_PHDR_VADDR

#define USER_PHDR_VADDR   (USER_TLS_VADDR + USER_TLS_REGION_SIZE)

Definition at line 26 of file userland.h.

◆ USER_STACK_SIZE

#define USER_STACK_SIZE   (16 * 1024)

Definition at line 17 of file userland.h.

◆ USER_STACK_TOP

#define USER_STACK_TOP   0x00007FFFFFFFF000ULL

Definition at line 27 of file userland.h.

◆ USER_TLS_REGION_SIZE

#define USER_TLS_REGION_SIZE   (16 * 1024)

Definition at line 25 of file userland.h.

◆ USER_TLS_VADDR

#define USER_TLS_VADDR   (USER_MMAP_VADDR + USER_MMAP_SIZE)

Definition at line 24 of file userland.h.