AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
arch.h File Reference
#include <cpu/cpu.h>

Go to the source code of this file.

Data Structures

struct  x86_thread
 A thread's x86 state: its kernel stack, and where it resumes. More...

Macros

#define X86_SS   (0x20 | 3)
#define X86_EFLAGS   (0x200)
#define X86_CS   (0x18 | 3)
#define USER_STACK   (0x0000800000000000UL)
#define USER_STACK_BASE   (USER_STACK - USER_STACK_SIZE)
#define SIGCODE_ADDR   (USER_STACK_BASE - 0x1000)
#define KERN_STACK_SIZE   (16384U)

Functions

void arch_syscall (struct x86_regs *r)
 Runs a system call that user mode made: the trap handler calls it.
static void arch_interrupts_enable (void)
static void arch_interrupts_disable (void)
void x86_jump_user (uintptr_t eax, uintptr_t eip, uintptr_t cs, uintptr_t eflags, uintptr_t esp, uintptr_t ss)
void x86_goto (uintptr_t eip, uintptr_t ebp, uintptr_t esp)

Macro Definition Documentation

◆ KERN_STACK_SIZE

#define KERN_STACK_SIZE   (16384U)

Definition at line 69 of file arch.h.

◆ SIGCODE_ADDR

#define SIGCODE_ADDR   (USER_STACK_BASE - 0x1000)

Definition at line 62 of file arch.h.

◆ USER_STACK

#define USER_STACK   (0x0000800000000000UL)

Definition at line 57 of file arch.h.

◆ USER_STACK_BASE

#define USER_STACK_BASE   (USER_STACK - USER_STACK_SIZE)

Definition at line 59 of file arch.h.

◆ X86_CS

#define X86_CS   (0x18 | 3)

Definition at line 13 of file arch.h.

Referenced by arch_sigreturn(), and thread_spawn().

◆ X86_EFLAGS

#define X86_EFLAGS   (0x200)

◆ X86_SS

#define X86_SS   (0x20 | 3)

Definition at line 11 of file arch.h.

Referenced by arch_sigreturn(), and thread_spawn().

Function Documentation

◆ arch_interrupts_disable()

void arch_interrupts_disable ( void )
inlinestatic

Definition at line 77 of file arch.h.

References arch_interrupts_disable().

◆ arch_interrupts_enable()

void arch_interrupts_enable ( void )
inlinestatic

Definition at line 72 of file arch.h.

References arch_interrupts_enable().

◆ arch_syscall()

void arch_syscall ( struct x86_regs * r)

Runs a system call that user mode made: the trap handler calls it.

It returns to user mode when the call is done, delivering the signals that came meanwhile. Each architecture has its own, with its own saved registers (sys/syscall.c).

Parameters
rthe registers user mode had, saved on the kernel stack

Definition at line 22 of file syscall.c.

References arch_syscall(), curthread, x86_regs::r10, x86_regs::r8, x86_regs::rax, x86_regs::rdi, x86_regs::rdx, x86_regs::rsi, sched_urgent, syscall_dispatch(), and x86_return_to_user().

◆ x86_goto()

◆ x86_jump_user()

void x86_jump_user ( uintptr_t eax,
uintptr_t eip,
uintptr_t cs,
uintptr_t eflags,
uintptr_t esp,
uintptr_t ss )

References x86_jump_user().

Referenced by thread_spawn(), and x86_jump_user().