[test] 書き込みテスト 専用スレッド 110 [テスト]
■ このスレッドは過去ログ倉庫に格納されています
トリップテストとか書き込みテストとかはこちらでどうぞ。
この板のみの機能:
名前欄にtasukeruyoでホスト(IPアドレス)とUAが表示されます。
ノtasukeruyoとするとUAだけが表示されます。
前スレ
[test] 書き込みテスト 専用スレッド 109 [テスト]
http://qb5.2ch.net/test/read.cgi/operate/1203247383/ G:四葉
B:鞠絵 E:衛 .< >J:春歌
A:亞里亞< >D:咲耶< H:雛子 >L:可憐
C:白雪 F:鈴凛< >K:花穂
I:千影 てーすてーす
Monazilla/1.00 kage/0.99.1.1195 (1000) 日本は民主主義の国です。
政治が悪いと言ってもそれはすべて国民の選択の結果です。 てすてす
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506) Picea/1.46 てs
Monazilla/1.00 (JaneStyle/2.76) 血液型は車で言えば駆動系
A型→FF
B型→FR(MRやRRも含む)
O型→4WD(FRベース)
AB型→4WD ∧ ∧
(V(┃┃)V)
ノヽノヽ =3 ブー
くく >>238
A型→各部品
B型→内外装
O型→運転手
AB型→アフターパーツ てすと
DoCoMo/2.0 P903i(c100;TB;W24H12;ser359482007265215;icc8981100000661361677F) 1.環境
CPU:AMD-K6(tm)
gcc version 4.1.2
GNU ld version 2.17 Debian GNU/Linux
ldconfig (GNU libc) 2.3.6
2.ファイル hello-asm.c
#include<unistd.h>
char message[]="Hello, world!\n";
int sys_write(int fd, const void *buf, int len){
int ret;
asm(
"int $0x80"
: "=a" (ret)
: "a" (4),
"b" (fd),
"c" (buf),
"d" (len)
);
return ret;
}
void sys_exit(int stat){
asm(
"int $0x80"
:
: "a" (1),
"b" (stat)
);
}
void main(){
sys_write(1, (void*)message, sizeof(message));
sys_exit(123);
}
3.コマンド
gcc -nostdlib -save-temps -Wl,--entry=main -Wl,-t -o hello-asm -O2 -finhibit-size-directive -fno-ident -fomit-frame-pointer -fcall-used-ebx hello-asm.c
4.生成アセンブリコード一部
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ecx
subl $4, %esp
movl $123, (%esp)
call sys_exit
popl %eax
popl %ecx
leal -4(%ecx), %esp
ret
5.正常動作アセンブリコード
main:
→ subl $16, %esp
→ pushl $15
→ pushl $message
→ pushl $1
→ call sys_write
pushl -4(%ecx)
pushl %ecx
subl $4, %esp
movl $123, (%esp)
call sys_exit
popl %eax
popl %ecx
leal -4(%ecx), %esp
ret
6.修正後コマンド
as hello-asm.s -o hello-asm.o
/usr/lib/gcc/i486-linux-gnu/4.1.2/collect2 --entry=main -o hello hello-asm.o ■ このスレッドは過去ログ倉庫に格納されています