Presentation is loading. Please wait.

Presentation is loading. Please wait.

Interrupts & Syscalls.

Similar presentations


Presentation on theme: "Interrupts & Syscalls."— Presentation transcript:

1 Interrupts & Syscalls

2 Interrupts Interrupt : (aka Exceptions) Signal to CPU that something needs to happen Hardware Interrupts Input/output ready Ctrl-C Code needs help Trap from math overflow Request for OS

3 ARM Users ARM Modes Triggered by different interrupts
ARMSim does not model other modes

4 Interrupt Handling

5 Interrupt Handling Interrupts complete before normal processing resumes May be interrupted by higher priorty interrupts

6 Interrupts ARMv7 maintains shadow registers for interrupts
Avoid save/reload

7 Interrupts ARMv8 On Exception, processor stores
Current instruction to Exception Link Register ELR Exception readon to Exception Syndrome Register ESR Then branches to known address for OS to run handler

8 Interrupts Vectored Interrupts: Each interrupt matched to special memory address Addresses contain addresses of Interrupt Service Routines (ISR)

9 Interrupts On exception Processor loads address given in vector
Loads that address and sets PC to it MEMORY 0x0000 0x01A0 0x0004 0x0200 0x0008 0x04F2 0x000C 0x0500 Code for Reset Code for SWI

10 ARM Linux Syscalls

11 Syscalls Operating system has control over hardare resources
Filesystem Memory Etc…

12 Syscalls System Calls : Software generated exception
Ask OS to do a job it can’t

13 Syscalls Syscalls defined by OS
Linux different than Windows Way to call them defined by platform convention

14 ARM Linux Syscalls SWI 0 used to trigger all system calls:

15 ARM Linux Syscalls R7 used to specify syscall to do

16 Syscalls Basic system call cheat sheet:

17 Syscalls File Handles: Number identifying “file”
File 0 is always stdin (console input) File 1 is stdout (console output) File 2 is stderr (console output but can be treated different)

18 Hello World Write to console:

19 Echo Input Read a line to buffer…

20 Echo Input …write it out

21 Real Files Open takes file name Via address to string in memory

22 Real Files Open returns fileHandle Number identifying opened file
-1 if error Should be 3 for your first opened file Store fileHandle for use with read/write

23 Real Files Flags : Mode to open file in

24 Real Files Mode : Use means 0 : Octal number 6 : you can read write 4 : group can read 4 : others can read

25 Real Files File write:


Download ppt "Interrupts & Syscalls."

Similar presentations


Ads by Google