assembly - ASM_Control_flow - Part I

KSATs: K0218, K0232, K0233, K0236, K0237, K0238, K0239, K0252, K0253, K0254, K0255, K0774, K0775, K0794, K0795, K0796, K0797, K0798, K0799, K0800, K0801, K0802, K0811, K0812, K0813, K0815, S0117, S0118, S0119, S0121, S0123, S0125, S0128, S0129, S0134, S0138, S0177

Measurement: Written, Performance

Lecture Time: 15 Minutes

Demo/Performance Time: 45 Minutes

Instructional Methods: Informal Lecture & Demonstration/Performance

Multiple Instructor Requirements: 1:8 for Labs

Classification: UNCLASSIFIED

Lesson Objectives:

  • LO 1 Understand and utilize flags in Assembly to solve relevant problems. (Proficiency Level: B)

    • MSB 1.1 Set flags via arithmetic and manually in Assembly. (Proficiency Level: B)
  • LO 2 Understand and utilize flags in Assembly to solve relevant problems. (Proficiency Level: B)

    • MSB 2.1 Set flags via arithmetic and manually in Assembly. (Proficiency Level: B)
  • LO 3 Identify, differentiate, and leverage string functions in Assembly. (Proficiency Level: B)

    • MSB 3.1 Understand the purpose of the scas instruction. (Proficiency Level: B)
    • MSB 3.2 Understand the purpose of the stos instruction. (Proficiency Level: B)
    • MSB 3.3 Understand the purpose of the lods instruction. (Proficiency Level: B)
    • MSB 3.4 Understand the purpose of the movs instruction. (Proficiency Level: B)
    • MSB 3.5 Understand the purpose of the cmps instruction. (Proficiency Level: B)
  • LO 4 Differentiate and implement conditional and unconditional control flow in Assembly. (Proficiency Level: B)

    • MSB 4.1 Understand the purpose of the cmp instruction. (Proficiency Level: B)
    • MSB 4.2 Understand the purpose of the test instruction. (Proficiency Level: B)
    • MSB 4.3 Understand the purpose of the jcc and other conditional jump instructions. (Proficiency Level: B)
    • MSB 4.4 Understand the purpose of the loop instruction. (Proficiency Level: B)
    • MSB 4.5 Understand the purpose of the cmp instruction. (Proficiency Level: B)
  • LO 5 Differentiate function call syntaxes and accompanying registers across OSes and architectures (Proficiency Level: B)

    • MSB 5.1 Differentiate register use by architecture and OS (Proficiency Level: B)
    • MSB 5.2 Identify the function and use of name mangling by OS (Proficiency Level: B)

Performance Objectives (Proficiency Level: 3c)

  • Conditions: Given access to (references, tools, etc.):

    • Access to specified remote virtual environment
    • Student Guide and Lab Guide
    • Student Notes
  • Performance/Behavior Tasks:

    • Utilize common string instructions in Assembly.
    • Leverage conditional branching to solve problems in Assembly.
    • In Assembly, access predefined external utility functions.
    • In Assembly, use name mangling to create implement functions.
  • Standard(s)

    • Criteria: Demonstration: Correctable to 100% in class
    • Evaluation: Students will have 4 hours to complete the timed evaluation consisting of both cognitive and performance components.
    • Minimum passing score is 80%

References

  1. http://www.c-jump.com/CIS77/ASM/Instructions/I77_0070_eflags_bits.htm
  2. https://compas.cs.stonybrook.edu/~nhonarmand/courses/sp17/cse506/ref/assembly.html
  3. https://datacadamia.com/computer/cpu/register/eflags
  4. https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64/
  5. https://en.wikibooks.org/wiki/X86_Assembly/Control_Flow
  6. https://en.wikipedia.org/wiki/FLAGS_register
  7. https://en.wikipedia.org/wiki/X86_calling_conventions
  8. https://nasm.us/doc/nasmdoc3.html
  9. https://revers.engineering/applied-re-accelerated-assembly-p1/
  10. https://security.stackexchange.com/questions/129499/what-does-eip-stand-for
  11. https://wiki.osdev.org/X86-64_Instruction_Encoding#Legacy_Prefixes
  12. https://wiki.skullsecurity.org/index.php?title=Registers#eip
  13. https://www.amd.com/system/files/TechDocs/24594.pdf
  14. https://www.felixcloutier.com/x86/scas:scasb:scasw:scasd
  15. https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-1-manual.pdf
  16. https://www.quora.com/What-is-POPF-I-can-understand-PUSHF-cause-it-simply-push-flags-but-what-is-POPF-How-does-computer-know-what-is-flag-to-pop-1
  17. https://www.tutorialspoint.com/assembly_programming/assembly_registers.htm
  18. https://www.tutorialspoint.com/assembly_programming/assembly_scas_instruction.htm