CSE3101 Fall 2005 Exam #3, open book, open notes. Name ___________________ 1. What is the difference between real, protected, and virtual 8088 mode with regard to operating system support, application support, available memory, instruction set, and the role of segment registers? (25 pts). ANSWER: Real mode: runs 16-bit single tacking operating system and applications (e.g. DOS or BASIC). 1 MB available memory. Instruction set operands default to 16 bits. Segment registers contain the high 16 bits of a 20 bit segment base. There is no memory protection. Protected mode: runs 32-bit multitasking operating systems (e.g. Windows or Linux) and 32-bit applications. 4 GB memory. Instruction operands default to 32 bits. Segment registers point to a descriptor (not accessible to the application) containing a segment base, limit, and permissions. Virtual 8086 mode: allow real-mode applications to run as a task under a 32-bit operating system. The application has 1 MB memory and uses 16 bit instructions. Segment registers are emulated to appear to work as in real mode. 2. The following code multiplies 4 doubles. Write a faster version that exploits parallelism in the FPU (not using SSE/SSE2) (15 pts). ; result = a*b*c*d; fld a fmul b fmul c fmul d fstp result ; ANSWER: result = (a*b) * (c*d); computing a*b in parallel with c*d fld a fmul b fld c fmul d ; overlaps with fmul b fmul fstp result 3. Write a function to compute the vector product of n unsigned bytes, using MMX, equivalent to the code below. You may assume n is a positive multiple of 8 less than 2^15 (60 pts). int dot(unsigned char *a, unsigned char *b, int n) { int sum=0, i; for (i=0; i