Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 214 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
214 commits
Select commit Hold shift + click to select a range
b9a3368
Setting up GitHub Classroom Feedback
github-classroom[bot] Feb 14, 2023
bbe07bc
Currently at build script
Darmodar Feb 20, 2023
a756993
Currently develop at 3.7
Darmodar Feb 22, 2023
8611498
fix: makefile
WildanGhaly Feb 22, 2023
44b42a9
add gdt
Darmodar Feb 23, 2023
3c1c962
Finished spec
Darmodar Feb 23, 2023
7075224
changes
christodharma Mar 1, 2023
1003ebf
refactor: splash
WildanGhaly Mar 1, 2023
ae81db1
fix: linker done
WildanGhaly Mar 1, 2023
1cdbbe0
splash screen in ascii (experiment)
christodharma Mar 1, 2023
fda49ad
Merge branch 'main' of https://github.com/Sister20/if2230-2023-brothe…
christodharma Mar 1, 2023
98f2528
check
WildanGhaly Mar 1, 2023
6f352d2
feat: splashh
WildanGhaly Mar 1, 2023
a6f42c8
feat: border to splash
WildanGhaly Mar 1, 2023
3de40e7
Final mls1
Darmodar Mar 2, 2023
9a9a500
feat: the setup for milestone 2
WildanGhaly Mar 17, 2023
b8424b8
feat: test
WildanGhaly Mar 23, 2023
d751585
feat: linker
WildanGhaly Mar 23, 2023
98eccd8
feat: linker idt and interrupt
WildanGhaly Mar 23, 2023
88d4dd8
not fix: idt thing
WildanGhaly Mar 23, 2023
696e683
not fix: idt gate
WildanGhaly Mar 23, 2023
b014fd2
not fix: bisa run tapi bootloop
WildanGhaly Mar 23, 2023
7f15834
not fix: masih bootloop :(
WildanGhaly Mar 25, 2023
a32c88c
Merge branch 'main' into Willy/windowsToLinux
WildanGhaly Mar 25, 2023
8a70371
Merge pull request #2 from Sister20/Willy/windowsToLinux
WildanGhaly Mar 25, 2023
8a152bf
3.1 fixed
Darmodar Mar 25, 2023
e97c967
feat: keyboard setup
WildanGhaly Mar 26, 2023
9aa0be4
not fix: keyboard on the way
WildanGhaly Mar 26, 2023
02f39ab
refactor: boolean
WildanGhaly Mar 26, 2023
b37cf7f
fix: bisa ngetik tapi kecepetan + spasi aneh
WildanGhaly Mar 26, 2023
f85c609
Merge pull request #3 from Sister20/Willy/windowsToLinux
WildanGhaly Mar 26, 2023
27a1e54
feat: 3.3 setup
WildanGhaly Mar 26, 2023
d2c7f61
fix: keyboard index
haikalardzi Mar 26, 2023
42c4d1d
fix: keyboard index
haikalardzi Mar 26, 2023
3fb454a
style: comment on qemu
WildanGhaly Mar 26, 2023
e0aa265
fix: overloading index keyboard
haikalardzi Mar 26, 2023
fea959c
fix: overloading index keyboard, issue: overread and backspace
haikalardzi Mar 26, 2023
d566e16
fix: keyboard double and backspace
WildanGhaly Mar 26, 2023
477f9d5
feat: fat32.c setup
WildanGhaly Mar 27, 2023
8629b4e
Merge branch 'Willy/windowsToLinux' of https://github.com/Sister20/if…
WildanGhaly Mar 27, 2023
b6fe5bd
Merge branch 'main' of https://github.com/Sister20/if2230-2023-brothe…
WildanGhaly Mar 27, 2023
94a0705
feat: kernel tester for FAT
WildanGhaly Mar 27, 2023
6d3c4b8
feat: setup for FAT
WildanGhaly Mar 27, 2023
830955a
Merge pull request #6 from Sister20/Willy/windowsToLinux
WildanGhaly Mar 27, 2023
72bd769
not fix: the FAT
WildanGhaly Mar 27, 2023
0e6156b
not fix: the FAT
WildanGhaly Mar 27, 2023
55c313a
fix: portio bruh
WildanGhaly Mar 27, 2023
639f2ce
Merge pull request #7 from Sister20/Progress-3.3
WildanGhaly Mar 27, 2023
c24d51f
Co-authored-by: Hidayatullah Wildan Ghaly Buchary <WildanGhaly@users.…
christodharma Mar 28, 2023
abe9879
fix: makerun
WildanGhaly Mar 27, 2023
0f3817c
fix: hasil asistensi
christodharma Mar 28, 2023
0d29ece
Adding read and write template and fix some bug
Darmodar Mar 28, 2023
f9705a9
edit write
Darmodar Mar 28, 2023
06e8b17
last commit sleep bentar
Darmodar Mar 28, 2023
b716c80
feat!(write): add write func; belum direct table
WildanGhaly Mar 29, 2023
cda718a
feat: add dir table template for write folder
WildanGhaly Mar 29, 2023
3d44d8a
repair minor mistake (dtble)
Darmodar Mar 29, 2023
bb8a6f6
edit write dirtable
Darmodar Mar 29, 2023
f40a08e
fix minor bug
Darmodar Mar 29, 2023
0d6738d
Write bismilllah final
Darmodar Mar 29, 2023
7f55586
fix: add size handling for not maximum line in file
WildanGhaly Mar 29, 2023
161fb60
fix: multiFile read; issue: merging file
WildanGhaly Mar 29, 2023
3a82b03
fixing read size bug
Darmodar Mar 29, 2023
ab95690
fix write final (maybe)
Darmodar Mar 29, 2023
91691cc
feat(kernel): add set up for kernel debugging
WildanGhaly Mar 29, 2023
a44c5d4
feat: add another debugger for kernel
WildanGhaly Mar 29, 2023
edb129c
fix: handle multiple file or folder with same name
WildanGhaly Mar 29, 2023
47e087e
feat: add another debugger for multple folder name
WildanGhaly Mar 29, 2023
7534d1b
feat: add delete test case
WildanGhaly Mar 29, 2023
34219f1
del del del
Darmodar Mar 29, 2023
93d31cd
add delete file
Darmodar Mar 29, 2023
98c4168
Delete bismillah final
Darmodar Mar 29, 2023
d54beb8
Add read directory
Darmodar Mar 30, 2023
165f49f
feat: add keyboard wait time
WildanGhaly Mar 30, 2023
d564fd5
fix: handle hold keyboard error
WildanGhaly Mar 30, 2023
2a7ba35
Ultraman Cosmos
Darmodar Mar 30, 2023
8708437
Merge branch 'main' of https://github.com/Sister20/if2230-2023-brothe…
Darmodar Mar 30, 2023
a71feb8
feat: add altF4 mechanism
WildanGhaly Mar 30, 2023
9c0952c
feat: add capslock setup mechanism
WildanGhaly Mar 30, 2023
26db538
feat: add up left down right mechanism
WildanGhaly Mar 30, 2023
c202271
feat: add capslock keyboard mechanism
WildanGhaly Mar 30, 2023
7840428
feat: add hold shift and release shift mechanism
WildanGhaly Mar 30, 2023
fc49a34
feat: add Home and End keyboard mechanism
WildanGhaly Mar 30, 2023
0643209
feat: add Alt keyboard mechanism
WildanGhaly Mar 30, 2023
ad4ca1a
feat: add Ctrl keyboard mechanism
WildanGhaly Mar 30, 2023
c927d1c
Merge branch 'main' of https://github.com/Sister20/if2230-2023-brothe…
WildanGhaly Mar 30, 2023
a836167
cosmosss
Darmodar Mar 30, 2023
d8aa2ec
feat: add folder structure
WildanGhaly Mar 30, 2023
fdcc0e3
feat: add restoreSplashScreen as Ctrl + Enter
WildanGhaly Mar 30, 2023
95eb44b
Merge branch 'main' of https://github.com/Sister20/if2230-2023-brothe…
WildanGhaly Mar 30, 2023
26014ca
chizuru is the best waifu undebateable
Darmodar Mar 30, 2023
fdf0588
feat: add set up for kernel.h (TODO struct)
WildanGhaly Mar 31, 2023
b2a4bfc
Merge branch 'main' of https://github.com/Sister20/if2230-2023-brothe…
WildanGhaly Mar 31, 2023
984a77a
feat: add paging setup (TODO alloc page direc entr
WildanGhaly Mar 31, 2023
52acf6d
feat: add update for kernel_loader from kit
WildanGhaly Mar 31, 2023
fda0914
feat: add update for linker from guidebook
WildanGhaly Mar 31, 2023
c27a544
fix: change kernel_loader.o(.bss)
WildanGhaly Mar 31, 2023
5267e29
fix: change MEMORY_FRAMEBUFFER
WildanGhaly Mar 31, 2023
3e97222
feat!: ALL struct implement needed for paging
WildanGhaly Mar 31, 2023
f06ed64
feat: implement allocate_supf; how cek bener salh?
WildanGhaly Mar 31, 2023
9ad3226
fix: PageDirectory
WildanGhaly Apr 1, 2023
4f7ce44
feat: add kernel for 3.1 3.2 TODO: grub in qemu
WildanGhaly Apr 1, 2023
99aacd9
feat: add inserter setup for 3.2
WildanGhaly Apr 1, 2023
721fa23
feat: add user,insert shell makefile (TODO insert)
WildanGhaly Apr 1, 2023
1a6fb9b
feat: add new synced GDT;
WildanGhaly Apr 1, 2023
5740a22
feat: add kernel-loader setup for milestone 3
WildanGhaly Apr 1, 2023
c62465f
feat: add new setup for milestone 3.3 syscall
WildanGhaly Apr 1, 2023
4915ed5
feat: add new user-linker.ld
WildanGhaly Apr 1, 2023
2ca70bd
feat: add user-shell to test program
WildanGhaly Apr 1, 2023
a74c885
feat: add new define in gdt.h
WildanGhaly Apr 1, 2023
9fbe75a
feat: add struct TSSEntry
WildanGhaly Apr 1, 2023
006691b
feat: add new kernel_loader.h setup
WildanGhaly Apr 1, 2023
f37132d
feat: add new UNUSED user-entry.s
WildanGhaly Apr 1, 2023
b930626
Merge pull request #8 from Sister20/Willy/User-Mode
WildanGhaly Apr 2, 2023
2c8d024
fix: change PageDirectoryEntry struct
WildanGhaly Apr 3, 2023
1b3062b
fix: change the new main_interrupt_handler
WildanGhaly Apr 3, 2023
9913542
fix: modify kernel_loader.s
WildanGhaly Apr 3, 2023
6525c82
feat: add GDT User Code Descriptor and User Data D
WildanGhaly Apr 3, 2023
b267534
style: activate debugger
WildanGhaly Apr 3, 2023
4700767
fix: unfinished allocate_singl_ HELP BOOTLOOP T_T
WildanGhaly Apr 3, 2023
adad07a
style: add define PAGE_FAULT
WildanGhaly Apr 3, 2023
7d51ed1
Merge pull request #9 from Sister20/Willy/User-Mode
WildanGhaly Apr 3, 2023
0ec4e07
fix: update modified time and disable create fat32
WildanGhaly Apr 3, 2023
50f569d
fix: interrupt.c, update sso in TSSEntry
WildanGhaly Apr 3, 2023
8810f81
fix: paging.c update allocate_single_user_page_frm
WildanGhaly Apr 3, 2023
ace1d70
fix: kernel.c update kernel for debugging
WildanGhaly Apr 3, 2023
e606983
fix: fat32.h update modified_time
WildanGhaly Apr 3, 2023
467d806
Merge pull request #10 from Sister20/Asistensi
WildanGhaly Apr 3, 2023
7f1baad
fix: insert-shell makefile; style: inserter makefi
WildanGhaly Apr 4, 2023
a5d6cce
feat: add external-inserter default
WildanGhaly Apr 4, 2023
c601ebb
fix: move user-shell to external
WildanGhaly Apr 4, 2023
9730b47
Merge pull request #11 from Sister20/Willy/User-Fix
WildanGhaly Apr 4, 2023
50f35ee
fix: disable time in fat32.c
WildanGhaly Apr 4, 2023
41b381c
fix: disable run portio in inserter makefile
WildanGhaly Apr 4, 2023
6b72e52
style: add minor set up for shell in interrupt.c
WildanGhaly Apr 4, 2023
fe85fbe
style: update kernel to default milstone 3 setting
WildanGhaly Apr 4, 2023
45ae075
feat!: Edit initialize_idt() priv_lvl 0x3
WildanGhaly Apr 4, 2023
fd86e77
feat: add implementation for puts
WildanGhaly Apr 4, 2023
658d758
style: disable page fault (???)
WildanGhaly Apr 5, 2023
06e553d
feat: update user-shell.c for testing syscall
WildanGhaly Apr 5, 2023
dedfd08
refactor: change function name update_pdt
WildanGhaly Apr 5, 2023
d6085fa
Merge pull request #12 from Sister20/Willy/User-Fix
WildanGhaly Apr 5, 2023
7b01205
feat: add ctrl + shift + esc mechanism in keyboard
WildanGhaly Apr 7, 2023
c0300f1
feat: add Ctrl + Alt + Backspace to reset
WildanGhaly Apr 7, 2023
66821e0
fix: update for loop in keyboard to save memory
WildanGhaly Apr 7, 2023
6f01686
Aku dah stuck gatahu mau ngapain ges .-. bantuin ples
WildanGhaly Apr 7, 2023
f907a5f
fix: fix write bug for small file size number
WildanGhaly Apr 8, 2023
f057250
fix: handle bug when req buf size < 32
WildanGhaly Apr 8, 2023
96e55e9
idk sudah benar or not, ini ngefix bug if req_buf_size write < 2048 o…
WildanGhaly Apr 8, 2023
e562e9c
feat: update launch.json and makefile (user-shell)
WildanGhaly Apr 8, 2023
5fce749
Aku bingung mau ngapain :(
WildanGhaly Apr 8, 2023
cc34151
fix: fix error read in fat32
WildanGhaly Apr 9, 2023
03d36b4
Read tadinya gagal karena if else harusnya if saja
WildanGhaly Apr 9, 2023
18cf06c
fix: write, temp tadinya gadiisi jadi ada fs sign
WildanGhaly Apr 9, 2023
b8d977b
Merge pull request #17 from Sister20/Wiilly/CRUD
WildanGhaly Apr 9, 2023
c506036
Pull from main to my CRUD branch
WildanGhaly Apr 9, 2023
438a85f
fix: Keyboard Error
WildanGhaly Apr 9, 2023
dd53bb4
feat: add set up for shell
WildanGhaly Apr 9, 2023
882e286
feat: add command reader input
WildanGhaly Apr 9, 2023
1243ff4
style: easier method to run
WildanGhaly Apr 9, 2023
66b8cc4
feat: add implement for ls
WildanGhaly Apr 9, 2023
e7850ec
style: add debugger for shell
WildanGhaly Apr 9, 2023
4485541
Merge pull request #19 from Sister20/Willy/Shell-Implement
WildanGhaly Apr 9, 2023
931c1fb
feat: add mkdir implement
WildanGhaly Apr 9, 2023
ed4bdd7
feat: add cp implement
WildanGhaly Apr 9, 2023
405978f
Merge pull request #20 from Sister20/Willy/Shell-Implement
WildanGhaly Apr 9, 2023
6588572
feat: add rm implement
WildanGhaly Apr 9, 2023
c80812a
feat: add cat implement
WildanGhaly Apr 9, 2023
30af377
Merge pull request #21 from Sister20/Willy/Shell-Implement
WildanGhaly Apr 9, 2023
858a39f
feat: add directorystack header
WildanGhaly Apr 9, 2023
3234a06
feat: add implementation of directorystack.h
WildanGhaly Apr 9, 2023
5626d4c
feat: add directorystack tester
WildanGhaly Apr 9, 2023
8b23387
Merge pull request #22 from Sister20/Willy/Shell-Implement
WildanGhaly Apr 9, 2023
f57e20d
feat: add cd implement
WildanGhaly Apr 10, 2023
478209b
test: add more test case
WildanGhaly Apr 10, 2023
5f966f6
feat: add stack for current directory
WildanGhaly Apr 10, 2023
37fe192
feat: add currentdirectorystack implement
WildanGhaly Apr 10, 2023
dd0cf5f
feat: update cd implement
WildanGhaly Apr 10, 2023
dac6623
Merge pull request #23 from Sister20/Willy/Shell-Implement
WildanGhaly Apr 10, 2023
73b3e94
feat: add mv implement
WildanGhaly Apr 10, 2023
932c1ff
feat: add mv file implement
WildanGhaly Apr 10, 2023
862c46b
Merge pull request #24 from Sister20/Willy/Shell-Implement
WildanGhaly Apr 10, 2023
a529957
fix: keyboard error
WildanGhaly Apr 10, 2023
acfb4bf
test: add test case
WildanGhaly Apr 10, 2023
bb88226
feat: add relative path mechanism for cd
WildanGhaly Apr 10, 2023
f228957
Merge pull request #25 from Sister20/Willy/Shell-Implement
WildanGhaly Apr 10, 2023
f53c876
feat: add new keyboard isr (#27)
WildanGhaly Apr 28, 2023
77cc77a
Willy/shell implement (#28)
WildanGhaly Apr 28, 2023
36a6e35
feat: moving shell imlement to user-shell
WildanGhaly Apr 28, 2023
589bd86
feat: move mkdir
WildanGhaly Apr 28, 2023
f788f6b
feat: move cat to user
WildanGhaly Apr 28, 2023
63f52e8
feat: move cp to user
WildanGhaly Apr 28, 2023
b0957ff
feat: move rm to user
WildanGhaly Apr 28, 2023
681cb6f
feat: move mv to user
WildanGhaly Apr 28, 2023
0116d53
Merge pull request #29 from Sister20/MoveUser
WildanGhaly Apr 28, 2023
f271fd9
feat: add cwd
WildanGhaly Apr 28, 2023
63d383a
Merge pull request #30 from Sister20/MoveUser
WildanGhaly Apr 28, 2023
66f0a12
feat: add whereis template
Darmodar Apr 28, 2023
7f520f8
Merge branch 'main' of https://github.com/Sister20/if2230-2023-brothe…
Darmodar Apr 28, 2023
b99c3a7
feat: add whereis logic
WildanGhaly Apr 28, 2023
2a6f057
update kernel
WildanGhaly Apr 28, 2023
1fef279
fix: bug on cd
WildanGhaly Apr 29, 2023
dcfbbce
feat: add ls varians
WildanGhaly Apr 29, 2023
c348b49
fix: no enter bug in cat
WildanGhaly Apr 29, 2023
338cc52
fix: bug on cp
WildanGhaly Apr 29, 2023
70b05ef
fix: bug on rename
WildanGhaly Apr 29, 2023
a563e35
save mv state, some of bug is fixed but not all
WildanGhaly Apr 29, 2023
4744581
Merge pull request #31 from Sister20/FixingError
WildanGhaly Apr 29, 2023
49f6318
mv can now only renaming
WildanGhaly Apr 29, 2023
abd583d
update mv, now can step down
WildanGhaly Apr 29, 2023
971181d
update mv and fixed the bug
WildanGhaly Apr 29, 2023
e292325
Merge pull request #32 from Sister20/FixingError
WildanGhaly Apr 29, 2023
89cdd88
feat: add clls
WildanGhaly Apr 29, 2023
be5775d
Merge pull request #33 from Sister20/FixingError
WildanGhaly Apr 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@
"text": "symbol-file kernel",
"description": "Get kernel symbols"
},
{
"text": "add-symbol-file shell_elf",
"description": "Get shell symbols"
},
{
"text": "set output-radix 16",
"description": "Use hexadecimal output"
}
],
],
"avoidWindowsConsoleRedirection": true
},
]
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"debug.onTaskErrors": "debugAnyway",
"files.associations": {
"fat32.h": "c",
"portio.h": "c"
},
}
3 changes: 2 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"type": "shell",
"label": "Launch QEMU",
"command": "echo Starting QEMU&qemu-system-i386 -s -S -cdrom os2023.iso",
"command": "echo Starting QEMU&qemu-system-i386 -s -S -drive file=storage.bin,format=raw,if=ide,index=0,media=disk -cdrom OS2023.iso",
"isBackground": true,
"dependsOn": "Build OS",
"options": {
Expand All @@ -45,6 +45,7 @@
"type": "shell",
"label": "Exit QEMU",
"command": "pkill -f qemu || test $? -eq 1"

}
],
}
74 changes: 55 additions & 19 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,78 @@
# Compiler & linker
ASM = nasm
LIN = ld
CC = gcc
ASM = nasm
LIN = ld
CC = gcc
ISO = genisoimage

