xv6-simplified 0.1
简化版xv6
Loading...
Searching...
No Matches
Functions
syscall.c File Reference

系统调用相关处理函数,包括系统调用、参数获取等 More...

#include "include/types.h"
#include "include/riscv.h"
#include "include/param.h"
#include "include/proc.h"
#include "include/defs.h"
#include "include/syscall.h"
Include dependency graph for syscall.c:

Functions

int fetchaddr (uint64 addr, uint64 *ip)
 从当前进程获取位于addr的64位整数(即地址)
 
int fetchstr (uint64 addr, char *buf, int max)
 从当前进程获取位于addr的以'\0'结尾的字符串
 
void argint (int n, int *ip)
 获取int类型的系统调用参数
 
void argaddr (int n, uint64 *ip)
 获取一个指针参数(不检查其合法性,后续过程中会检查)
 
int argstr (int n, char *buf, int max)
 获取一个str类型的'\0'结尾的系统调用参数,
 
uint64 sys_exec (void)
 exec系统调用,携带trapframe中的参数执行参数中的文件
 
uint64 sys_write (void)
 write系统调用
 
void syscall (void)
 系统调用
 

Detailed Description

系统调用相关处理函数,包括系统调用、参数获取等

Date
23.05.01
Author
xin
Version
0.1 @status Stable

Function Documentation

◆ argaddr()

void argaddr ( int  n,
uint64 ip 
)

获取一个指针参数(不检查其合法性,后续过程中会检查)

Parameters
n第n个参数
ip存放指针的指针
Here is the caller graph for this function:

◆ argint()

void argint ( int  n,
int *  ip 
)

获取int类型的系统调用参数

Parameters
n第n个参数
ip存放参数的指针
Here is the caller graph for this function:

◆ argstr()

int argstr ( int  n,
char *  buf,
int  max 
)

获取一个str类型的'\0'结尾的系统调用参数,

Parameters
n第n个参数
buf存放参数的指针
max字符串最大长度
Returns
获取的字符串参数长度,若出现错误则返回-1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetchaddr()

int fetchaddr ( uint64  addr,
uint64 ip 
)

从当前进程获取位于addr的64位整数(即地址)

Parameters
addr要获取的64位整数的地址
ip存放64位整数的指针
Returns
0:成功 1:失败
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetchstr()

int fetchstr ( uint64  addr,
char *  buf,
int  max 
)

从当前进程获取位于addr的以'\0'结尾的字符串

Parameters
addr要获取的字符串地址
buf存放字符串的指针
max获取的字符串最大长度
Returns
获取的字符串长度,若出现错误返回-1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sys_exec()

uint64 sys_exec ( void  )

exec系统调用,携带trapframe中的参数执行参数中的文件

Returns
返回exec返回的参数个数,若出现错误返回-1
Here is the call graph for this function:

◆ sys_write()

uint64 sys_write ( void  )

write系统调用

Returns
写入文件字节数,若失败返回-1
Here is the call graph for this function:

◆ syscall()

void syscall ( void  )

系统调用

Here is the call graph for this function:
Here is the caller graph for this function: