Difference between revisions of "CSC231 Final Exam 2010"

From dftwiki3
Jump to: navigation, search
Line 62: Line 62:
  
 
==Part 2==
 
==Part 2==
Add a fourth function to your program that will display all the registers in hex and decimal.
+
Add a fourth function called '''printRegs''' to your program that will display all the registers in hex and decimal, both in signed and unsigned format.
 +
 
 +
Here is an example of the call and its output:
 +
 
 +
call printRegs
 +
 
 +
eax: 00000000 0       0
 +
ebx: 00001000 4096    4096
 +
ecx: 0fabbcde 262913246 262913246
 +
ecx: 0000fffe 65534  65534
 +
esi: 00001132 4402    4402
 +
edi: ffffffff 4294967295 -1
 +
ebp: 0ffd1100 268243200  268243200
 +
esp: 0ffd1100 268243200 268243200
 +
 
 +
Your function should display the value the registers hold before the call is made to printRegs.  Your function should return to the calling program without having changed the value of any of the registers.
 +
 
 +
==Part 3==
 +
 
 +
Add a new feature to the '''printRegs''' function so that it displays the flag bits.
 +
 
 +
The flag bits are located at specific positions in the flags register:
 +
The EFLAGS register
 +
 
 +
Taken from http://www.eecg.toronto.edu/~amza/www.mindsec.com/files/x86regs.html: ''The EFLAGS register hold the state of the processor. It is modified by many intructions and is used for comparing some parameters, conditional loops and conditionnal jumps. Each bit holds the state of specific parameter of the last instruction. Here is a listing :
 +
 
 +
Bit  Label    Desciption
 +
---------------------------
 +
0      CF      Carry flag
 +
2      PF      Parity flag
 +
4      AF      Auxiliary carry flag
 +
6      ZF      Zero flag
 +
7      SF      Sign flag
 +
8      TF      Trap flag
 +
9      IF      Interrupt enable flag
 +
10    DF      Direction flag
 +
11    OF      Overflow flag
 +
12-13  IOPL    I/O Priviledge level
 +
14    NT      Nested task flag
 +
16    RF      Resume flag
 +
17    VM      Virtual 8086 mode flag
 +
18    AC      Alignment check flag (486+)
 +
19    VIF    Virutal interrupt flag
 +
20    VIP    Virtual interrupt pending flag
 +
21    ID      ID flag
 +
 
 +
Those that are not listed are reserved by Intel.''
  
  
  
 
</onlydft>
 
</onlydft>

Revision as of 11:21, 12 December 2010

This final exam is take-home. It is open-books, open-notes, and open-Web. It is due a week after it is made available, at 4:00 p.m. on TBA.

You cannot discuss the details of this exam with anyone except your instructor. The TAs are not allowed to help you out in any way. No question will be answered in person after 12:00 a.m. on 12/13/10. Instead, if you have questions regarding the exam, send them via email to thiebaut@cs.smith.edu, and the question and its answer will be broadcast back to the hole class via email. The exam is given under the rules of the Smith College Honor Code.

Make sure you reference all work/resources you use in your documentation.


...