# Directory
SOURCE_FOLDER = src
OUTPUT_FOLDER = bin
ISO_NAME = os2023
ISO_NAME = OS2023

# Flags
WARNING_CFLAG = -Wall -Wextra -Werror
DEBUG_CFLAG = -ffreestanding -fshort-wchar -g
STRIP_CFLAG = -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs
CFLAGS = $(DEBUG_CFLAG) $(WARNING_CFLAG) $(STRIP_CFLAG) -m32 -c -I$(SOURCE_FOLDER)
AFLAGS = -f elf32 -g -F dwarf
LFLAGS = -T $(SOURCE_FOLDER)/linker.ld -melf_i386
DEBUG_CFLAG = -ffreestanding -fshort-wchar -g
STRIP_CFLAG = -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs
CFLAGS = $(DEBUG_CFLAG) $(WARNING_CFLAG) $(STRIP_CFLAG) -m32 -c -I$(SOURCE_FOLDER)
AFLAGS = -f elf32 -g -F dwarf
LFLAGS = -T $(SOURCE_FOLDER)/linker.ld -melf_i386
IFLAGS = -R -b boot/grub/grub1 -no-emul-boot -boot-load-size 4 -A os -input-charset utf8 -quiet -boot-info-table
DISK_NAME = storage


run: all
@qemu-system-i386 -s -S -cdrom $(OUTPUT_FOLDER)/$(ISO_NAME).iso
@qemu-system-i386 -s -drive file=bin/storage.bin,format=raw,if=ide,index=0,media=disk -cdrom $(OUTPUT_FOLDER)/$(ISO_NAME).iso

