Privileged Instruction
Direct I/O access: I/O Device 명령에 관한 명령어
Accessing/manipulating System Registers: 레지스터에 관한 명령어
HLT Instruction: 컴퓨터를 종료시킬 수 있는 명령어
CPU mode
Interrupt
HW Interrupt
HW에서 발생
Asynchronous
Exception
SW에서 발생
Synchronous
trap: 사용자가 의도적으로 발생시키는 명령어
fault: 사용자의 의도에 발생하는 것이 아니라 어떠한 문제가 생겨 발생하는 명령어
abort: 복구할 수 없는 명령어로, 프로세스를 종료한다.
System call
PCB의 Kernel Stack에 User Context가 저장된다.
trap명령어를 통해 구현되며 trap을 호출해 User mode에서 kernel모드로 전환이 이루어진다.
trap이 실행될 때, trap handler의 주소를 받아 해당 handler를 찾아가 실행된다.
trap handler에 System call번호를 통해 어떤 작용을 하는 지 알 수 있다.
실행을 마치면 return from trap명령어를 통해 kernel을 빠져나가고 kernel stack의 user context를 복원한다.
[참고] Operating Systems Three Easy Pieces/Remzi H.Arpaci-Dusseau/ CreateSpace Publishing