1 / 10

trap()

제 28 강 : trap(). trap(). Interrupt or Trap(or Exception) Assembler first HW interrupt address 0511 Assembler calls kernel C function trap() Parameters in stack 2673 (dev sp … pc ps). trap vector. savu retu call trap(). sysent[ ]. count call. count call. count call.

Télécharger la présentation

trap()

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 제28강 : trap() trap() • Interrupt or Trap(or Exception) • Assembler first • HW interrupt address • 0511 • Assembler calls kernel C function trap() • Parameters in stack • 2673 (dev sp … pc ps)

  2. trap vector

  3. savu retu call trap()

  4. sysent[ ] count call count call count call count call

  5. sysent[ ] count call count call count call count call

  6. sysent[ ] count call exit() 1 count call fork() 2 count call read() 3 count call

  7. 2754 [fetch data from user space] • fuiword() asm function, (fuword() for d-space) • fetch a word from user space • This is instruction (PC) that caused trap mask it to access sysent[] • callp is pointer to sysent structure • 2762 [fetch system call arguments from user space] • 2762 for (callpcount) fuword( ) into u.u_arg[ ] • Get system call argument into u -> u.u_arg[] • (“count” is # of sys call arg) • 2770 u -> u.u_dirp = u -> u.u_arg[0] : • value of 1st argument • 2771 trap1(address of system call function) user a.out /* next is system call */ PC – 2  chmodk sys call # PC  Sys call parameters /* return from sys call */ PC + 2 

  8. input argument is pointer to function • 2847 calls this function • 2848 • On normal return, u.u_intflg == 0; • If this step is not taken, u.u_intflg == 1; • (see 2845) • 2772 tests u_intflg & sets u_error • 2824 return from trap (system call) • Back to user mode

More Related