trap() - PowerPoint PPT Presentation

slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
trap() PowerPoint Presentation
play fullscreen
1 / 10
trap()
197 Views
Download Presentation
yael-fitzgerald
Download Presentation

trap()

- - - - - - - - - - - - - - - - - - - - - - - - - - - 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