CPSC 355 Lecture Notes - Lecture 18: Init, In C, Base Address

77 views4 pages

Document Summary

Cpsc 355 - lecture 18 oct 24th. M4 macros can be used for offsets to improve readability: eg: define(a_s, 16) define(b_s, 20) str w20, [x29, a_s] ldr w21, [x29, b_s] Can also be done with assembler equates: eg: a_s = 16 b_s = 20 str w20, [x29, a_s] ldr w21, [x29, b_s] Register equates are useful for renaming x29 and x30 to fp and lr. req x30: eg: fp lr str w20, [fp, a_s] ldr w21, [fp, b_s] In c, can be declared in a block of code: i. e. i(cid:374) a(cid:374)t (cid:272)o(cid:374)stru(cid:272)t deli(cid:373)ited (cid:271)y { , eg: > local to if-construct int a = 5;, b = 7; int main( ){ if (a < b ) { int c; c = 10; Local variables are implemented as stack variables in assembly: those local to the function are allocated when entering the function, as already shown, those local to other block of code are:

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers