Giter VIP home page Giter VIP logo

artilleryos's People

Contributors

luketheengineer avatar lvntky avatar moussacodes avatar unclebela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

artilleryos's Issues

implement <string.h> functions

Currently, only the following functions are implemented:

void *memset(void *, int, size_t);
void *memcpy(void *, const void *, size_t);
void *memmove(void *, const void *, size_t);
int strcmp(char *, char *str2);

I intend to implement the remaining functions:
strlen, strcpy, strncpy, strcat, strncat, strncmp, strtok.

implement `rand` and `srand`

The stdlib library doesn't have a random number generation feature yet. I want to add this feature to the library.

Multiboot Util Funtions Needed

We have finally able to get correct multiboot information in kernel_main. But it would be nice and more good approach gettin multiboot information from some util collection like multiboot_util.c etc.

issues on keyboard and PIT

there is several issues on keyboard and PIT interrupt request. The issue might be in irq.c or related device drivers. need to fix.

using nasm instead of gas

lets use nasm syntax instead of gas sytax. even gas works better with gcc, nasm syntax should tidy up the asm processes.

TODO:

  • Convert loader.s to nasm syntax

readdir_fs() dont parse file names correctly

in tempfs.c readdir_fs dont get the first 3 character of files. there is no problem with directories but this problem occures with files. Maybe the issue can be related with initrd_generator program. Further investigation needed. But this issue tagged as low-priority hence the tempfss is a temporary prototype file system and the issue not effects the kernel functionality.

Double printing is not working as intended

While I was testing my double math functions, I noticed that doubles get printed in the reverse order. For example, I'm expecting to see 0.5000, but it prints out 0005.0

IDT multiple print message bug

IDT initialization is kind of buggy. The issue is when we trigger the interrupt zero, we expect to print 1 line zero division message, but instead the kernel prints the exception message in an endless loop.

check the screenshot:
IDT zero divison error bug

so maybe the issue is occured because tty and print functions but we need to check the both idt and tty to solve the issue.

Here is a simple asm function to test interrupt:
problem: mov eax, 0 div eax

Optional Code can be moved to a seperate C file

As you can see we have optional codes in kernel.c such as:

#if DISPLAY_VBE_INFO
	display_vbe_info(mbinfo);
#endif

#if TEST_IDT
	test_idt();
#endif

etc...

these functions are created mostly for giving debug informations to developer or switchin the graphical mods or showing up some demos that coded but not direcltly related with the functionality of kernel. They are set true or false by macros in the header files in options.h

So the task is: lets create a optional.c file, move every optional functions call in it with a wrapper function named optional_init() and call only optional_init() in kernel_main(). Here is how it should look like:

in options.c ==>

optional_init() {
 #if DISPLAY_VBE_INFO
	display_vbe_info(mbinfo);
#endif

#if TEST_IDT
	test_idt();
#endif
...........
}
in kernel.c ==> 
kernel_main() {

......

optional_init();
......
}

this is an easy one, happy hacking and have fun!

Migrate to GRUB + Multiboot

Since we have lots of errors on running Artillery on Real Hardware, we need to migrate to GRUB bootloader while keeping the functionality of Artillery OS not harmed.

The scope of the variable 'isNegative' can be reduced.

This change can be made to improve code quality. The following error was encountered in the static analysis performed on the code:
kernel/src/qemu_debug.c:39:6: style: The scope of the variable 'isNegative' can be reduced. [variableScope] int isNegative = 0;

When I checked the code, I realized that we don't actually need this variable.

the relevant method can be updated as follows:

void itoa_dbg(int n, char *buffer, int base)
{
    int i = 0;

    // Handle 0 explicitly, otherwise an empty string is printed
    if (n == 0) {
        buffer[i++] = '0';
        buffer[i] = '\0';
    } else {
        // Handle negative numbers only if the base is 10
        if (n < 0 && base == 10) {
            n = -n;

            // Append negative sign for base 10
            buffer[i++] = '-';
        }

        // Process individual digits
        while (n != 0) {
            int rem = n % base;
            buffer[i++] = (rem > 9) ? (rem - 10) + 'a' : rem + '0';
            n = n / base;
        }

        buffer[i] = '\0'; // Null-terminate the string
    }

    // Reverse the string
    int start = 0;
    int end = i - 1;
    while (start < end) {
        // Swap characters
        char temp = buffer[start];
        buffer[start] = buffer[end];
        buffer[end] = temp;
        start++;
        end--;
    }
}

I haven't tested it but theoratically it will work :) the implementation and test is required. You can use the following function or re-implement your own itoa.

PS: the "_debug" endfix just used for telling this function only used on debug purpuses. nothing else.

printf/qemu_write_string unsigned integer representations are wrong

As can be seen in the image, the memory dump is represented wrong.

memb

but when i check the differentation of the virtual and physical memory addresses:

uint32_t kernel_size_phy =
		kmlimits->kernel_physical_end - kmlimits->kernel_physical_start;

	uint32_t kernel_size_virt =
		kmlimits->kernel_virtual_end - kmlimits->kernel_virtual_start;

	qemu_write_string("%s Cheking kernel size...\n", INFORMATION_OUTPUT);
	if (kernel_size_phy != kernel_size_virt) {
		panic("Kernel Memmory Error", "paging.c");
	} else {
		qemu_write_string("%s Kernel Size -> HEX: 0x%x DEC: %d\n",
				  INFORMATION_OUTPUT, kernel_size_phy,
				  kernel_size_phy);
	}

There is no problem at all. The virtual and phycial memory differentation is equal. So the representation of unsigned values especially the valus is grows is problematic. Needed to fixed and printf/qemu_write_string code refactored.

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.