324_Book

# Fcomps ia32 fp compare single precision with pop 185

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: has a copy of the requested data words. See Problems 10.11, 10.12, and 10.13 for some different combinations of hits and misses. A. 00 0011 1101 0111 B. VPN: TLBI: TLBT: TLB hit? page fault? PPN: 0011 0101 0111 CO: CI: CT: cache hit? cache byte? 0x3 0x5 0xd Y 0x1d 0xf 0x3 0x3 Y N 0xd C. D. Problem 10.5 Solution: [Pg. 522] Solving this problem will give you a good feel for the idea of memory mapping. Try it your yourself. We haven’t discussed the open, fstat, or write functions, so you’ll need to read their man pages to see how they work. code/vm/mmapcopy.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include "csapp.h" /* * mmapcopy - uses mmap to copy file fd to stdout */ void mmapcopy(int fd, int size) { char *bufp; /* ptr to memory mapped VM area */ bufp = Mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); Write(1, bufp, size); return; } /* mmapcopy driver */ int main(int argc, char **argv) 732 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 APPENDIX B. SOLUTIONS TO PRACTICE PROBLEMS { struct stat stat; int fd; /* check for required command line argument */ if (argc != 2) { printf("usage: %s <filename>\n", argv[0]); exit(0); } /* copy the input argument to stdout */ fd = Open(argv[1], O_RDONLY, 0); fstat(fd, &stat); mmapcopy(fd, stat.st_size); exit(0); } code/vm/mmapcopy.c Problem 10.6 Solution: [Pg. 531] This problem touches on some core ideas such as alignment requiremen...
View Full Document

## This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online