본문 바로가기
csapp

3.6 Control

by 정구지개발자 2023. 4. 10.
728x90

3.6.1 Condition Codes

  • the CPU maintains a set of single-bit condition code registers describing attributes of the most recent arithmetic or logical oper- ation.

3.6.2 Accessing the Condition Codes

  • Rather than reading the condition codes directly, there are three common ways of using the condition codes:
  • (1) we can set a single byte to 0 or 1 depending on some combination of the condition codes
  • (2) we can conditionally jump to some other part of the program
  • (3) we can conditionally transfer data
  • It is important to recognize that the suffixes for these instructions denote different conditions and not different operand sizes. For example, instructions setl and setb denote “set less” and “set below,” not “set long word” or “set byte.”

  • It is important to note how machine code does or does not distinguish be- tween signed and unsigned values. Unlike in C, it does not associate a data type with each program value.

3.6.3 Jump Instructions

  • These jump destinations are generally indicated in assembly code by a label

 

  • It can be either a direct jump, where the jump target is encoded as part of the instruction, or an indirect jump, where the jump target is read from a register or a memory location

3.6.4 Jump Instruction Encodings

728x90

'csapp' 카테고리의 다른 글

3.6.7 Loops  (0) 2023.04.14
3.6.5 Implementing Conditional Branches with Conditional Control  (0) 2023.04.13
3.5 Arithmetic and Logical Operations  (0) 2023.04.10
3.4.2 Data Movement Instructions  (0) 2023.04.08
3.2.3 Notes on Formatting  (0) 2023.04.07

댓글