I'm trying to learn MIPS assembly, but I'm a bit confused about an example of MIPS assembly I have found.
#Socket Domain - AF_INET (2)
li $t4, 0xFFFFFFFD #-3
not $a0, $t4
#Socket Type - SOCK_STREAM (2 for mips)
not $a1, $t4
#Socket Protocol - 0
slti $a2, $zero, 0xFFFF
#Call socket
li $v0, 4183
syscall 0x42424
For the socket() syscall, there are 3 arguments. The first argument being AF_INET or 2, why does the example above not just use li $a0, 2
instead of:
li $t4, 0xFFFFFFFD #-3
not $a0, $t4
The line below is also used, what is the purpose of this with regards to the socket called?
slti $a2, $zero, 0xFFFF
Is this just the way the assembly has been 'optomized' by GCC? Or is their a reason?
User contributions licensed under CC BY-SA 3.0