Segmentc494497 segment bounds updated segments grow

This preview shows page 319 - 321 out of 328 pages.

segment.c:494,497 Segment bounds updated. Segments grow, but they really never shrink—only memory is reused if they are pretending to shrink. 6.6.4 Flushing segments syssegflush() segflush(2) system call. Flushes a segment cache. segment.c:681,729 syssegflush does a flush of the processor cache for memory within the segment. This seems to be used only by instruction simulator commands. The routine flushes a range of the user address space, which may spawn several segments. For each segment, pteflush is called to flush Ptes affected. syssegflush pteflush() Flushes the cache for a Pte. segment.c:667,678 pteflush sets the cachectl entry for the page (if not paged out) to PG_TXTFLUSH . As you may remember, this means that for several architectures (not the In- tel), the processor cache entries for the given pages may be flushed later by the flushmmu call at :727 . 6.6.5 Segment profiling segclock() Update segment profiling counters. segment.c:731,745 Not really a system call, but each time the clock ticks, if the processor was run- ning user code, ../pc/clock.c:76,79 would call segclock giving the current saved program counter for the user process. The call is made after adding to the word in the bottom of the user stack the number of ticks in a millisecond. The kernel is maintaining a “clock” for the running process in the bottom of its user stack. If profile is set in the TSEG for the process, segclock adds the time passed to the value in s->profile[0] . Moreover, if the program counter for the user was within this segment, it is converted to a relative offset within TSEG and another time counter incremented. The >>LRESPROF is used to have one time counter per LRESPROF instructions in the text segment. If you think of it, the author is filling up profile with an array of clocks for the process. The first clock counts the time the process has been executing (one ms added every time a ms happens and the process was running), following clocks have the time spent by the process within the first, second,. . . group of LRESPROF instructions. The user can later inspect these clocks and learn where is his program spending time. This is crucial to let the user know what should be optimized, and what not.
304 CHAPTER 6. MEMORY MANAGEMENT 6.7 Intel MMU handling During the chapter about system startup you already read some code for MMU han- dling in the Intel PC. In this section you will be reading the code which has been used by the machine independent code for memory management, and was not discussed previously. 6.7.1 Flushing entries flushmmu() Flushes MMU translations. ../pc/mmu.c:80,89 flushmmu was called whenever the page table was changed, and translations should be updated. Remember that the TLB may keep cached entries. All it does is to set the newtlb flag and switch to the current page table. On the Intel, a load of the page directory base register flushes the TLB too.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture