・何もしないプログラム 前回、説明したプログラムは、結局何もしないプログラムで これが「ひな型」=見本にしたいと思います。 test.c ==========ファイルの先頭========== #include <stdio.h> ;stdio.hファイルをインクルード main(){} ;メイン:何もしない;終わり ==========ファイルの最後========== ファイル名: test.s ==========ファイルの先頭========== .file "test.c" ;test.cから派生 .text ;テクスト;鵜呑み(特に理解するものでもない) .globl main ;メイン .type main, @function ;タイプ(鵜呑み) main: ;メインの始まり pushl %ebp ;pushとpop;ebpはいじられたくないようだ movl %esp, %ebp ;espの値がedpになる;実行アドレスの置き換えだ popl %ebp ;edpの値を以前に戻す ret ;リターン;終わり .size main, .-main ;以下は落書きに相当する .ident "GCC: (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2" .section .note.GNU-stack,"",@progbits ==========ファイルの最後========== また、ARMでは、 ファイル名: test.s(ARM) ==========ファイルの先頭========== .syntax unified .arch armv7-a .eabi_attribute 27, 3 .fpu vfpv3-d16 .eabi_attribute 20, 1 ;何やってるか分からんが下準備か .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 2 .eabi_attribute 30, 6 .eabi_attribute 18, 4 .thumb .file "test.c" .text .align 2 .global main .thumb .thumb_func .type main, %function ;メイン main: @ args = 0, pretend = 0, frame = 0 ;前置き @ frame_needed = 1, uses_anonymous_args = 0 @ link register save eliminated. push {r7} ;r7を退避 add r7, sp, #0 ;r7←sp+0か? mov r0, r3 ;r0←r3か mov sp, r7 ;sp←r7か pop {r7} ;r7を戻す bx lr ;なんかやらかしたぞ .size main, .-main ;このへんはどうでもいい .ident "GCC: (Ubuntu/Linaro 4.5.2-8ubuntu3) 4.5.2" .section .note.GNU-stack,"",%progbits ==========ファイルの最後==========