Page 86 - Computer_Science_F5
P. 86

(a) Arithmetic and logical operations        privileged and non-privileged. These
                   (ADD, SUB, AND, OR): Performing          include;
                   calculations on data in registers is a   (a) Security: Prevents user programs
                   fundamental task for any program.        from causing system crashes or         Chapter One: Computer architecture

               (b) Data transfer instructions (MOV,         security breaches by restricting
          FOR ONLINE READING ONLY
                   LEA):  Moving data between               access to sensitive hardware and
                   registers and memory locations is        resources.
                   essential for program logic and data
                   manipulation.                         (b) Stability:  Ensures the operating
               (c) Register-to-register  operations         system maintains control of essential
                   (CMP,  TEST):  Comparing and             resources, promoting overall system
                   testing register values are crucial      stability.
                   for control flow and decision-making   (c) Organisation: Provides a structured
                   within programs.                         environment for program execution,
                   There are several benefits of            allowing for efficient resource
                   separating instructions into             management and multitasking.



                   Exercise 1.18

               (a) Complete the following privileged instructions (x86) given real-world kitchen
                   equivalents.

                       Table 1.17: Privileged instructions (x86) and real-world kitchen equivalents

                   Instruction    Kitchen equivalent

                                Changing the recipe book (Paging table):  This instruction
                                modifies the Control Register (CR3), which acts like the head
                                chef’s master recipe book (paging table) in our analogy. It tells
                                the CPU where to find specific data in memory, similar to how
                                the chef uses the recipe book to locate ingredient instructions.
                                Tampering  with  this could  lead  to confusion and wasted
                                resources (ingredients).

                                Checking the oven temperature (input): This instruction reads a
                                byte of data from a port specified in the DX register and stores it
                                in the AL register. Imagine the DX register as the oven number,
                                and the AL register stores the current temperature reading. This
                                is like the cook checking the oven temperature using a special
                                thermometer (privileged instruction).



                                                     77
               Student’s Book  Form Five



     Computer Science Form 5.indd   77                                                      23/07/2024   12:33
   81   82   83   84   85   86   87   88   89   90   91