generated from Sister20/kit-OS-2023
-
Notifications
You must be signed in to change notification settings - Fork 2
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
github-classroom
wants to merge
120
commits into
feedback
Choose a base branch
from
main
base: feedback
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feedback #1
Changes from 24 commits
Commits
Show all changes
120 commits
Select commit
Hold shift + click to select a range
347406f
Setting up GitHub Classroom Feedback
github-classroom[bot] b1ffac3
seadanya dululahya
mikeleo03 356ec11
Makefile 75%
mikeleo03 71ccc03
refactor: fix makefile, supposedly running
GoDillonAudris512 56971fb
Update makefile again
mikeleo03 83e35a6
framebuffer write and clear
Nat10k f5e832a
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
Nat10k 23a30e6
refactor: add portio.o, delete framebuffer linker
GoDillonAudris512 3f12309
feat: add the set cursor position function
GoDillonAudris512 8287d68
Basic gdt.c
mikeleo03 bdf712e
refactor: complete the segment descriptor structure
GoDillonAudris512 2ac2a1a
Inserting gdt vals
mikeleo03 e17407d
gdt and gdtr implementation done
mikeleo03 0ef9925
Protected Mode
AustinPardosi c14241f
refactor: add command to makefile, implement protected mode in kernel.c
GoDillonAudris512 468c554
delete unnecessary file
GoDillonAudris512 f6443b8
Initial setup for Milestone #2
mikeleo03 761b55b
Setup filesystem
Nat10k bec19f7
Add Keyboard (Testing) Not Final
AustinPardosi 3a3dc47
trying to initiate file system
GoDillonAudris512 b1a0159
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
GoDillonAudris512 f73f940
Interrupt + IDT done?
mikeleo03 01d62f8
fixed make file and launch task
GoDillonAudris512 9846e95
better file arrangement
mikeleo03 70796a0
Interrupt?????
mikeleo03 4f4ea5f
Update filesystem
Nat10k 414c571
Updating IDT struct
mikeleo03 1168ed1
Updating reference path
mikeleo03 7606d17
finished doing initialize fat32
GoDillonAudris512 0e7c81e
Initialize interrupt - keyboard joining process
mikeleo03 f148bdb
refactor: add comment to improve readability and understandability. m…
GoDillonAudris512 9dd8105
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
GoDillonAudris512 7e8c7db
fixed kernel loader and linker, refactor the makefile a bit
GoDillonAudris512 026af78
feat: read operation done, not yet tested. delete function header com…
GoDillonAudris512 1c259dc
fixed the mechanism to check if parent directory validity
GoDillonAudris512 080a0a8
add read and read_directory
Nat10k 0a185de
feat: add delete operation, not tested yet. fixed some checking mecha…
GoDillonAudris512 b43f454
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
GoDillonAudris512 20e9f52
refactor: delete name and extension, and write extension for extra gu…
GoDillonAudris512 1cb8fec
refactor: fixed write and delete checking mechanism a bit
GoDillonAudris512 9d37c03
fix: change mechanism for file write to avoid buffer overflow and oth…
GoDillonAudris512 7738064
Add README.md
mikeleo03 3b113cc
Support keyboard on makefile and interrupt
mikeleo03 b48ac9b
Fix: Keyboard Interrupt
AustinPardosi bbd4ccf
fix keyboard, read, interrupt, change kernel test code
Nat10k 7c5a836
add testcase for writing and reading from non-root directory
Nat10k 346a05a
refactor: change kernel setup back to test case, change some flag in …
GoDillonAudris512 704422b
fix keyboard mini bugs -- leon
GoDillonAudris512 391e220
feat: add cmos device driver to supports date and time in file system
GoDillonAudris512 77c63ca
feat: implements the cmos driver to filesystem
GoDillonAudris512 6a34c25
Update keyboard, kernel and README
mikeleo03 c4518f7
Initial setup for Milestone #3
mikeleo03 ed8bbfe
feat: implement paging to the os
GoDillonAudris512 3b74c54
add user mode setup
Nat10k 952c63a
continue user mode
Nat10k 5e8678e
Fix switch to user mode
Nat10k ed0362d
syscall done (?)
mikeleo03 96dd161
unfinshed shell
mikeleo03 ab9f67d
sycall berjalan dengan baik :D
mikeleo03 7ace88a
Temporary initial screen template for shell
mikeleo03 41d36cb
main shell interface done
mikeleo03 15c3ea0
input processer - ready to parse
mikeleo03 cc5d738
add buffer clear mechanism
mikeleo03 364a8ac
fix : page-fault handling while giving input
mikeleo03 57dcedd
feat : argparse mechanism
mikeleo03 9384599
fix: add a proper end of line char to input argument
GoDillonAudris512 aa82f8f
fix : input parser
mikeleo03 beb75b8
feat : initialize print current working dir
mikeleo03 eb85560
chore: change some file to enable user-shell link with other file , s…
GoDillonAudris512 8c9ebc0
Determine how input will be processed
GoDillonAudris512 f2baf20
fix: extern the current_directory and initialize it in c instead. nee…
GoDillonAudris512 4230fd2
fix : puts enter mechanism
mikeleo03 17a90d1
feat : cat + FAT32 req
mikeleo03 53a4c75
mkdir command working
GoDillonAudris512 50461d8
chore: change comment and include file
GoDillonAudris512 41b14e8
refactor: bigger argument buffer, add ls to command processing
GoDillonAudris512 6678e76
feat: mkdir enable to create multiple folder with different path argu…
GoDillonAudris512 9e37a7c
ls command working with 0, 1, or multiple argument path
GoDillonAudris512 ff71433
fix: ensure that there is no folder/file with a same name in the same…
GoDillonAudris512 f0b349e
fix: change how ls behaves with a path containing file
GoDillonAudris512 d3d9afe
fix: change how mkdir behaves with path containing file
GoDillonAudris512 6f85bfa
feat : add cat + update user-shell
mikeleo03 13ce4d4
cd command working properly
GoDillonAudris512 f1b66fd
feat : print current working directory
mikeleo03 faa8883
feat : cp command
Nat10k 9f18161
chore : delete unused comments
Nat10k 2360660
fix : cat support extensions
mikeleo03 3724193
feat : basic scheme of whereis
mikeleo03 718044b
fix: filesystem: enable a subdir to have the same name as its parent
GoDillonAudris512 59e1f64
fix : whereis and extension file-folder handling
mikeleo03 26e3dc9
feat: add rm command
AustinPardosi 2546d05
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
AustinPardosi 10bf043
fix: rm working properly for folder
AustinPardosi 528ce77
chore : cat extension handling update mechanism
mikeleo03 dc99829
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
mikeleo03 bf78f48
fix : update whereis and run well
mikeleo03 428b4cc
feat : space handling on whereis and done
mikeleo03 2890906
update README
mikeleo03 b002ea4
fix: rm can handle extention
AustinPardosi 9588eb5
feat: add initial screen
AustinPardosi ff587d8
fix : change one of cp error message
Nat10k 57ca5ff
feat : splash screen
Nat10k 8c84617
fix : error when pressing enter without args
Nat10k a165ef1
fix: rm fixing some bug
AustinPardosi 8ca7a0c
fix: filesystem : wrong operation to fill dir table (write -> read)
GoDillonAudris512 9481fcc
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
GoDillonAudris512 ffbac04
fix : rm errors
Nat10k ca010eb
feat : add new command : clear
mikeleo03 b5ddb4a
feat : clear restriction + edit filename
mikeleo03 00b0fb2
chore : update README
mikeleo03 027e485
fix : cp handle if extension longer than 3 characters
Nat10k f8beabd
feat: add command mv
AustinPardosi b8dda37
fix : cp error message
Nat10k ff573f7
fix: mv checking error
AustinPardosi b5f067a
fix: mv parse function
GoDillonAudris512 a62f9a5
fix : whereis extension handling
mikeleo03 9463ca7
fix : mv features complete
Nat10k 0517f91
Change output of command error and fix delete filesystem
GoDillonAudris512 05b4cc3
fix : rm handles exception
Nat10k 0a9cae3
FINAL COMMIT
GoDillonAudris512 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "disk.h" | ||
#include "../portio/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]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef _DISK_H | ||
#define _DISK_H | ||
|
||
#include "../std/stdtype.h" | ||
|
||
/* -- ATA PIO status codes -- */ | ||
#define ATA_STATUS_BSY 0x80 | ||
#define ATA_STATUS_RDY 0x40 | ||
#define ATA_STATUS_DRQ 0x08 | ||
#define ATA_STATUS_DF 0x20 | ||
#define ATA_STATUS_ERR 0x01 | ||
|
||
#define BLOCK_SIZE 512 | ||
#define HALF_BLOCK_SIZE (BLOCK_SIZE/2) | ||
|
||
// Block buffer data type - @param buf Byte buffer with size of BLOCK_SIZE | ||
struct BlockBuffer { | ||
uint8_t buf[BLOCK_SIZE]; | ||
} __attribute__((packed)); | ||
|
||
/** | ||
* ATA PIO logical block address read blocks. Will blocking until read is completed. | ||
* Note: ATA PIO will use 2-bytes per read/write operation. | ||
* Recommended to use struct BlockBuffer | ||
* | ||
* @param ptr Pointer for storing reading data, this pointer should point to already allocated memory location. | ||
* With allocated size positive integer multiple of BLOCK_SIZE, ex: buf[1024] | ||
* @param logical_block_address Block address to read data from. Use LBA addressing | ||
* @param block_count How many block to read, starting from block logical_block_address to lba-1 | ||
*/ | ||
void read_blocks(void *ptr, uint32_t logical_block_address, uint8_t block_count); | ||
|
||
/** | ||
* ATA PIO logical block address write blocks. Will blocking until write is completed. | ||
* Note: ATA PIO will use 2-bytes per read/write operation. | ||
* Recommended to use struct BlockBuffer | ||
* | ||
* @param ptr Pointer to data that to be written into disk. Memory pointed should be positive integer multiple of BLOCK_SIZE | ||
* @param logical_block_address Block address to write data into. Use LBA addressing | ||
* @param block_count How many block to write, starting from block logical_block_address to lba-1 | ||
*/ | ||
void write_blocks(const void *ptr, uint32_t logical_block_address, uint8_t block_count); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
#include "../std/stdtype.h" | ||
#include "fat32.h" | ||
#include "../std/stdmem.h" | ||
|
||
const uint8_t fs_signature[BLOCK_SIZE] = { | ||
'C', 'o', 'u', 'r', 's', 'e', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', | ||
'D', 'e', 's', 'i', 'g', 'n', 'e', 'd', ' ', 'b', 'y', ' ', ' ', ' ', ' ', ' ', | ||
'L', 'a', 'b', ' ', 'S', 'i', 's', 't', 'e', 'r', ' ', 'I', 'T', 'B', ' ', ' ', | ||
'M', 'a', 'd', 'e', ' ', 'w', 'i', 't', 'h', ' ', '<', '3', ' ', ' ', ' ', ' ', | ||
'-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '2', '0', '2', '3', '\n', | ||
[BLOCK_SIZE-2] = 'O', | ||
[BLOCK_SIZE-1] = 'k', | ||
}; | ||
|
||
struct FAT32DriverState driverState; | ||
|
||
/* -- Driver Interfaces -- */ | ||
|
||
/** | ||
* Convert cluster number to logical block address | ||
* | ||
* @param cluster Cluster number to convert | ||
* @return uint32_t Logical Block Address | ||
*/ | ||
uint32_t cluster_to_lba(uint32_t cluster) { | ||
return cluster * CLUSTER_SIZE; | ||
} | ||
|
||
/** | ||
* Initialize DirectoryTable value with parent DirectoryEntry and directory name | ||
* | ||
* @param dir_table Pointer to directory table | ||
* @param name 8-byte char for directory name | ||
* @param parent_dir_cluster Parent directory cluster number | ||
*/ | ||
void init_directory_table(struct FAT32DirectoryTable *dir_table, char *name, uint32_t parent_dir_cluster); | ||
|
||
/** | ||
* Checking whether filesystem signature is missing or not in boot sector | ||
* | ||
* @return True if memcmp(boot_sector, fs_signature) returning inequality | ||
*/ | ||
bool is_empty_storage(void) { | ||
return memcmp(fs_signature, BOOT_SECTOR, BLOCK_SIZE); | ||
} | ||
|
||
/** | ||
* Create new FAT32 file system. Will write fs_signature into boot sector and | ||
* proper FileAllocationTable (contain CLUSTER_0_VALUE, CLUSTER_1_VALUE, | ||
* and initialized root directory) into cluster number 1 | ||
*/ | ||
void create_fat32(void) { | ||
struct FAT32FileAllocationTable table; | ||
table.cluster_map[0] = CLUSTER_0_VALUE; | ||
table.cluster_map[1] = CLUSTER_1_VALUE; | ||
table.cluster_map[2] = FAT32_FAT_END_OF_FILE; | ||
|
||
write_blocks(fs_signature, cluster_to_lba(0), (uint8_t) CLUSTER_SIZE); | ||
write_blocks(&table, cluster_to_lba(1), (uint8_t) CLUSTER_SIZE); | ||
} | ||
|
||
/** | ||
* Initialize file system driver state, if is_empty_storage() then create_fat32() | ||
* Else, read and cache entire FileAllocationTable (located at cluster number 1) into driver state | ||
*/ | ||
void initialize_filesystem_fat32(void) { | ||
if (is_empty_storage()) { | ||
create_fat32(); | ||
} | ||
else { | ||
read_blocks(&(driverState.fat_table), cluster_to_lba(1), (uint8_t) CLUSTER_SIZE); | ||
|
||
} | ||
} | ||
|
||
/** | ||
* Write cluster operation, wrapper for write_blocks(). | ||
* Recommended to use struct ClusterBuffer | ||
* | ||
* @param ptr Pointer to source data | ||
* @param cluster_number Cluster number to write | ||
* @param cluster_count Cluster count to write, due limitation of write_blocks block_count 255 => max cluster_count = 63 | ||
*/ | ||
void write_clusters(const void *ptr, uint32_t cluster_number, uint8_t cluster_count); | ||
|
||
/** | ||
* Read cluster operation, wrapper for read_blocks(). | ||
* Recommended to use struct ClusterBuffer | ||
* | ||
* @param ptr Pointer to buffer for reading | ||
* @param cluster_number Cluster number to read | ||
* @param cluster_count Cluster count to read, due limitation of read_blocks block_count 255 => max cluster_count = 63 | ||
*/ | ||
void read_clusters(void *ptr, uint32_t cluster_number, uint8_t cluster_count); | ||
|
||
|
||
|
||
|
||
|
||
/* -- CRUD Operation -- */ | ||
|
||
/** | ||
* FAT32 Folder / Directory read | ||
* | ||
* @param request buf point to struct FAT32DirectoryTable, | ||
* name is directory name, | ||
* ext is unused, | ||
* parent_cluster_number is target directory table to read, | ||
* buffer_size must be exactly sizeof(struct FAT32DirectoryTable) | ||
* @return Error code: 0 success - 1 not a folder - 2 not found - -1 unknown | ||
*/ | ||
int8_t read_directory(struct FAT32DriverRequest request); | ||
|
||
|
||
/** | ||
* FAT32 read, read a file from file system. | ||
* | ||
* @param request All attribute will be used for read, buffer_size will limit reading count | ||
* @return Error code: 0 success - 1 not a file - 2 not enough buffer - 3 not found - -1 unknown | ||
*/ | ||
int8_t read(struct FAT32DriverRequest request); | ||
|
||
/** | ||
* FAT32 write, write a file or folder to file system. | ||
* | ||
* @param request All attribute will be used for write, buffer_size == 0 then create a folder / directory | ||
* @return Error code: 0 success - 1 file/folder already exist - 2 invalid parent cluster - -1 unknown | ||
*/ | ||
int8_t write(struct FAT32DriverRequest request); | ||
|
||
|
||
/** | ||
* FAT32 delete, delete a file or empty directory (only 1 DirectoryEntry) in file system. | ||
* | ||
* @param request buf and buffer_size is unused | ||
* @return Error code: 0 success - 1 not found - 2 folder is not empty - -1 unknown | ||
*/ | ||
int8_t delete(struct FAT32DriverRequest request); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor tips, flag
-I(SOURCE_FOLDER)
di GCC sebenarnya menambah header file search location, jadi semestinya#include "lib-header/portio.h"
atau#include "portio/portio.h"
bisaThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oiyaa bisa, Thanks kak buat tipsnya!