The Best Programming Books of October 2015 - Jworks
で挙げられている本。
-
Cracking the Coding Interview, 6th Edition: 189 Programming Questions and Solutions
-
Python: Learn Python in One Day and Learn It Well. Python for Beginners with Hands-on Project. (Learn Coding Fast with Hands-On Project Book 1)
-
HTML and CSS: Design and Build Websites
-
Programming Arduino Getting Started with Sketches
-
Automate the Boring Stuff with Python: Practical Programming for Total Beginners
-
The C Programming Language
-
The Hacker Playbook 2: Practical Guide To Penetration Testing
-
JavaScript and JQuery: Interactive Front-End Web Development
-
Data Science from Scratch: First Principles with Python
-
Head First Java, 2nd Edition
面倒くさいので本のリンクはなし(元記事に行けばたどれます)。
K&R が入っているのがなんともという感じだけど、
つい最近出たのもあるなあ。
ちょっと前の記事なんだけどなんかアンテナ(謎)に引っかかったので
アセンブリにおけるC言語のstatic(静的)変数とauto(自動)変数の取り扱い方 - 珈琲駆動開発
アセンブリにおけるC言語のstatic(静的)変数とauto(自動)変数の取り扱い方 - 珈琲駆動開発
疑問点
$fpを2回更新する理由
16(fp)とフレームポインタ(=スタックポインタ)+ 16バイト目に突っ込んでいるのか。
これだけみるとなんのことやらになるけど
元記事本文で意図を読み取ろうとするに
アセンブリにおけるC言語のstatic(静的)変数とauto(自動)変数の取り扱い方 - 珈琲駆動開発
main:
subu $sp,$sp,64
sw $ra,60($sp)
sw $fp,56($sp)
move $fp,$sp ←
li $v0,2 # 0x2
sw $v0,_primes_stat
li $v0,3 # 0x3
sw $v0,16($fp)
la $a0,$LC3
lw $a1,_primes_stat
jal _print_var
la $a0,$LC4
lw $a1,16($fp)
jal _print_var
move $sp,$fp
lw $ra,60($sp)
lw $fp,56($sp)
addu $sp,$sp,64
j $ra
と
アセンブリにおけるC言語のstatic(静的)変数とauto(自動)変数の取り扱い方 - 珈琲駆動開発
_print_var:
subu $sp,$sp,24
sw $ra,20($sp)
sw $fp,16($sp)
move $fp,$sp ←
sw $a0,24($fp)
sw $a1,28($fp)
lw $a0,24($fp)
jal _print_string
la $a0,$LC1
jal _print_string
lw $a0,28($fp)
jal _print_int
la $a0,$LC2
jal _print_string
move $sp,$fp
lw $ra,20($sp)
lw $fp,16($sp)
addu $sp,$sp,24
j $ra
の二回。ということだろうか(元のプログラムでは mainがあと)。
であれば、呼び出されたサブルーチン(関数)の入口でやることだから。
ですよね(C の main も何処からか呼ばれる存在)。
16 の方はMIPSの事情をよく知らんけど
Calling convention - Wikipedia, the free encyclopedia
MIPS
The most commonly used[5] calling convention for 32 bit MIPS is the O32[6] ABI which passes the first four
arguments to a function in the registers $a0-$a3; subsequent arguments are passed on the stack. Space on
the stack is reserved for $a0-$a3 in case the callee needs to save its arguments, but the registers are
not stored there by the caller.
これとか、
The rules for MIPS call convention
の図にある
space for arguments for called functions (if any)
領域分が16バイトじゃなかろうかと。
後者だと $gp がどうなってるのかわからんけど。
熱血! アセンブラ入門
あれ、書影が?