sos

[unmaintained] experimenting with low level OS development
Log | Files | Refs | README | LICENSE

commit c67256787e2754cf1ec940a3777018723c45e497
parent 19e1a34d5f5524ce8c6d818c49dfdebf11685575
Author: Stefan <misc@stefan-koch.name>
Date:   Sat, 10 Oct 2015 23:08:20 +0200

jump to protected mode and display character P

Diffstat:
M.gitignore | 1+
MMakefile | 7+++++++
Mbochsrc | 2+-
Mboot.asm | 32++++++++++++++++----------------
Aimages/gdt.png | 0
Aimages/gdt.svg | 322+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Akernel.asm | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 402 insertions(+), 17 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -28,6 +28,7 @@ *.x86_64 *.hex *.bin +*.img # Debug files *.dSYM/ diff --git a/Makefile b/Makefile @@ -3,6 +3,13 @@ ASMFLAGS = all: $(ASM_FILES) $(ASM) $(ASMFLAGS) boot.asm -o boot.bin + $(ASM) $(ASMFLAGS) kernel.asm -o kernel.bin + + dd if=/dev/zero of=sos.img bs=1k count=1440 + cat boot.bin kernel.bin > /tmp/sos.bin + dd status=noxfer conv=notrunc if=/tmp/sos.bin of=sos.img clean: rm boot.bin + rm kernel.bin + rm sos.img diff --git a/bochsrc b/bochsrc @@ -1,6 +1,6 @@ romimage: file="$HOME/opt/bochs/share/bochs/BIOS-bochs-latest" vgaromimage: file="$HOME/opt/bochs/share/bochs/VGABIOS-elpin-2.40" boot: floppy -floppya: 1_44="boot.bin", status=inserted +floppya: 1_44="sos.img", status=inserted cpu: count=1, ips=4000000, reset_on_triple_fault=0 magic_break: enabled=1 diff --git a/boot.asm b/boot.asm @@ -6,23 +6,23 @@ mov ss, ax mov ds, ax mov es, ax -mov si, welcome_msg -call print_string +disk_reset: + xor ah, ah ; ah=0, reset drive head + int 13h + jc disk_reset -jmp $ +disk_read: + mov ah, 0x02 ; with interrupt 3h: reading! + mov al, 10 ; read 10 sectors + mov cl, 2 ; from sector 2 + mov bx, 0x8000 ; save data to location 0x8000 -print_string: - mov ah, 0eh ; output with interrupt 10h -.next_char: - lodsb ; reads one bytes and saves it to AL - cmp al, 0 ; was the nullbyte read? - je .done ; if yes: finished - int 10h ; otherwise: show current character from AL - jmp .next_char ; and go on with next char -.done: - ret + mov ch, 0 + mov dh, 0 + int 13h + jc disk_read -welcome_msg db 'Hello World!', 0 + jmp 0x0000:0x8000 ; jump to the new program, hooray -times 510-($-$$) hlt -dw 0xAA55 +times 510-($-$$) db 0 +dw 0xaa55 diff --git a/images/gdt.png b/images/gdt.png Binary files differ. diff --git a/images/gdt.svg b/images/gdt.svg @@ -0,0 +1,322 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="210mm" + height="297mm" + viewBox="0 0 744.09448819 1052.3622047" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="gdt.svg" + inkscape:export-filename="/home/brati/Programming/sos/images/gdt.png" + inkscape:export-xdpi="262" + inkscape:export-ydpi="262"> + <defs + id="defs4"> + <marker + inkscape:stockid="Arrow1Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="marker4626" + style="overflow:visible;" + inkscape:isstock="true"> + <path + id="path4628" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + transform="scale(0.8) rotate(180) translate(12.5,0)" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible;" + id="marker4568" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow1Lend" + inkscape:collect="always"> + <path + transform="scale(0.8) rotate(180) translate(12.5,0)" + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + id="path4570" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible;" + id="marker4546" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow1Lend"> + <path + transform="scale(0.8) rotate(180) translate(12.5,0)" + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + id="path4548" /> + </marker> + <marker + inkscape:stockid="Arrow1Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow1Lend" + style="overflow:visible;" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path4212" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + transform="scale(0.8) rotate(180) translate(12.5,0)" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.49497475" + inkscape:cx="287.39756" + inkscape:cy="602.81838" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="970" + inkscape:window-height="722" + inkscape:window-x="76" + inkscape:window-y="161" + inkscape:window-maximized="0" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3336" + width="383.85797" + height="32.324883" + x="338.40109" + y="174.53964" /> + <rect + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3336-7" + width="383.85797" + height="32.324883" + x="338.54877" + y="206.9445" /> + <rect + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3336-7-9" + width="383.85797" + height="32.324883" + x="338.47479" + y="239.25189" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 509.11688,173.52949 0,96.97465" + id="path4168" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 649.64286,174.50506 0,97.14286" + id="path4170" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="340.42142" + y="162.41782" + id="text4172" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4174" + x="340.42142" + y="162.41782">Basis</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="513.15753" + y="163.42798" + id="text4176" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4178" + x="513.15753" + y="163.42798">Limit</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="651.54846" + y="163.42796" + id="text4180" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4182" + x="651.54846" + y="163.42796">Flags</tspan></text> + <rect + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4199" + width="197.9899" + height="33.335033" + x="32.324883" + y="114.94064" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 128.28937,114.94064 0,32.32488" + id="path4201" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)" + d="m 75.761441,148.27568 c 0,0 3.030457,42.4264 50.507629,50.50762 47.47717,8.08122 211.12188,10.10153 211.12188,10.10153" + id="path4203" + inkscape:connector-curvature="0" + sodipodi:nodetypes="csc" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="45.456867" + y="141.20461" + id="text4485" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4487" + x="45.456867" + y="141.20461">0x08</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="6.0609155" + y="100.79851" + id="text4489" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4491" + x="6.0609155" + y="100.79851">Selektor</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="134.3503" + y="100.79851" + id="text4493" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4495" + x="134.3503" + y="100.79851">Offset</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="357.59399" + y="234.13864" + id="text4497" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4499" + x="357.59399" + y="234.13864">0x10000</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="516.18793" + y="234.13864" + id="text4501" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4503" + x="516.18793" + y="234.13864">0x0FFFF</tspan></text> + <rect + style="fill:#f7ebcd;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4505" + width="189.90868" + height="229.30463" + x="436.38589" + y="391.72244" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 437.39605,389.70213 0,-95.96449" + id="path4507" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 625.28442,392.22751 0,-95.96449" + id="path4507-1" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 626.29458,718.50679 0,-95.96449" + id="path4507-13" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 437.39605,716.48649 0,-95.96449" + id="path4507-7" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4568)" + d="m 340.42141,241.20971 c -106.06602,239.40615 90.91373,377.79705 90.91373,377.79705" + id="path4536" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4546)" + d="M 514.16765,239.18941 C 384.86812,332.12344 434.36559,389.70213 434.36559,389.70213" + id="path4538" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:125%;font-family:Arial;-inkscape-font-specification:Arial;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="465.68033" + y="749.31647" + id="text4602" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="465.68033" + y="749.31647" + id="tspan4606">Physischer</tspan><tspan + sodipodi:role="line" + x="465.68033" + y="789.31647" + id="tspan4610">Speicher</tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 435.37575,519.00166 191.92898,0" + id="path4612" + inkscape:connector-curvature="0" /> + <path + style="fill:#f7ebcd;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4616" + d="m 428.60079,519.50263 c -0.81816,0.34043 -1.79457,0.32989 -2.52677,0.86984 -0.58195,0.42915 -0.0941,0.14598 -0.62713,0.63411 -0.16104,0.14746 -0.34418,0.26878 -0.51627,0.40317 -0.42743,0.35639 -0.96535,0.64335 -1.313,1.09181 -0.35756,0.46123 -0.60422,1.01236 -0.95834,1.48328 -0.4591,0.89609 -0.82292,1.8453 -1.15412,2.80021 -0.0188,0.14118 -0.0277,0.28402 -0.0564,0.42353 -0.10793,0.52581 -0.15436,0.45866 -0.23539,0.95709 -0.0877,0.53967 0.051,0.49838 -0.17478,1.0655 -0.33084,0.58117 -0.22186,1.23001 -0.18638,1.86961 0.0116,0.20964 -0.007,0.4236 0.0383,0.6287 0.0305,0.13922 0.12249,0.25736 0.18373,0.38604 0.41323,0.61693 0.2772,1.39267 0.21525,2.09063 -0.0136,0.15371 -0.0663,0.30787 -0.0451,0.46072 0.0128,0.0926 0.0948,0.16109 0.14225,0.24164 0.34756,0.70915 0.33761,1.49356 0.27072,2.26007 -0.0148,0.1698 -0.0614,0.33964 -0.0453,0.50933 0.019,0.19967 0.0993,0.38865 0.14895,0.58298 0.29894,0.7505 0.21281,1.54963 0.29115,2.32727 0.0612,0.60781 0.24228,1.1628 0.50116,1.70759 0.18998,0.71607 0.42117,1.41614 0.73461,2.08838 0.11877,0.25473 0.27517,0.49185 0.3807,0.75235 0.0483,0.11933 0.4018,1.33623 0.44558,1.48559 0.0904,0.22919 0.15872,0.46832 0.27109,0.68756 0.15347,0.29941 0.38934,0.5509 0.54855,0.8473 0.33343,0.62071 0.53952,1.20197 0.70479,1.88721 0.0463,0.88178 0.76244,1.62373 0.76157,2.50748 -3.6e-4,0.36149 -0.0848,0.718 -0.12947,1.07671 -0.0161,0.18934 -0.0388,0.37823 -0.0482,0.56802 -0.0102,0.2051 -0.0387,0.41257 -0.0104,0.61597 0.0669,0.48204 0.34387,0.89945 0.38353,1.3893 0.0618,0.76302 -0.12822,0.93392 -0.44308,1.60846 -0.41564,0.76488 -0.90173,1.48981 -1.34167,2.23798 -0.22942,0.49312 -0.10435,0.25799 -0.37236,0.70691 -0.78675,0.90444 -1.82906,1.52138 -2.8511,2.12364 -0.10287,0.10995 -0.21738,0.21007 -0.30861,0.32986 -0.0754,0.099 -0.10684,0.22825 -0.18817,0.32245 -0.50491,0.58483 -1.70137,1.10844 -2.40069,1.48698 -0.18438,0.0638 -0.362,0.15234 -0.55316,0.19152 -0.14087,0.0289 -0.28881,-0.009 -0.43127,0.0103 -0.0828,0.0114 -0.15595,0.0616 -0.23713,0.0815 -0.68511,0.16785 -1.26038,0.3701 -1.91111,0.66149 -1.00273,0.38393 -0.28074,0.16796 -1.29423,0.32692 -0.15528,0.0244 -0.94332,0.19226 -1.13928,0.21063 -0.0376,0.004 0.0693,-0.0307 0.10119,-0.0509 0.14915,-0.0944 0.29428,-0.19493 0.44142,-0.29239 0.61285,-0.12848 1.29,0.0596 1.90141,-0.0601 0.41854,-0.0819 0.81443,-0.3263 1.23792,-0.42459 0.41241,-0.0796 0.82233,0.13018 1.233,0.0843 0.42518,-0.0475 0.87234,-0.3158 1.28745,-0.43106 0.8136,-0.0736 1.62468,0.0291 2.33345,0.46551 0.29345,0.18069 0.53901,0.42965 0.81356,0.63794 0.16768,0.13792 0.77037,0.61722 0.913,0.79769 0.36926,0.46722 0.39407,1.16628 0.62666,1.6964 0.0899,0.20494 0.21825,0.39077 0.32738,0.58615 0.50063,0.70311 0.51649,1.54897 0.76935,2.3411 0.82018,2.56938 -0.20362,-1.05586 0.51127,1.54865 0.21842,0.67278 -0.0492,1.29061 -0.11164,1.94287 -0.0234,0.24506 -0.005,0.65727 2.1e-4,0.89321 0.0441,1.12929 0.0391,2.25951 0.0249,3.3893 -0.0334,0.17899 0.0373,0.36839 -2e-4,0.54675 -0.0422,0.20108 -0.13219,0.38934 -0.18661,0.58747 -0.16565,0.603 -0.25985,1.17149 -0.25776,1.79429 -0.27303,0.95664 -0.43987,1.94795 -0.91539,2.82896 -0.46479,1.01805 0.054,-0.21209 -0.18605,0.61085 -0.16964,0.58159 -0.3228,0.70724 -0.29834,1.35559 -0.16027,0.4393 -0.34366,0.81951 -0.37038,1.29396 -0.0129,0.22869 0.0241,0.45948 -9.7e-4,0.68716 -0.071,0.64561 -0.18887,0.74441 -0.4825,1.32746 -0.24066,0.6888 -0.5688,1.3376 -0.6422,2.07424 -0.0233,0.2339 0.014,0.47095 -0.006,0.70515 -0.0422,0.49251 -0.1539,0.97657 -0.23034,1.46493 -0.0174,0.17345 -0.008,0.3518 -0.0523,0.52034 -0.12014,0.45497 -0.20074,0.31718 -0.34784,0.68632 -0.13517,0.33922 -0.01,0.85238 0.0186,1.19521 -0.0247,0.37845 0.13745,0.81021 0.0499,1.18865 -0.11708,0.50629 -0.36827,0.96009 -0.47447,1.47427 0.0508,1.11145 0.13104,2.21299 0.11026,3.32668 0.14413,0.69683 0.35878,1.38334 0.42695,2.09456 0.0128,0.1336 -0.0175,0.27029 0.005,0.40262 0.0477,0.28138 0.17795,0.54234 0.26396,0.81446 0.0462,0.50798 0.15917,1.05632 0.38799,1.51954 0.0537,0.10861 0.14788,0.1924 0.21189,0.29525 0.14475,0.2326 0.29492,0.59173 0.40084,0.82479 0.55689,0.8755 0.88196,1.86691 1.44961,2.73677 0.23727,0.5499 0.69842,0.93637 1.05232,1.39748 0.27439,0.3575 0.48883,0.83049 0.6976,1.22506 0.58395,0.99003 1.49987,1.66147 2.57478,2.03738 0.86797,0.33013 1.70674,0.83949 2.63189,1.00105 0.25768,0.045 0.52169,0.0392 0.78254,0.0588 0.88932,-0.0565 0.50376,-0.10774 1.16542,0.0577 0,0 -0.0942,0.34449 -0.0942,0.34449 l 0,0 c -0.55807,-0.1708 -0.19831,-0.0993 -1.09942,-0.0462 -0.28327,-0.0236 -0.5701,-0.0201 -0.84982,-0.0707 -0.93304,-0.16864 -1.78099,-0.67383 -2.65676,-1.00894 -1.15448,-0.42162 -2.14521,-1.12874 -2.77015,-2.20673 -0.19215,-0.36386 -0.39005,-0.82022 -0.64466,-1.15013 -0.36758,-0.47631 -0.83972,-0.87979 -1.08953,-1.44555 -0.56925,-0.88957 -0.91661,-1.88797 -1.47482,-2.78296 -0.40657,-0.89758 -0.99039,-1.64326 -1.01603,-2.67952 -0.0357,-0.11306 -0.26489,-0.82889 -0.28055,-0.91929 -0.02,-0.11566 0.0101,-0.23528 -9.7e-4,-0.35213 -0.0691,-0.73134 -0.30212,-1.43401 -0.43088,-2.15453 0.0213,-1.13621 -0.0739,-2.25943 -0.10261,-3.39381 0.1241,-0.57612 0.0617,-0.39343 0.28918,-0.97594 0.0562,-0.14394 0.14098,-0.27809 0.17759,-0.42821 0.0893,-0.36599 -0.0772,-0.78995 -0.0488,-1.15576 -0.0367,-0.4498 -0.14511,-0.96365 0.0263,-1.39983 0.0321,-0.0817 0.28484,-0.4738 0.3036,-0.54682 0.045,-0.17512 0.0365,-0.35976 0.0548,-0.53965 0.0738,-0.47164 0.18502,-0.93858 0.22607,-1.4142 0.022,-0.25528 -0.0146,-0.51381 0.0125,-0.7686 0.082,-0.76952 0.4178,-1.45071 0.67503,-2.16927 0.25578,-0.48864 0.38365,-0.61624 0.44315,-1.16588 0.0786,-0.7258 -0.0475,-1.30303 0.37152,-1.96885 -0.0101,-0.41762 0.0143,-0.7513 0.1729,-1.14265 0.0378,-0.0933 0.10043,-0.17667 0.12871,-0.27332 0.26264,-0.89741 -0.18891,0.17116 0.22689,-0.73359 0.46271,-0.82124 0.58307,-1.76704 0.8711,-2.65685 0.002,-0.66024 0.094,-1.26924 0.27621,-1.90743 0.046,-0.16101 0.13272,-0.30969 0.16817,-0.47334 0.039,-0.17986 -0.0347,-0.37157 2.3e-4,-0.55209 0.0142,-1.12553 0.0192,-2.2515 -0.0249,-3.37653 -0.007,-0.32683 -0.025,-0.64761 0.007,-0.97398 0.0587,-0.59652 0.31401,-1.15899 0.11684,-1.77623 -0.6517,-2.39585 0.29835,0.99698 -0.51346,-1.55705 -0.24318,-0.76506 -0.25055,-1.57534 -0.73519,-2.25403 -0.11774,-0.21489 -0.25502,-0.42017 -0.3532,-0.64467 -0.1725,-0.39446 -0.26202,-1.2079 -0.53174,-1.54938 -0.13954,-0.17667 -0.72345,-0.64113 -0.88553,-0.77456 -0.25377,-0.19283 -0.47553,-0.42959 -0.74631,-0.59769 -0.63768,-0.39586 -1.35365,-0.49895 -2.09009,-0.44584 -0.46676,0.1268 -0.92805,0.39074 -1.41146,0.44262 -0.37767,0.0405 -0.74685,-0.1344 -1.12475,-0.0919 -0.45253,0.0995 -0.85946,0.34499 -1.31127,0.43337 -0.60997,0.11932 -1.28564,-0.0688 -1.89691,0.06 -0.25038,-0.0863 -0.52361,-0.12335 -0.75112,-0.25889 -0.0498,-0.0297 0.0819,-0.09 0.13738,-0.10671 0.53155,-0.16019 1.19486,-0.13926 1.7161,-0.27002 0.21904,-0.0549 0.42192,-0.16117 0.63288,-0.24175 0.70372,-0.31342 1.51659,-0.66963 2.29322,-0.77403 0.1046,-0.0141 0.21291,0.0291 0.3165,0.009 0.17211,-0.0335 0.33239,-0.11176 0.49859,-0.16764 0.55082,-0.29809 1.88604,-0.9159 2.26444,-1.35664 0.0985,-0.11468 0.14269,-0.26849 0.23718,-0.38646 0.11413,-0.14249 0.25643,-0.25992 0.38465,-0.38988 0.97271,-0.57207 1.95936,-1.15797 2.72607,-1.99964 0.26114,-0.43261 0.13013,-0.19353 0.38252,-0.72289 0.43023,-0.73368 0.90681,-1.44458 1.31595,-2.19318 0.2632,-0.52747 0.46915,-0.75009 0.41977,-1.36149 -0.0413,-0.51143 -0.32713,-0.97908 -0.39552,-1.48759 -0.0285,-0.21146 9.6e-4,-0.42689 0.0117,-0.63999 0.01,-0.19443 0.0331,-0.38793 0.0497,-0.5819 0.041,-0.32933 0.12083,-0.65541 0.12961,-0.98718 0.0229,-0.86442 -0.73833,-1.60253 -0.75485,-2.47057 -0.15005,-0.64739 -0.34918,-1.19859 -0.66295,-1.78481 -0.16818,-0.31423 -0.41353,-0.58367 -0.57522,-0.90128 -0.1166,-0.22903 -0.18764,-0.47854 -0.28145,-0.7178 -0.014,-0.0479 -0.40229,-1.3774 -0.42159,-1.42492 -0.10871,-0.26767 -0.2689,-0.51169 -0.39062,-0.7737 -0.31057,-0.66851 -0.54741,-1.36297 -0.72942,-2.07674 -0.277,-0.59994 -0.46711,-1.18755 -0.53479,-1.85371 -0.0764,-0.75176 0.0129,-1.52425 -0.2814,-2.24948 -0.0524,-0.23255 -0.13528,-0.46029 -0.15734,-0.69767 -0.0157,-0.16957 0.0301,-0.33928 0.0452,-0.50891 0.0629,-0.70379 0.0832,-1.42456 -0.23783,-2.07625 -0.0583,-0.14303 -0.15231,-0.2763 -0.1748,-0.4291 -0.0222,-0.15085 0.031,-0.30337 0.0446,-0.45524 0.0577,-0.6437 0.20263,-1.35127 -0.18573,-1.91634 -0.0713,-0.16975 -0.17408,-0.3295 -0.2138,-0.50927 -0.0456,-0.20624 -0.0269,-0.42157 -0.0385,-0.63246 -0.0381,-0.69344 -0.13931,-1.40351 0.21754,-2.03444 0.19879,-0.36774 0.0849,-0.58786 0.15185,-0.99688 0.0962,-0.58777 0.10594,-0.33103 0.23021,-0.92872 0.0337,-0.16197 0.0485,-0.3273 0.0727,-0.49095 0.34469,-0.98856 0.71874,-1.97438 1.20638,-2.89803 0.36709,-0.48451 0.62215,-1.04929 0.99478,-1.52453 0.35847,-0.45719 0.9033,-0.75465 1.34325,-1.11802 0.15529,-0.11858 0.32191,-0.22364 0.46587,-0.35575 0.52758,-0.48414 0.11555,-0.28198 0.71216,-0.70518 0.77951,-0.55293 1.78137,-0.58052 2.6518,-0.91587 0,0 0.0587,0.35228 0.0587,0.35228 z" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4626)" + d="m 189.90868,150.29598 c 71.72083,348.50263 223.24371,415.1727 223.24371,415.1727" + id="path4618" + inkscape:connector-curvature="0" /> + </g> +</svg> diff --git a/kernel.asm b/kernel.asm @@ -0,0 +1,55 @@ +[BITS 16] +[ORG 0x8000] + +xor ax, ax ; set ax to 0 = first segment +mov ss, ax +mov ds, ax +mov es, ax + +enter_pmode: + cli + lgdt [gdtr] + mov eax, cr0 + or eax, 1 + mov cr0, eax + + jmp 08h:far_jump + +[BITS 32] +far_jump: + mov ax, 10h + mov ds, ax + mov ss, ax + mov esp, 090000h + mov byte [ds:0B8000h], 'P' + mov byte [ds:0B8001h], 1Bh + +hang: + jmp hang + +gdt_null: ; the first element is the so called null descriptor + dd 0 ; it is not referenced by the processor + dd 0 + +gdt_code: ; usually we want at least one segment descriptor for code + dw 0ffffh ; segment length bits 0-15 + dw 0 ; segment base byte 0,1 + db 0 ; segment base byte 2 + db 10011010b ; access rights + db 11001111b ; bit 7-4: 4 flag bits: granularity, default operation + ; size bit, 2 bits available for OS + ; bit 3-0: segment length bits 16-19 + db 0 ; segment base byte 3 + +gdt_data: ; usually we want at least one segment descriptor for data + dw 0ffffh + dw 0 + db 0 + db 10010010b + db 11001111b + db 0 +gdt_end: + +gdtr: + dw gdt_end - gdt_null - 1 ; 2 bytes are the size of the GDT in bytes - 1 + dd gdt_null ; 4 bytes are the address of the GDT start