GithubHelp home page GithubHelp logo

os-dev's Introduction

OS-Dev

https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf

Bootloader

System start

Bios

Befehlssatz ist immer 8086 - 16 Bit und im Real-Mode

  • Bios:
    1. System check ob alle Componenten vorhanden sind
    2. such nach dem Bootloader/Bootmanager auf dem "Master Boot Record" (MBR)
    3. Läd es in den Ram und spring zu der Addresse
    4. Jetzt setzt die CPU ein

Master Boot Record

  • Enthält das Startprogramm und die Partitionstabelle
  • Liegt im Track 0 Side 0 Sector 0
  • Am ende muss 0x55AA stehe
    Der Speicheraufbaue der MBR ist wie folgt
Stage 1 Bootloader Master Partition Enty 0 Master Partition Enty 1 Master Partition Enty n Magic number

Addr. Function
Inhalt
Size
(Byte)
Hex Dez
0x0000 0 Startprogamm(bootloader) 440
0x01B8 440 Datenträger Signatur 4
0x01BC 444 Null (0x0000) 2
0x01BE 446 Partitionstabelle 64
0x01FE 510 55hex Bootsektor-Signatur 2
0x01FE 511 AAhex
Gesammt: 512

Partitions Tabelle

Flag Start CHS Type End CHS Start LBA Size
1Byte 3Byte 1Byte 3Byte 4Byte 4Byte

Aufbau einer Partitionstabelle

Beispiel:

Offset 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
. . .
0x01b0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x78 0x56 0x34 0x12 0x00 0x00 0x00 0x01
0x01c0 0x01 0x00 0x83 0xfe 0xff 0xff 0x3f 0x00 0x00 0x00 0x41 0x29 0x54 0x02 0x00 0xfe
. . .
0x01e0 0xff 0xff 0x83 0xfe 0xff 0xff 0x7a 0x11 0x72 0x02 0xfa 0xe7 0x1d 0x00 0x80 0xfe
0x01f0 0xff 0xff 0x83 0xff 0x74 0xf9 0x8f 0x02 0x0c 0x83 0x6c 0x04 0x54 0x02 0x55 0xAA
Flags
Wert Beschreibung
0x00 Partition ist nicht bootfähig
0x80 bootfähige Partition
CHS (Cylinder/Head/Sector)
CHS zu LBA umrechnen

LBA: Logical Block Addressing


Variable Beschreibung
c Zylindernummer
H Zahl der Leseköpfe
h Lesekopfnummer
S Zahl der Sektoren (= Zahö der Blöcke je Zylinderkopfspur bzw. Tack)
s Sektornummer

ASSEMBLY

Loop

Link

https://c9x.me/x86/html/file_module_x86_id_161.html

Beschreibung

um in inder loop laufen zu können müssen wir das CX register mit unsersen zähler laden.
Das CX register könnt ihr euch in dem Falle wie int i = 0 vorstellen
Dem loop-Befehl könnt ihr nun wieder zu eurem schleifen Anfang springen

Beispiel

Schreibt 10 den Buchstaben a in die "Console"

Langsame variante mit dem Stack

    mov cx, 10       		; läd 10 in das cx register (int i = 10)
LoopBody:               	; marker für mein schleifen, zum hochspringen
    ; loop-body mit magic
    mov al, 'a'
    mov ah, 0eh
    int 10h
    ; end loop-body
    loop LoopBody

wie machen wir nun eine loop in einer loop?
Dazu wird der Stack genutzt.

    mov cx, 10			; läd 100 in das cx register (int i = 10)
LoopBigBody:			; marker für die aeuser Schleife 
   push cx			; bring den wert cx auf den Stack
			        ; da wir das register cx doppelt benutzen
    ; loop-body mit magic
    mov al, 'y'
    mov ah, 0eh
    int 10h
    ; end loop-body
    mov cx, 10       	        ; läd 10 in das cx register (int i = 10)
LoopInnerBody:                  ; marker für die innere Schleifen
    ; loop-body mit magic
    mov al, 'x'
    mov ah, 0eh
    int 10h
    ; end loop-body
    loop LoopInnerBody 	         ; cx -= 1 und pringt zum Marker "LoopLittleBody"
    pop cx 		         ; holst sich den gespeicherten wert vom Stack zurück 
    loop LoopBigBody

Schnellere variante

Kommt später

Links:

https://de.wikipedia.org/wiki/Master_Boot_Record
https://de.wikipedia.org/wiki/Cylinder_Head_Sector
https://de.wikipedia.org/wiki/Partitionstabelle
https://de.wikipedia.org/wiki/GUID_Partition_Table

video mode

http://www.wagemakers.be/english/doc/vga
http://www.monstersoft.com/tutorial1/VESA_intro.html

videos

https://www.youtube.com/watch?v=jS5vTJRfmnI - loop

os-dev's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.