miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
syscall_proc.c File Reference
#include <miniOS/syscall.h>
#include <miniOS/sched/sched.h>
#include <miniOS/fs/vfs.h>
#include <miniOS/fs/elf.h>
#include <miniOS/mm/heap.h>
#include <miniOS/mm/vmm.h>
#include <miniOS/mm/pmm.h>
#include <miniOS/io.h>
#include <miniOS/signal.h>
#include <miniOS/arch/x86_64/smp.h>
#include <miniOS/arch/x86_64/segment.h>
#include <miniOS/net/lwip_netif.h>
#include <miniOS/types.h>
#include <string.h>
#include <stdint.h>
#include "syscall_internal.h"
Include dependency graph for syscall_proc.c:

Classes

struct  miniOS_user_regs_struct

Macros

#define MINI_OS_DEBUG_SYSCALL_PROC   0
#define SYSCALL_PROC_DEBUG_PRINT(...)
#define PTRACE_TRACEME   0
#define PTRACE_PEEKTEXT   1
#define PTRACE_PEEKDATA   2
#define PTRACE_POKETEXT   4
#define PTRACE_POKEDATA   5
#define PTRACE_CONT   7
#define PTRACE_KILL   8
#define PTRACE_SINGLESTEP   9
#define PTRACE_GETREGS   12
#define PTRACE_SETREGS   13
#define PTRACE_SYSCALL   24
#define EXEC_MAX_ARGS   64
#define EXEC_MAX_ENVS   128
#define EXEC_MAX_STRSZ   (32 * 1024)

Functions

static uint64_t proc_rdtsc (void)
static int wait_status_encode_exit (int exit_code)
static int wait_status_encode_stop (int stop_signal)
static int ptrace_copy_from_tracee (struct thread *target, uint64_t va, void *kbuf, size_t len)
static int ptrace_ensure_writable (struct thread *target, uint64_t page_va)
static int ptrace_copy_to_tracee (struct thread *target, uint64_t va, const void *kbuf, size_t len)
static void ptrace_set_tf (struct thread *target, int on)
static struct threadptrace_find_target (uint32_t tracer_tid, uint32_t pid)
int64_t syscall_dispatch_proc (uint64_t nr, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)

Variables

uint64_t miniOS_tsc_hz

Macro Definition Documentation

◆ EXEC_MAX_ARGS

#define EXEC_MAX_ARGS   64

◆ EXEC_MAX_ENVS

#define EXEC_MAX_ENVS   128

◆ EXEC_MAX_STRSZ

#define EXEC_MAX_STRSZ   (32 * 1024)

◆ MINI_OS_DEBUG_SYSCALL_PROC

#define MINI_OS_DEBUG_SYSCALL_PROC   0

◆ PTRACE_CONT

#define PTRACE_CONT   7

◆ PTRACE_GETREGS

#define PTRACE_GETREGS   12

◆ PTRACE_KILL

#define PTRACE_KILL   8

◆ PTRACE_PEEKDATA

#define PTRACE_PEEKDATA   2

◆ PTRACE_PEEKTEXT

#define PTRACE_PEEKTEXT   1

◆ PTRACE_POKEDATA

#define PTRACE_POKEDATA   5

◆ PTRACE_POKETEXT

#define PTRACE_POKETEXT   4

◆ PTRACE_SETREGS

#define PTRACE_SETREGS   13

◆ PTRACE_SINGLESTEP

#define PTRACE_SINGLESTEP   9

◆ PTRACE_SYSCALL

#define PTRACE_SYSCALL   24

◆ PTRACE_TRACEME

#define PTRACE_TRACEME   0

◆ SYSCALL_PROC_DEBUG_PRINT

#define SYSCALL_PROC_DEBUG_PRINT ( ...)
Value:
do { } while (0)

Function Documentation

◆ proc_rdtsc()

uint64_t proc_rdtsc ( void )
inlinestatic
Here is the caller graph for this function:

◆ ptrace_copy_from_tracee()

int ptrace_copy_from_tracee ( struct thread * target,
uint64_t va,
void * kbuf,
size_t len )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ptrace_copy_to_tracee()

int ptrace_copy_to_tracee ( struct thread * target,
uint64_t va,
const void * kbuf,
size_t len )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ptrace_ensure_writable()

int ptrace_ensure_writable ( struct thread * target,
uint64_t page_va )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ptrace_find_target()

struct thread * ptrace_find_target ( uint32_t tracer_tid,
uint32_t pid )
static
Here is the caller graph for this function:

◆ ptrace_set_tf()

void ptrace_set_tf ( struct thread * target,
int on )
static
Here is the caller graph for this function:

◆ syscall_dispatch_proc()

int64_t syscall_dispatch_proc ( uint64_t nr,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
uint64_t arg4,
uint64_t arg5,
uint64_t arg6 )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait_status_encode_exit()

int wait_status_encode_exit ( int exit_code)
inlinestatic
Here is the caller graph for this function:

◆ wait_status_encode_stop()

int wait_status_encode_stop ( int stop_signal)
inlinestatic
Here is the caller graph for this function:

Variable Documentation

◆ miniOS_tsc_hz

uint64_t miniOS_tsc_hz
extern