disk:
@qemu-img create -f raw $(OUTPUT_FOLDER)/$(DISK_NAME).bin 4M

all: build

build: iso

clean:
rm -rf *.o *.iso $(OUTPUT_FOLDER)/kernel



kernel:
@$(ASM) $(AFLAGS) $(SOURCE_FOLDER)/kernel_loader.s -o $(OUTPUT_FOLDER)/kernel_loader.o
# TODO: Compile C file with CFLAGS
@$(ASM) $(AFLAGS) $(SOURCE_FOLDER)/intsetup.s -o $(OUTPUT_FOLDER)/intsetup.o
$(foreach file, $(wildcard $(SOURCE_FOLDER)/*.c), $(CC) $(CFLAGS) $(file) -o $(OUTPUT_FOLDER)/$(notdir $(file:.c=.o));)
@$(LIN) $(LFLAGS) bin/*.o -o $(OUTPUT_FOLDER)/kernel
@echo Linking object files and generate elf32...
@rm -f *.o
@rm -f bin/*.o


iso: kernel
@mkdir -p $(OUTPUT_FOLDER)/iso/boot/grub
@cp $(OUTPUT_FOLDER)/kernel $(OUTPUT_FOLDER)/iso/boot/
@cp other/grub1 $(OUTPUT_FOLDER)/iso/boot/grub/
@cp $(SOURCE_FOLDER)/menu.lst $(OUTPUT_FOLDER)/iso/boot/grub/
# TODO: Create ISO image
@cp $(OUTPUT_FOLDER)/kernel $(OUTPUT_FOLDER)/iso/boot/
@cp other/grub1 $(OUTPUT_FOLDER)/iso/boot/grub/
@cp $(SOURCE_FOLDER)/menu.lst $(OUTPUT_FOLDER)/iso/boot/grub/
@echo Creating ISO image...
@$(ISO) $(IFLAGS) -o $(OUTPUT_FOLDER)/$(ISO_NAME).iso $(OUTPUT_FOLDER)/iso
@rm -r $(OUTPUT_FOLDER)/iso/

inserter:
@$(CC) -Wno-builtin-declaration-mismatch \
$(SOURCE_FOLDER)/stdmem.c \
$(SOURCE_FOLDER)/fat32.c \
$(SOURCE_FOLDER)/external/external-inserter.c \
-o $(OUTPUT_FOLDER)/inserter

user-shell:
@$(ASM) $(AFLAGS) $(SOURCE_FOLDER)/user-entry.s -o user-entry.o
@$(CC) $(CFLAGS) -fno-pie $(SOURCE_FOLDER)/external/user-shell.c -o user-shell.o
@$(LIN) -T $(SOURCE_FOLDER)/user-linker.ld -melf_i386 \
user-entry.o user-shell.o -o $(OUTPUT_FOLDER)/shell
@echo Linking object shell object files and generate flat binary...
@$(LIN) -T $(SOURCE_FOLDER)/user-linker.ld -melf_i386 --oformat=elf32-i386\
user-entry.o user-shell.o -o $(OUTPUT_FOLDER)/shell_elf
@echo Linking object shell object files and generate ELF32 for debugging...
@size --target=binary bin/shell
@rm -f *.o

insert-shell: inserter user-shell
@echo Inserting shell into root directory...
@cd $(OUTPUT_FOLDER); ./inserter shell 2 $(DISK_NAME).bin

ds: disk insert-shell

dsr: ds run
Binary file modified other/grub1
Binary file not shown.
7 changes: 7 additions & 0 deletions src/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
5 changes: 5 additions & 0 deletions src/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"kernel_loader.h": "c"
}
}
28 changes: 28 additions & 0 deletions src/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc-9 build active file",
"command": "/usr/bin/gcc-9",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
59 changes: 59 additions & 0 deletions src/currentdirectorystack.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#include "lib-header/currentdirectorystack.h"

void init_current_dir_stack(struct CURRENT_DIR_STACK *cds){
cds->top = 0;
cds->cd_stack[0] = 2;
cds->cd_stack_name[0] = "root";
}

void push_current_dir(struct CURRENT_DIR_STACK * cds, uint8_t dir, char* dir_name){
cds->top++;
cds->cd_stack[cds->top] = dir;
cds->cd_stack_name[cds->top] = dir_name;
}

uint8_t pop_current_dir(struct CURRENT_DIR_STACK * cds){
int dir = cds->cd_stack[cds->top];
cds->top--;
return dir;
}

char * get_top_current_dir_name(struct CURRENT_DIR_STACK * cds){
return cds->cd_stack_name[cds->top];
}

uint8_t get_top_current_dir(struct CURRENT_DIR_STACK * cds){
return cds->cd_stack[cds->top];
}

void reverse_current_dir(struct CURRENT_DIR_STACK * cds){
int i = 0;
int j = cds->top;
while (i < j){
int temp = cds->cd_stack[i];
cds->cd_stack[i] = cds->cd_stack[j];
cds->cd_stack[j] = temp;
i++;
j--;
}
}

char * convert_to_paths(struct CURRENT_DIR_STACK * cds){
int i = 1;
int j = 0;
char temp[255];
char * path = temp;
while (i <= cds->top){
path[j] = '/';
j++;
int k = 0;
while (cds->cd_stack_name[i][k] != '\0'){
path[j] = cds->cd_stack_name[i][k];
j++;
k++;
}
i++;
}
path[j] = '\0';
return path;
}
68 changes: 68 additions & 0 deletions src/directorystack.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include "lib-header/directorystack.h"
#include "lib-header/stdtype.h"
#include "lib-header/stdmem.h"

void init_dir_stack(struct DIR_STACK *stack) {
stack->top = -1;
}

void push_dir(struct DIR_STACK * ds, char *path){
ds->top++;
memcpy(ds->stack[ds->top].path, path, 255);
}

char * pop_dir(struct DIR_STACK * ds){
if (ds->top == -1)
return "\0";
char * path = ds->stack[ds->top].path;
ds->top--;
return path;
}

char* get_top_dir(struct DIR_STACK * ds){
return ds->stack[ds->top].path;
}

void reverse_dir(struct DIR_STACK * ds){
int i = 0;
int j = ds->top;
while (i < j){
char temp[8];
memcpy(temp, ds->stack[i].path, 8);
memcpy(ds->stack[i].path, ds->stack[j].path, 8);
memcpy(ds->stack[j].path, temp, 8);
i++;
j--;
}
}

struct DIR_STACK get_dir_stack(char * request, int * validate){
struct DIR_STACK ds;
init_dir_stack(&ds);
int i = 0;

while (request[i] != '\0'){
if (request[i] == '/'){
i++;
continue;
}
char path[8];
int j = 0;
while (request[i] != '/' && request[i] != '\0'){
path[j] = request[i];
i++;
j++;
}
if (j > 8){
*validate = 0;
return ds;
}
while (j < 8){
path[j] = '\0';
j++;
}
push_dir(&ds, path);
}

return ds;
}
51 changes: 51 additions & 0 deletions src/disk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "lib-header/disk.h"
#include "lib-header/portio.h"

static void ATA_busy_wait() {
while (in(0x1F7) & ATA_STATUS_BSY);
}

static void ATA_DRQ_wait() {
while (!(in(0x1F7) & ATA_STATUS_RDY));
}

void read_blocks(void *ptr, uint32_t logical_block_address, uint8_t block_count) {
ATA_busy_wait();
out(0x1F6, 0xE0 | ((logical_block_address >> 24) & 0xF));
out(0x1F2, block_count);
out(0x1F3, (uint8_t) logical_block_address);
out(0x1F4, (uint8_t) (logical_block_address >> 8));
out(0x1F5, (uint8_t) (logical_block_address >> 16));
out(0x1F7, 0x20);

uint16_t *target = (uint16_t*) ptr;

for (uint32_t i = 0; i < block_count; i++) {
ATA_busy_wait();
ATA_DRQ_wait();
for (uint32_t j = 0; j < HALF_BLOCK_SIZE; j++)
target[j] = in16(0x1F0);
// Note : uint16_t => 2 bytes, HALF_BLOCK_SIZE*2 = BLOCK_SIZE with pointer arithmetic
target += HALF_BLOCK_SIZE;
}
}

void write_blocks(const void *ptr, uint32_t logical_block_address, uint8_t block_count) {
ATA_busy_wait();
out(0x1F6, 0xE0 | ((logical_block_address >> 24) & 0xF));
out(0x1F2, block_count);
out(0x1F3, (uint8_t) logical_block_address);
out(0x1F4, (uint8_t) (logical_block_address >> 8));
out(0x1F5, (uint8_t) (logical_block_address >> 16));
out(0x1F7, 0x30);

for (uint32_t i = 0; i < block_count; i++) {
ATA_busy_wait();
ATA_DRQ_wait();
/* Note : uint16_t => 2 bytes, i is current block number to write
HALF_BLOCK_SIZE*i = block_offset with pointer arithmetic
*/
for (uint32_t j = 0; j < HALF_BLOCK_SIZE; j++)
out16(0x1F0, ((uint16_t*) ptr)[HALF_BLOCK_SIZE*i + j]);
}
}
Loading