Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinAlavik committed Mar 26, 2024
1 parent 7bd2b2e commit 9b50b66
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 21 deletions.
2 changes: 1 addition & 1 deletion arch/x86_64/cpu/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

void panic(const char *reason, int_frame_t frame)
{
printf("\n\n* %s\n\n", reason);
printf("\n\n* %s\n", reason);

printf("rax: 0x%.16llX, rbx: 0x%.16llX, rcx: 0x%.16llX, rdx: 0x%.16llX\n",
frame.rax, frame.rbx, frame.rcx, frame.rdx);
Expand Down
1 change: 1 addition & 0 deletions initrd/usr/share/paradox/bible_votd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Acts 1:8 But you will receive power when the Holy Spirit has come upon you, and you will be my witnesses in Jerusalem, and in all Judea and Samaria, and to the farthest parts of the earth.”
12 changes: 7 additions & 5 deletions kernel/entry/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <system/pic/pic.h>
#include <system/pit/pit.h>
#include <utilities/utilities.h>
#include <system/pci/pci.h>

volatile struct limine_module_request mod_request = {
.id = LIMINE_MODULE_REQUEST, .revision = 0};
Expand All @@ -26,10 +27,8 @@ int_frame_t *cur_frame;
ramdisk_t *rd;
VFS_t *vfs;

void init_boot(int debug_info)
void init()
{
(void)debug_info; // Eh, idc

hhdm_offset = hhdm_request.response->offset;
framebuffer = framebuffer_request.response->framebuffers[0];

Expand Down Expand Up @@ -63,10 +62,13 @@ void init_boot(int debug_info)

dprintf("[\e[0;32mVFS\e[0m] Mounted ramdisk\n");


tty_init(vfs, framebuffer);

int kstatus = main(); // Launch the kernel
keyboard.out = false;
tty_spawn(0, FONT_SMALL);
register_pci();

int kstatus = kmain(); // Launch the kernel

if (kstatus == KERNEL_QUIT_SUCCESS)
{
Expand Down
5 changes: 3 additions & 2 deletions kernel/entry/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <limine.h>
#include <x86_64/idt/idt.h>

#define DEFAULT_FONT "/usr/share/fonts/Uni3-Terminus12x6.psf"
#define FONT_SMALL "/usr/share/fonts/Uni3-Terminus12x6.psf"
#define FONT_BIG "/usr/share/fonts/Uni3-Terminus20x10.psf"

extern volatile struct limine_module_request mod_request;
extern volatile struct limine_framebuffer_request framebuffer_request;
Expand All @@ -17,6 +18,6 @@ extern int_frame_t *cur_frame;
extern ramdisk_t *rd;
extern VFS_t *vfs;

void init_boot(int debug_info);
void init();

#endif // __INIT_H__
25 changes: 21 additions & 4 deletions kernel/entry/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,33 @@ return codes)
#include <system/pit/pit.h>
#include <system/processes/processes.h>
#include <utilities/utilities.h>
#include <x86_64/cpu/panic.h>
#include <x86_64/idt/idt.h>

// Corelib includes
#include <kif.h>
#include <printf.h>
#include <transform.h>
#include <vector.h>
int main()

int kmain()
{
keyboard.out = false;
tty_spawn(0, "/usr/share/fonts/Uni3-Terminus12x6.psf");
register_pci();
tty_spawn(1, FONT_BIG);

vfs_op_status status;
char* votd = NULL;

status = driver_read(vfs, 0, "/usr/share/paradox/bible_votd", &votd);

if(status != STATUS_OK)
return KERNEL_QUIT_ERROR;

if (votd != NULL) {
dprintf("BibleVOTD: \033[1m%s\033[0m\n", votd);
free(votd);
}

keyboard.out = true;

return KERNEL_QUIT_HANG;
}
4 changes: 2 additions & 2 deletions kernel/entry/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
#define KERNEL_QUIT_PANIC 2 // Return this on kernel panic, shutdowns immediately
#define KERNEL_QUIT_HANG 3 // Return this to do nothing

int main(); // ONLY RETURN TO QUIT
int kmain(); // ONLY RETURN TO QUIT

#endif // __KERNEL_H__
#endif // __KERNEL_H__
4 changes: 2 additions & 2 deletions kernel/paradox.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

void _start(void)
{
init_boot(1);
init();
dprintf("[\e[0;32mSystem\e[0m] Oopsie something broke, init_boot got exited. "
"When it shouldnt have\n");
shutdown();
}
}
4 changes: 2 additions & 2 deletions kernel/system/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void register_pci()
(uint8_t)(device & 0xFF),
desc.device_id,
((uint8_t)((function & 0xFF))),
((desc.class_id == 0x0C) && (desc.subclass_id == 0x03)) ? "true" : "false");
((desc.class_id == 0x0C) && (desc.subclass_id == 0x03)) ? "yes" : "no");
}
}
}
}
}
2 changes: 1 addition & 1 deletion kernel/system/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ void write_pci(uint16_t bus, uint16_t device, uint16_t function, uint32_t regoff
void register_pci();
device_descriptor get_device_descriptor(uint16_t bus, uint16_t device, uint16_t function);

#endif // __PCI_H__
#endif // __PCI_H__
2 changes: 1 addition & 1 deletion kernel/tty/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void tty_switch(uint8_t id) {

cur_tty = ttys[id];
cur_tty_id = id;
// tty_flush();
tty_flush();
printf("Paradox 1.4.1-dev (tty%d)\n\n", cur_tty_id);
}

Expand Down
4 changes: 3 additions & 1 deletion tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ fi

mkdir -p iso_root

curl -s "https://labs.bible.org/api/?passage=votd&type=text&formatting=plain" > initrd/usr/share/paradox/bible_votd

tar -cvf modules/ramdisk.tar initrd/*

# PARADOX_VER=0.1.1
Expand All @@ -31,4 +33,4 @@ xorriso -as mkisofs -b limine-bios-cd.bin \
iso_root -o image.iso

./limine/limine bios-install image.iso
rm -rf iso_root
rm -rf iso_root

0 comments on commit 9b50b66

Please sign in to comment.