1 / 26

Systemcalls (Systemaufrufe)

Nina, Helen & Nicole proudly present:. Systemcalls (Systemaufrufe). Gliederung. 1. Definitionen 1.1. Interrupt 1.1.1. Exception 1.1.2. Hardware-Interrupt 1.1.3. Software-Interrupt 1.2. Systemcall 1.2.1. Unix – Schalenmodell 1.2.2. Definition Systemcall 1.2.3. 5 Bereiche

Download Presentation

Systemcalls (Systemaufrufe)

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. Nina, Helen & Nicole proudly present: Systemcalls (Systemaufrufe)

  2. Gliederung 1. Definitionen 1.1. Interrupt 1.1.1. Exception 1.1.2. Hardware-Interrupt 1.1.3. Software-Interrupt 1.2. Systemcall 1.2.1. Unix – Schalenmodell 1.2.2. Definition Systemcall 1.2.3. 5 Bereiche 2. Schematischer Ablauf 3. Beispiele 3.1. ausführlich: creat 3.2. weitere Beispiele

  3. Gliederung 1. Definitionen 1.1. Interrupt 1.1.1. Exception 1.1.2. Hardware-Interrupt 1.1.3. Software-Interrupt 1.2. Systemcall 1.2.1. Unix – Schalenmodell 1.2.2. Definition Systemcall 1.2.3. 5 Bereiche 2. Schematischer Ablauf 3. Beispiele 3.1. ausführlich: creat 3.2. weitere Beispiele

  4. Interrupt = Unterbrechung des aktuellen Prozesses durch CPU Unterteilung in : Exception Hardware – Interrupt Software – Interrupt

  5. Hardware – Interrupt

  6. Software – Interrupt = gewollte Unterbrechung des laufenden Progammes, weil Kernel wichtige Funktionen ausführen soll - Software – Interrupt wird durch prozessortypabhängige Befehle (Systemcalls) ausgelöst

  7. Gliederung 1. Definitionen 1.1. Interrupt 1.1.1. Exception 1.1.2. Hardware-Interrupt 1.1.3. Software-Interrupt 1.2. Systemcall 1.2.1. Unix – Schalenmodell 1.2.2. Definition Systemcall 1.2.3. 5 Bereiche 2. Schematischer Ablauf 3. Beispiele 3.1. ausführlich: creat 3.2. weitere Beispiele

  8. Unix Schalenmodell – Systemstruktur Anwenderprogramme sh nroff who cpp Kernel a.out comp Systemcalls Hardware as date Systemmode ld wc grep vi ed Usermode

  9. Systemcalls = Anfrage an den Kernel - Programme fordern per Systemcall Dienstleistungen vom Kernel an - definiert Schnittstelle zwischen Kernel und Benutzerprogramm

  10. 5 Bereiche der Systemcalls 1. Prozessverwaltung fork, exit, exec 2. Speicherverwaltung brk, mmap, munmap 3. Dateiverwaltung open, read, write 4. Geräteverwaltung io_ctl 5. Kommunikation kill, pipe

  11. Gliederung 1. Definitionen 1.1. Interrupt 1.1.1. Exception 1.1.2. Hardware-Interrupt 1.1.3. Software-Interrupt 1.2. Systemcall 1.2.1. Unix – Schalenmodell 1.2.2. Definition Systemcall 1.2.3. 5 Bereiche 2. Schematischer Ablauf 3. Beispiele 3.1. ausführlich: creat 3.2. weitere Beispiele

  12. Systemebenen User- Anwendungen Bibliotheken Benutzerstack Usermode Benutzerebene Trap Mehr- zweck- register weitere Register System- stack PSR Tabel- len Systemebene Kernel Systemmode Hardware-Steuerung Prozessor etc. Hardware

  13. BENUTZEREBENE-USERMODE User-Anwendungen Benutzerstack . . . 204 mode Angabe (Oktal 666) 1b6 Adresse von name 6a Rückkehradresse creat(name, 0666); SYSTEMCALL

  14. BENUTZEREBENE-USERMODE SYSTEMEBENE - SYSTEMMODE Mehrzweckregister Bibliothek 58 … … Nr Befehl ;ASM .CODE BEGINN MOV MOV JSR JMP . . . . . exit 1 … 7e fork 2 8 142 read 3 . 80 … . … 13c . . TRAP … 146 create 8

  15. BENUTZEREBENE-USERMODE Softwareinterrupt TRAP TF CF OF IF AF PF DF SF ZF PSR 1 0 15 SYSTEMEBENE - SYSTEMMODE

  16. BENUTZER- EBENE– USERMODE SYSTEMEBENE - SYSTEMMODE Register Mehrzweckregister Tabelle Benutzerstack . 0 funktion0(); . . 58 … … 1 funktion1(); 2 funktion2(); … … 7e 204 funktion3(); 3 1b6 funktion4(); 4 U-Bereich 8 142 5 funktion5(); 204 6 80 funktion6(); … 6a 1b6 7 funktion7(); 13c … funktion8(); 8 funktion9(); 9 146 … 10 funktion10(); 11 funktion11();

  17. SYSTEMEBENE - SYSTEMMODE ;Ken Thompson 1969 ; .STACK 1000H .DATA VARA DW1; VARB DW2; .CODE BEGINN MOV AX,@DATA; MOV AX,VARA; ADD AX,VARB, … END BEGIN; 0 1 0 11 0 1 00 1 1 101 11 0 010 110 1 0 100 Hardware Prozessor

  18. SYSTEMEBENE - SYSTEMMODE Register Mehrzweckregister … … 58 … … 7e U-Bereich 8 142 204 80 … 1b6 0 0x800CCC6F 13c … 146 Fehlerfeld 1 CF CF OF PF DF IF TF SF ZF AF PSR 1 0 15

  19. BENUTZEREBENE-USERMODE User-Anwendungen Benutzerstack Bibliothek . . . Nr Befehl ;ASM .CODE BEGINN MOV MOV JSR JMP . . . . . exit 1 204 fork 2 1b6 read 3 . creat(name, 0666); 6a . I . ? . creat 8 Returncode = 0 SYSTEMEBENE - SYSTEMMODE CF PF OF DF TF SF ZF IF AF PSR

  20. 1 BENUTZEREBENE-USERMODE User-Anwendungen Mehrzweckregister Bibliothek … 58 Befehl Nr ;ASM .CODE BEGINN MOV MOV JSR JMP . . . . . … 7e exit 1 142 8 fork 2 … 80 read 3 . 13c 0x800CCC6F -1 creat(name, 0666); . ? 146 … . ? . creat 8 Returncode = -1 errno 0x800CCC6F SYSTEMEBENE - SYSTEMMODE CF AF IF OF PF DF TF SF ZF PSR

  21. BENUTZEREBENE-USERMODE errno 0x800CCC6F User-Anwendungen errno Makro error message 1 3 4 … 19 20 … 23 24 25 EPERM ENOENT ESRCH EINTR … ENODEV ENOTDIR … ENFILE EMFILE ENOTTY Permission No such file or directory No such process interrupted system call … No such device Not a directory ... File table overflow Too many open files Not a typewriter … 2 creat(name, 0666); gmake[1]: *** [libswt- gnome-gtk-3063.so] Error 1 gmake[1]: Leaving directory`/usr/ports/ java/eclipse/work/plugins /org.eclipse.swt/Eclipse SWT PI/gtk/library' gmake: *** [libswt] Error 2 *** Error code 2 Returncode = -1

  22. Gliederung 1. Definitionen 1.1. Interrupt 1.1.1. Exception 1.1.2. Hardware-Interrupt 1.1.3. Software-Interrupt 1.2. Systemcall 1.2.1. Unix – Schalenmodell 1.2.2. Definition Systemcall 1.2.3. 5 Bereiche 2. Schematischer Ablauf 3. Beispiele 3.1. ausführlich: creat 3.2. weitere Beispiele

  23. Systemcall creat Ausschnitt aus C-Programm char name[]=„file“; main { int fd; fd = creat(name, 0666); }

  24. Teil des Assemblercodes für Motorola 68000

  25. Weitere Beispiele • open(<dateiname>,<art>) • öffnet eine vorhandene Datei mit angegebener Benutzungsart • read(<filehandle>,<puffer>,<puffergröße>) • liest Datei ein, mit angegebener Anzahl an Bytes • write(<filehandle>,<puffer>,<puffergröße>) • schreibt angegebene Anzahl an Bytes in spezifizierte Datei

  26. ENDE

More Related