MIPS编程之系统调用,syscell指令,system call table

系统调用:

  1. 实现终端的输入输出,以及声明程序结束。
  2. 参数所使用的寄存器:$v0, $a0, $a1
  3. 返回值使用: $v0
  4. Service中的数据类型使用可参考:MIPS汇编语言学习笔记03:print HelloWorld 文章最下面的pdf文档。

Table: System services.

Service System Call Code in v0(中断调用号) Arguments(参数) Result(返回值)
print_int 1 $a0 = integer
print_float 2 $f12 = float
print_double 3 $f12 = double
print_string 4 $a0 = string
read_int 5 integer (in $v0)
read_float 6 float (in $f0)
read_double 7 double (in $f0)
read_string 8 $a0 = buffer, $a1 = length
sbrk 9 $a0 = amount address (in $v0)
exit 10
print_character 11 $a0 = character
read_character 12 character (in $v0)
open 13 $a0 = filename, file descriptor (in $v0)
$a1 = flags, $a2 = mode
read 14 $a0 = file descriptor, bytes read (in $v0)
$a1 = buffer, $a2 = count
write 15 $a0 = file descriptor, bytes written (in $v0)
$a1 = buffer, $a2 = count
close 16 $a0 = file descriptor 0 (in $v0)
exit2 17 $a0 = value

 

视频讲解:


参考文章:

https://www.doc.ic.ac.uk/lab/secondyear/spim/node8.html

https://www.cnblogs.com/thoupin/p/4018455.html

 

作者: 高志远

高志远,24岁,男生

《MIPS编程之系统调用,syscell指令,system call table》有一条评论

珑鸢喃进行回复 取消回复

邮箱地址不会被公开。