Skip to content

Instantly share code, notes, and snippets.

@7shi
Created March 25, 2010 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 7shi/343302 to your computer and use it in GitHub Desktop.
Save 7shi/343302 to your computer and use it in GitHub Desktop.
mipsel-peのテスト
# cat hello.c
void start()
{
MessageBoxA(0, "Hello, NT4/MIPS!", "mipsel-pe-gcc", 0);
}
# mips-pe-gcc -G0 -EL -S hello.c
# cat hello.s
.file 1 "hello.c"
gcc2_compiled.:
__gnu_compiled_c:
.rdata
.align 2
$LC0:
.ascii "Hello, NT4/MIPS!\000"
.align 2
$LC1:
.ascii "mipsel-pe-gcc\000"
.text
.align 2
.globl start
.ent start
start:
.frame $fp,24,$31 # vars= 0, regs= 2/0, args= 16, extra= 0
.mask 0xc0000000,-4
.fmask 0x00000000,0
subu $sp,$sp,24
sw $31,20($sp)
sw $fp,16($sp)
move $fp,$sp
move $4,$0
la $5,$LC0
la $6,$LC1
move $7,$0
jal MessageBoxA
move $sp,$fp
lw $31,20($sp)
lw $fp,16($sp)
addu $sp,$sp,24
j $31
.end start
# mips-pe-gcc -G0 -EL -nostdlib -e start hello.c user32.lib
# mips-pe-objdump -d a.exe
a.exe: file format pei-mips
Disassembly of section .text:
00010400 <__bss_end__>:
10400: 27bdffe8 addiu $sp,$sp,-24
10404: afbf0014 sw $ra,20($sp)
10408: afbe0010 sw $s8,16($sp)
1040c: 03a0f021 move $s8,$sp
10410: 00002021 move $a0,$zero
10414: 3c050001 lui $a1,0x1
10418: 24a50800 addiu $a1,$a1,2048
1041c: 3c060001 lui $a2,0x1
10420: 24c60814 addiu $a2,$a2,2068
10424: 0c004110 jal 10440 <MessageBoxA>
10428: 00003821 move $a3,$zero
1042c: 03c0e821 move $sp,$s8
10430: 8fbf0014 lw $ra,20($sp)
10434: 8fbe0010 lw $s8,16($sp)
10438: 03e00008 jr $ra
1043c: 27bd0018 addiu $sp,$sp,24
00010440 <MessageBoxA>:
10440: 3c080441 lui $t0,0x441
10444: 8d080c44 lw $t0,3140($t0)
10448: 01000008 jr $t0
1044c: 00000000 nop
00010450 <__CTOR_LIST__>:
10450: ffffffff sd $ra,-1($ra)
10454: 00000000 nop
00010458 <__DTOR_LIST__>:
10458: ffffffff sd $ra,-1($ra)
1045c: 00000000 nop
00010460 <etext>:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment