Compare commits
17 Commits
e636ab66ee
...
075f7ab4ca
Author | SHA1 | Date | |
---|---|---|---|
075f7ab4ca | |||
7a1c92972f | |||
9476a54f13 | |||
4cc4950eb9 | |||
db1eb39e40 | |||
|
516ee3f984 | ||
|
df400be1d9 | ||
|
3dc3724c68 | ||
|
5f70f3f3ca | ||
|
fa5f54b612 | ||
|
0f781198de | ||
|
87072d0c97 | ||
|
df7c9793bb | ||
|
953931fb31 | ||
|
c16c725a5f | ||
|
20a796c8ad | ||
|
ba73ffb8ee |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
build/
|
||||||
|
.mailmap
|
26
Makefile
26
Makefile
@ -1,9 +1,12 @@
|
|||||||
ASM=nasm
|
ASM=nasm
|
||||||
|
CC=gcc
|
||||||
|
CC16=/usr/bin/watcom/binl/wcc
|
||||||
|
LD16=/usr/bin/watcom/binl/wlink
|
||||||
|
|
||||||
SRC_DIR=src
|
SRC_DIR=src
|
||||||
BUILD_DIR=build
|
BUILD_DIR=build
|
||||||
|
|
||||||
.PHONY: all floppy_image kernel bootloader clean always
|
.PHONY: all immagine_floppy kernel bootloader clean always
|
||||||
|
|
||||||
|
|
||||||
#Immagine floppy
|
#Immagine floppy
|
||||||
@ -12,8 +15,9 @@ immagine_floppy: $(BUILD_DIR)/main_floppy.img
|
|||||||
|
|
||||||
$(BUILD_DIR)/main_floppy.img: bootloader kernel
|
$(BUILD_DIR)/main_floppy.img: bootloader kernel
|
||||||
dd if=/dev/zero of=$(BUILD_DIR)/main_floppy.img bs=512 count=2880
|
dd if=/dev/zero of=$(BUILD_DIR)/main_floppy.img bs=512 count=2880
|
||||||
mkfs.fat -F 12 -n "XanvOS" $(BUILD_DIR)/main_floppy.img
|
mkfs.fat -F 12 -n "XANVOS" $(BUILD_DIR)/main_floppy.img
|
||||||
dd if=$(BUILD_DIR)/bootloader.bin of=$(BUILD_DIR)/main_floppy.img conv=notrunc
|
dd if=$(BUILD_DIR)/stage1.bin of=$(BUILD_DIR)/main_floppy.img conv=notrunc
|
||||||
|
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/stage2.bin "::stage2.bin"
|
||||||
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin"
|
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin"
|
||||||
|
|
||||||
|
|
||||||
@ -22,15 +26,23 @@ $(BUILD_DIR)/main_floppy.img: bootloader kernel
|
|||||||
kernel: $(BUILD_DIR)/kernel.bin
|
kernel: $(BUILD_DIR)/kernel.bin
|
||||||
|
|
||||||
$(BUILD_DIR)/kernel.bin: always
|
$(BUILD_DIR)/kernel.bin: always
|
||||||
$(ASM) $(SRC_DIR)/kernel/kernel.asm -f bin -o $(BUILD_DIR)/kernel.bin
|
$(MAKE) -C $(SRC_DIR)/kernel BUILD_DIR=$(abspath $(BUILD_DIR))
|
||||||
|
|
||||||
|
|
||||||
#Bootloader
|
#Bootloader
|
||||||
|
|
||||||
bootloader: $(BUILD_DIR)/bootloader.bin
|
bootloader: stage1 stage2
|
||||||
|
|
||||||
$(BUILD_DIR)/bootloader.bin: always
|
stage1: $(BUILD_DIR)/stage1.bin
|
||||||
$(ASM) $(SRC_DIR)/bootloader/boot.asm -f bin -o $(BUILD_DIR)/bootloader.bin
|
|
||||||
|
$(BUILD_DIR)/stage1.bin: always
|
||||||
|
$(MAKE) -C $(SRC_DIR)/bootloader/stage1 BUILD_DIR=$(abspath $(BUILD_DIR))
|
||||||
|
|
||||||
|
|
||||||
|
stage2: $(BUILD_DIR)/stage2.bin
|
||||||
|
|
||||||
|
$(BUILD_DIR)/stage2.bin: always
|
||||||
|
$(MAKE) -C $(SRC_DIR)/bootloader/stage2 BUILD_DIR=$(abspath $(BUILD_DIR))
|
||||||
|
|
||||||
|
|
||||||
#Always
|
#Always
|
||||||
|
12
README.md
12
README.md
@ -1,15 +1,17 @@
|
|||||||
Hey all, Vincenzo Aleskey Brocato (VinceAle7082) here! <br>
|
Hey all, Vincenzo Aleskey Brocato (VinceAle7082) here! <br>
|
||||||
This is a little project where I try to make an OS just for fun <br>
|
This is a little project where I try to make an OS just for fun <br>
|
||||||
<br>
|
<br>
|
||||||
**What is XanvicOS?**
|
|
||||||
|
***What exacly is XanvicOS?***
|
||||||
<hr>
|
<hr>
|
||||||
XanvicOS is the name of this OS, I'll try to make an OS with a 16 and 64 bit mode (like the Windows 9x series, excluding Windows ME). <hr>
|
XanvicOS is the development name for this OS (the final name will be something like TearOS or SunShine OS), I'll try to make an OS with a 16 and 64 bit mode (like the Windows 9x series, excluding Windows ME). <hr>
|
||||||
In this OS will be possible to run natively linux executables, and there will be a source-based package manager (like Gentoo GNU/Linux's portage) <hr>
|
In this OS will be possible to run natively linux executables, and there will be a source-based package manager (like Gentoo GNU/Linux's portage) <hr>
|
||||||
<br>
|
<br>
|
||||||
**What can I do to help you?**
|
|
||||||
|
***How can I contribute to this project?***
|
||||||
<hr>
|
<hr>
|
||||||
You can fix issues, help me find a better name, add features to the kernel...
|
You can fix issues, help me find a better name, add features to the kernel and other things, just add something to this project ;)
|
||||||
<br>
|
<br>
|
||||||
<hr>
|
<hr>
|
||||||
<br>
|
<br>
|
||||||
PS: if I wrote something wrong, sorry, English isn't my first language.
|
PS: if I wrote something wrong, sorry, English isn't my first language.
|
||||||
|
28
docs/en/index.html
Normal file
28
docs/en/index.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<head>
|
||||||
|
<title>Xanvico</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>h1 {text-align: center;}</style>
|
||||||
|
<h1>Xanvico</h1>
|
||||||
|
<hr>
|
||||||
|
<a href="https://vinceale7082.github.io/XanvicOS/en/index.html"><U>Home</U></a> | <a href="https://vinceale7082.github.io/XanvicOS/en/xanvico/xanvico.html"><U>XanvicOS</U></a>
|
||||||
|
<hr>
|
||||||
|
<h2>Welcome to the Xanvico's archive!</h2>
|
||||||
|
<h3>Why does this website exist?</h3>
|
||||||
|
I created this website because I wanted to.
|
||||||
|
<h3>What you'll be using this website for?</h3>
|
||||||
|
I'll use this website the things that I do.
|
||||||
|
<h3>What exacly is Xanvico and XanvicOS?</h3>
|
||||||
|
Xanvico is the name of our frind group.
|
||||||
|
<br>
|
||||||
|
XanvicOS is the operative system that we're working and I'll not use an existing kernel like the Linux or BSD ones because I hate my life.
|
||||||
|
<br>
|
||||||
|
The operative system will be a DOS like system that supports the x86_64 architecture that will execute 16,32 and 64 bit executable and the GNU/Linux (and if I can do it) and Windows ones.
|
||||||
|
<br>
|
||||||
|
In the future we'll think about developing source based package manager (like Gentoo's portage).
|
||||||
|
<br>
|
||||||
|
A GUI will be added in future (I hope it'll be a tiling window manager with some additions like an app menu, a bar like the waybar and others).
|
||||||
|
<br>
|
||||||
|
<hr>
|
||||||
|
<p>~Vincenzo Aleksey Brocato </p>
|
||||||
|
</body>
|
19
docs/en/xanvico/xanvico.html
Normal file
19
docs/en/xanvico/xanvico.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<head>
|
||||||
|
<title>Xanvico</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>h1 {text-align: center;}</style>
|
||||||
|
<h1>XanvicOS</h1>
|
||||||
|
<hr>
|
||||||
|
<a href="https://vinceale7082.github.io/XanvicOS/en/index.html"><U>Home</U></a> | <a href="https://vinceale7082.github.io/XanvicOS/en/xanvico/xanvico.html"><U>Xanvico</U></a>
|
||||||
|
<hr>
|
||||||
|
<h3>What are Xanvico and XanvicOS?</h3>
|
||||||
|
I already explained it in the home page, I don't wanna write it again.
|
||||||
|
<h3>How is going on the XanvicOS development?</h3>
|
||||||
|
Good
|
||||||
|
<h3>How will you call the XanvicOS's kernel?</h3>
|
||||||
|
Idk, help me.
|
||||||
|
<br>
|
||||||
|
<hr>
|
||||||
|
<p>~Vincenzo Aleksey Brocato</p>
|
||||||
|
</body>
|
13
docs/index.html
Normal file
13
docs/index.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<head>
|
||||||
|
<title>XanvicOS Website</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
<U>
|
||||||
|
Welcome to XanvicOS Website
|
||||||
|
</U>
|
||||||
|
</h1>
|
||||||
|
<hr>
|
||||||
|
<a href="https://vinceale7082.github.io/XanvicOS/it/index.html">Italian Website</a> | <a href="https://vinceale7082.github.io/XanvicOS/en/index.html">Engish Website</a>
|
||||||
|
<hr>
|
||||||
|
</body>
|
28
docs/it/index.html
Normal file
28
docs/it/index.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<head>
|
||||||
|
<title>Xanvico</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>h1 {text-align: center;}</style>
|
||||||
|
<h1>Xanvico</h1>
|
||||||
|
<hr>
|
||||||
|
<a href="https://vinceale7082.github.io/XanvicOS/it/index.html"><U>Home</U></a> | <a href="https://vinceale7082.github.io/XanvicOS/it/xanvico/xanvico.html"><U>XanvicOS</U></a>
|
||||||
|
<hr>
|
||||||
|
<h2>Benvenuto nell'archivio di Xanvico!</h2>
|
||||||
|
<h3>Perché questo sito esiste?</h3>
|
||||||
|
Ho creato questo sito perché avevo voglia di farlo.
|
||||||
|
<h3>A cosa serve questo sito?</h3>
|
||||||
|
Questo sito serve a pubblicare le peggio cavolate che faccio.
|
||||||
|
<h3>Cosa sono Xanvico e XanvicOS</h3>
|
||||||
|
Xanvico è il nome del gruppo di amici composto da me e altri 2 ragazzi.
|
||||||
|
<br>
|
||||||
|
XanvicOS è il sistema operativo su cui ̷s̷̷t̷̷i̷a̷̷m̷̷o̷ sto lavorando e non userò un kernel già esistente come quello linux o quello BSD perché odio la vita.
|
||||||
|
<br>
|
||||||
|
Il sistema operativo dovrebbe essere un sistema simile al DOS che supporta l'archittetura x86_64, ma che può avviarsi in una "DOS mode" (come Windows 9x, escludendo Windows ME) che in futuro sarà capace di eseguire nativamente gli eseguibili 16,32 e 64 bit e quelli di GNU/Linux e (se ci riesco) anche di Windows.
|
||||||
|
<br>
|
||||||
|
In futuro si penserà anche allo sviluppo di un package manager dove si può compilare tutti i pacchetti da sorgente (come Portage, package manager di Gentoo GNU/Linux, distro che sto attualmente usando) ma in futuro sarà anche possibile installare pacchetti già compilati dal sottoscritto.
|
||||||
|
<br>
|
||||||
|
Una GUI verrà aggiunta in futuro (spero che sia un tiling window manager con qualche aggiunta) e quando essa sarà stabile pubblicherò il codice sorgente su github in modo da farmi aiutare anche da altri.
|
||||||
|
<br>
|
||||||
|
<hr>
|
||||||
|
<p>~Vincenzo Aleksey Brocato</p>
|
||||||
|
</body>
|
19
docs/it/xanvico/xanvico.html
Normal file
19
docs/it/xanvico/xanvico.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<head>
|
||||||
|
<title>Xanvico</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>h1 {text-align: center;}</style>
|
||||||
|
<h1>XanvicOS</h1>
|
||||||
|
<hr>
|
||||||
|
<a href="https://vinceale7082.github.io/XanvicOS/it/index.html"><U>Home</U></a> | <a href="https://vinceale7082.github.io/XanvicOS/it/xanvico/xanvico.html"><U>XanvicOS</U></a>
|
||||||
|
<hr>
|
||||||
|
<h3>Cos'è Xanvico/XanvicOS?</h3>
|
||||||
|
L'ho già spiegato nella pagina Home, non ho voglia di scrivere.
|
||||||
|
<h3>A che punto XanvicOS?</h3>
|
||||||
|
Si avvia in nella modalità 16 bit grazie ad un floppy formattato con FAT12 da cui il bootloader carica il kernel che fa apparire sullo schermo il messaggio di Hello World.
|
||||||
|
<h3>Come chiamerai il kernel di XanvicOS (ad esempio Linus Torvalds ha chiamato il suo Linux)?</h3>
|
||||||
|
Non ne ho la più pallida idea. Aiutami!
|
||||||
|
<br>
|
||||||
|
<hr>
|
||||||
|
<p>~Vincenzo Aleksey Brocato</p>
|
||||||
|
</body>
|
15
src/bootloader/stage1/Makefile
Normal file
15
src/bootloader/stage1/Makefile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
BUILD_DIR?=build/
|
||||||
|
ASM?=nasm
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: stage1
|
||||||
|
|
||||||
|
stage1: $(BUILD_DIR)/stage1.bin
|
||||||
|
|
||||||
|
$(BUILD_DIR)/stage1.bin:
|
||||||
|
$(ASM) stage1.asm -f bin -o $(BUILD_DIR)/stage1.bin
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BUILD_DIR)/stage1.bin
|
@ -101,28 +101,28 @@ start:
|
|||||||
xor bx, bx
|
xor bx, bx
|
||||||
mov di, buffer
|
mov di, buffer
|
||||||
|
|
||||||
.cerca_kernel:
|
.cerca_stage2:
|
||||||
mov si, file_kernel_bin
|
mov si, file_stage2_bin
|
||||||
mov cx, 11
|
mov cx, 11
|
||||||
push di
|
push di
|
||||||
repe cmpsb
|
repe cmpsb
|
||||||
pop di
|
pop di
|
||||||
je .kernel_trovato
|
je .stage2_trovato
|
||||||
|
|
||||||
add di, 32
|
add di, 32
|
||||||
inc bx
|
inc bx
|
||||||
cmp bx, [dir_entries_count]
|
cmp bx, [dir_entries_count]
|
||||||
jl .cerca_kernel
|
jl .cerca_stage2
|
||||||
|
|
||||||
;Kernel non trovato
|
;Kernel non trovato
|
||||||
jmp errore_kernel_non_trovato
|
jmp errore_stage2_non_trovato
|
||||||
|
|
||||||
.kernel_trovato:
|
.stage2_trovato:
|
||||||
mov si, msg_kernel_trovato
|
mov si, msg_stage2_trovato
|
||||||
call puts
|
call puts
|
||||||
|
|
||||||
mov ax, [di + 26]
|
mov ax, [di + 26]
|
||||||
mov [kernel_cluster], ax
|
mov [stage2_cluster], ax
|
||||||
|
|
||||||
mov ax, [reserved_sectors]
|
mov ax, [reserved_sectors]
|
||||||
mov bx, buffer
|
mov bx, buffer
|
||||||
@ -130,12 +130,12 @@ start:
|
|||||||
mov dl, [ebr_drive_number]
|
mov dl, [ebr_drive_number]
|
||||||
call lettura_disco
|
call lettura_disco
|
||||||
|
|
||||||
mov bx, KERNEL_LOAD_SEGMENT
|
mov bx, STAGE2_LOAD_SEGMENT
|
||||||
mov es, bx
|
mov es, bx
|
||||||
mov bx, KERNEL_LOAD_OFFSET
|
mov bx, STAGE2_LOAD_OFFSET
|
||||||
|
|
||||||
.carica_kernel:
|
.carica_stage2:
|
||||||
mov ax, [kernel_cluster]
|
mov ax, [stage2_cluster]
|
||||||
add ax, 31
|
add ax, 31
|
||||||
|
|
||||||
mov cl, 1
|
mov cl, 1
|
||||||
@ -144,7 +144,7 @@ start:
|
|||||||
|
|
||||||
add bx, [bytes_per_sector]
|
add bx, [bytes_per_sector]
|
||||||
|
|
||||||
mov ax, [kernel_cluster]
|
mov ax, [stage2_cluster]
|
||||||
mov cx, 3
|
mov cx, 3
|
||||||
mul cx
|
mul cx
|
||||||
mov cx, 2
|
mov cx, 2
|
||||||
@ -168,18 +168,17 @@ start:
|
|||||||
cmp ax, 0x0FF8
|
cmp ax, 0x0FF8
|
||||||
jae .fine_lettura
|
jae .fine_lettura
|
||||||
|
|
||||||
mov [kernel_cluster], ax
|
mov [stage2_cluster], ax
|
||||||
jmp .carica_kernel
|
jmp .carica_stage2
|
||||||
|
|
||||||
.fine_lettura:
|
.fine_lettura:
|
||||||
mov dl, [ebr_drive_number]
|
mov dl, [ebr_drive_number]
|
||||||
|
|
||||||
mov ax, KERNEL_LOAD_SEGMENT
|
mov ax, STAGE2_LOAD_SEGMENT
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
|
|
||||||
jmp KERNEL_LOAD_SEGMENT:KERNEL_LOAD_OFFSET
|
jmp STAGE2_LOAD_SEGMENT:STAGE2_LOAD_OFFSET
|
||||||
jmp premi_per_riavviare
|
|
||||||
|
|
||||||
;Trasforma/Converte un indirizzo LBA in uno CHS
|
;Trasforma/Converte un indirizzo LBA in uno CHS
|
||||||
|
|
||||||
@ -280,11 +279,11 @@ msg_caricamento:
|
|||||||
msg_errore_lettura:
|
msg_errore_lettura:
|
||||||
db 'Errore del disco', ENDL, 0
|
db 'Errore del disco', ENDL, 0
|
||||||
|
|
||||||
msg_kernel_non_trovato:
|
msg_stage2_non_trovato:
|
||||||
db 'Kernel non trovato', ENDL, 0
|
db 'Stage 2 non trovato', ENDL, 0
|
||||||
|
|
||||||
msg_kernel_trovato:
|
msg_stage2_trovato:
|
||||||
db 'Kernel trovato', ENDL, 0
|
db 'Stage 2 trovato', ENDL, 0
|
||||||
|
|
||||||
;Errori
|
;Errori
|
||||||
|
|
||||||
@ -293,17 +292,17 @@ errore_floppy:
|
|||||||
call puts
|
call puts
|
||||||
jmp premi_per_riavviare
|
jmp premi_per_riavviare
|
||||||
|
|
||||||
errore_kernel_non_trovato:
|
errore_stage2_non_trovato:
|
||||||
mov si, msg_kernel_non_trovato
|
mov si, msg_stage2_non_trovato
|
||||||
call puts
|
call puts
|
||||||
jmp premi_per_riavviare
|
jmp premi_per_riavviare
|
||||||
|
|
||||||
;Variabili
|
;Variabili
|
||||||
|
|
||||||
file_kernel_bin: db 'KERNEL BIN'
|
file_stage2_bin: db 'STAGE2 BIN'
|
||||||
kernel_cluster: dw 0
|
stage2_cluster: dw 0
|
||||||
KERNEL_LOAD_SEGMENT equ 0x2000
|
STAGE2_LOAD_SEGMENT equ 0x2000
|
||||||
KERNEL_LOAD_OFFSET equ 0
|
STAGE2_LOAD_OFFSET equ 0
|
||||||
|
|
||||||
;Cose che non so dove mettere
|
;Cose che non so dove mettere
|
||||||
|
|
34
src/bootloader/stage2/Makefile
Normal file
34
src/bootloader/stage2/Makefile
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
BUILD_DIR?=build/
|
||||||
|
ASM?=nasm
|
||||||
|
ASMFLAGS?=-f obj
|
||||||
|
CC?=gcc
|
||||||
|
CC16?=/usr/bin/watcom/binl/wcc
|
||||||
|
CFLAGS16?= -4 -d3 -s -wx -ms -zl -zq
|
||||||
|
LD16?=/usr/bin/watcom/binl/wlink
|
||||||
|
|
||||||
|
SOURCES_C=$(wildcard *.c)
|
||||||
|
SOURCES_ASM=$(wildcard *.asm)
|
||||||
|
OBJECTS_C=$(patsubst %.c, $(BUILD_DIR)/stage2/c/%.obj, $(SOURCES_C))
|
||||||
|
OBJECTS_ASM=$(patsubst %.asm, $(BUILD_DIR)/stage2/asm/%.obj, $(SOURCES_ASM))
|
||||||
|
|
||||||
|
.PHONY: all clean always
|
||||||
|
|
||||||
|
all: stage2
|
||||||
|
|
||||||
|
stage2: $(BUILD_DIR)/stage2.bin
|
||||||
|
|
||||||
|
$(BUILD_DIR)/stage2.bin: $(OBJECTS_ASM) $(OBJECTS_C)
|
||||||
|
$(LD16) NAME $(BUILD_DIR)/stage2.bin FILE \{ $(OBJECTS_ASM) $(OBJECTS_C) \} OPTION MAP=$(BUILD_DIR)/stage2.map @linker.lnk
|
||||||
|
|
||||||
|
$(BUILD_DIR)/stage2/c/%.obj: %.c always
|
||||||
|
$(CC16) $(CFLAGS16) -fo=$@ $<
|
||||||
|
|
||||||
|
$(BUILD_DIR)/stage2/asm/%.obj: %.asm always
|
||||||
|
$(ASM) $(ASMFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
always:
|
||||||
|
mkdir -p $(BUILD_DIR)/stage2/c
|
||||||
|
mkdir -p $(BUILD_DIR)/stage2/asm
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BUILD_DIR)/stage2.bin
|
12
src/bootloader/stage2/linker.lnk
Normal file
12
src/bootloader/stage2/linker.lnk
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FORMAT RAW BIN
|
||||||
|
OPTION QUIET,
|
||||||
|
NODEFAULTLIBS,
|
||||||
|
START=entry,
|
||||||
|
VERBOSE,
|
||||||
|
OFFSET=0,
|
||||||
|
STACK=0X200
|
||||||
|
ORDER
|
||||||
|
CLNAME CODE
|
||||||
|
SEGMENT _ENTRY
|
||||||
|
SEGMENT _TEXT
|
||||||
|
CLNAME DATA
|
8
src/bootloader/stage2/main.c
Normal file
8
src/bootloader/stage2/main.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include "stdint.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
void _cdecl cstart_(uint16_t bootDrive)
|
||||||
|
{
|
||||||
|
puts("Hello World from the Stage 2 of the bootloader written in C!");
|
||||||
|
for (;;);
|
||||||
|
}
|
3
src/bootloader/stage2/main.err
Normal file
3
src/bootloader/stage2/main.err
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
stdio.h(4): Warning! W138: No newline at end of file
|
||||||
|
main.c(8): Warning! W138: No newline at end of file
|
||||||
|
main.c(4): Warning! W303: Parameter 'bootDrive' has been defined, but not referenced
|
21
src/bootloader/stage2/stage2.asm
Normal file
21
src/bootloader/stage2/stage2.asm
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
bits 16
|
||||||
|
|
||||||
|
section _ENTRY class=CODE
|
||||||
|
|
||||||
|
extern _cstart_
|
||||||
|
global entry
|
||||||
|
|
||||||
|
entry:
|
||||||
|
cli
|
||||||
|
mov ax, ds
|
||||||
|
mov ss, ax
|
||||||
|
mov sp, 0
|
||||||
|
mov bp, sp
|
||||||
|
sti
|
||||||
|
|
||||||
|
xor dh, dh
|
||||||
|
push dx
|
||||||
|
call _cstart_
|
||||||
|
|
||||||
|
cli
|
||||||
|
hlt
|
12
src/bootloader/stage2/stdint.h
Normal file
12
src/bootloader/stage2/stdint.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef signed char int8_t;
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
typedef signed short int16_t;
|
||||||
|
typedef unsigned short uint16_t;
|
||||||
|
typedef signed long int int32_t;
|
||||||
|
typedef unsigned long int uint32_t;
|
||||||
|
typedef signed long int int64_t;
|
||||||
|
typedef unsigned long int uint64_t;
|
||||||
|
|
||||||
|
|
15
src/bootloader/stage2/stdio.c
Normal file
15
src/bootloader/stage2/stdio.c
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "stdio.h"
|
||||||
|
#include "x86.h"
|
||||||
|
|
||||||
|
void putc(char c)
|
||||||
|
{
|
||||||
|
x86_Video_WriteCharTeletype(c, 0);
|
||||||
|
}
|
||||||
|
void puts(const char *str)
|
||||||
|
{
|
||||||
|
while(*str)
|
||||||
|
{
|
||||||
|
putc(*str);
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
}
|
2
src/bootloader/stage2/stdio.err
Normal file
2
src/bootloader/stage2/stdio.err
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
stdio.h(4): Warning! W138: No newline at end of file
|
||||||
|
x86.h(4): Warning! W138: No newline at end of file
|
4
src/bootloader/stage2/stdio.h
Normal file
4
src/bootloader/stage2/stdio.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
void putc(char c);
|
||||||
|
void puts(const char *str);
|
23
src/bootloader/stage2/x86.asm
Normal file
23
src/bootloader/stage2/x86.asm
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
bits 16
|
||||||
|
|
||||||
|
section _TEXT class=CODE
|
||||||
|
|
||||||
|
global _x86_Video_WriteCharTeletype
|
||||||
|
|
||||||
|
_x86_Video_WriteCharTeletype:
|
||||||
|
push bp
|
||||||
|
mov bp, sp
|
||||||
|
|
||||||
|
push bx
|
||||||
|
mov ah, 0Eh
|
||||||
|
mov al, [bp + 4]
|
||||||
|
mov bh, [bp + 6]
|
||||||
|
|
||||||
|
int 10h
|
||||||
|
|
||||||
|
pop bx
|
||||||
|
|
||||||
|
mov sp, bp
|
||||||
|
pop bp
|
||||||
|
|
||||||
|
ret
|
4
src/bootloader/stage2/x86.h
Normal file
4
src/bootloader/stage2/x86.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "stdint.h"
|
||||||
|
|
||||||
|
void _cdecl x86_Video_WriteCharTeletype(char c, uint8_t page);
|
17
src/kernel/Makefile
Normal file
17
src/kernel/Makefile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
BUILD_DIR?=build/
|
||||||
|
ASM?=nasm
|
||||||
|
CC?=gcc
|
||||||
|
CC16?=/usr/bin/watcom/binl/wcc
|
||||||
|
LD16?=/usr/bin/watcom/binl/wlink
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: kernel
|
||||||
|
|
||||||
|
kernel: $(BUILD_DIR)/kernel.bin
|
||||||
|
|
||||||
|
$(BUILD_DIR)/kernel.bin:
|
||||||
|
$(ASM) kernel.asm -f bin -o $(BUILD_DIR)/kernel.bin
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BUILD_DIR)/kernel.bin
|
Loading…
x
Reference in New Issue
Block a user