Skip to content

Commit 5729a65

Browse files
committed
Fix many more things
1 parent 42844ad commit 5729a65

43 files changed

Lines changed: 1317 additions & 505 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ backspace_len() {
9191
# Build limine if required
9292
verify_limine() {
9393
pushd target
94-
print_name "bootloader-limine"
95-
printf "\n"
9694

9795
# TODO: Maybe move this all to toolchain setup
9896
if [ ! -d "limine-$LIMINE_VERSION" ]; then
97+
print_name "limine-prepare"
98+
printf "\n"
9999
curl "$LIMINE_SOURCE" -k -o "limine-$LIMINE_VERSION.tar.gz"
100100
tar -xf "limine-$LIMINE_VERSION.tar.gz"
101101
pushd "limine-$LIMINE_VERSION"

kernel/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SRC_SHARED=$SRC/shared
2222
# Compiler flags
2323
#
2424
LDFLAGS="-nostdlib -nostartfiles"
25-
CFLAGS="-mcmodel=large -std=c++11 -D_GHOST_KERNEL_=1 -Wall -Wno-unused-but-set-variable -ffreestanding -fno-exceptions -fno-rtti"
25+
CFLAGS="-mcmodel=large -mno-sse -mno-sse2 -mno-mmx -mno-avx -mno-red-zone -std=c++11 -D_GHOST_KERNEL_=1 -Wall -Wno-unused-but-set-variable -ffreestanding -fno-exceptions -fno-rtti"
2626

2727
#
2828
# Object output folders

kernel/inc/shared/logger/logger.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ void loggerPrintFormatted(const char *message, va_list va);
7373
* - if the base is 10 then signs are added
7474
* - if the base is 16 a preceding '0x' is added
7575
*/
76-
void loggerPrintNumber(uint64_t number, uint16_t base);
76+
void loggerPrintNumber(uint64_t number, uint16_t base, bool shortened);
7777

7878
#endif

kernel/inc/shared/memory/constants.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
// TODO new constants
4141
#define G_MEM_LOWER_END 0x0000000000100000
4242
#define G_MEM_LOWER_HALF_END 0x00007fffffffffff
43+
44+
/**
45+
* Due to the Higher Half Direct Map feature, every physical address is mapped
46+
* to this higher-half offset in virtual memory by default.
47+
*/
4348
#define G_MEM_HIGHER_HALF_DIRECT_MAP_OFFSET 0xffff800000000000
4449
#define G_MEM_PHYS_TO_VIRT(phys) ((G_MEM_HIGHER_HALF_DIRECT_MAP_OFFSET) + (g_address) phys)
4550

kernel/inc/shared/memory/paging.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ g_physical_address pagingGetCurrentSpace();
101101
/**
102102
* Invalidates the translation lookaside buffer (TLB) entries for a given page.
103103
*/
104-
static inline void pagingInvalidatePage(uint32_t addr)
104+
static inline void pagingInvalidatePage(g_address addr)
105105
{
106106
__asm__ __volatile__("invlpg (%0)" : : "r"(addr) : "memory");
107107
}

kernel/inc/shared/memory/tss.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct g_tss
3737
uint64_t reserved2;
3838
uint16_t reserved3;
3939
uint16_t iomapBase;
40-
};
40+
}__attribute__((packed));
4141

4242

4343
#endif

kernel/inc/shared/video/bitmap_font_data.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
#define __BITMAP_FONT_DATA__
66
#include <stdint.h>
77

8-
extern uint8_t bitmapFontCharSet[100][190];
8+
extern uint8_t bitmapFontCharSet[130][190];
99
#endif
1010

kernel/src/kernel/filesystem/filesystem.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,10 @@ g_filesystem_find_result filesystemFind(g_fs_node* parent, const char* path)
226226
g_fs_node* lastFoundParent = node;
227227
g_fs_open_status status = G_FS_OPEN_SUCCESSFUL;
228228

229-
char* nameStart = (char*) path;
229+
char* buf = (char*) heapAllocate(G_PATH_MAX); // TODO SLOW
230+
stringCopy(buf, path);
231+
232+
char* nameStart = buf;
230233
char* nameEnd = nameStart;
231234

232235
while(nameStart)
@@ -268,19 +271,20 @@ g_filesystem_find_result filesystemFind(g_fs_node* parent, const char* path)
268271

269272
nameStart = nameEnd;
270273
}
274+
heapFree(buf);
271275

272276
return {
273277
status: status,
274278
node: node,
275279
foundAllButLast: ((nameEnd - nameStart) > 0),
276280
lastFoundParent: lastFoundParent,
277-
fileNameStart: nameStart
281+
fileNameStart: path + (nameStart - buf)
278282
};
279283
}
280284

281285
g_fs_open_status filesystemOpen(const char* path, g_file_flag_mode flags, g_task* task, g_fd* outFd)
282286
{
283-
g_fs_node* origin;
287+
g_fs_node* origin = nullptr;
284288
g_fs_open_status findOriginStatus = _filesystemChooseOrigin(path, task, origin);
285289
if(findOriginStatus != G_FS_OPEN_SUCCESSFUL)
286290
return findOriginStatus;

kernel/src/kernel/filesystem/ramdisk.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ void ramdiskParseContents(limine_file* file)
124124

125125
g_ramdisk_entry* ramdiskFindChild(g_ramdisk_entry* parent, const char* childName)
126126
{
127-
128127
g_ramdisk_entry* current = ramdiskMain->firstEntry;
129128
while(current)
130129
{

kernel/src/kernel/kernel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ void kernelRunBootstrapCore()
160160
systemWaitForApplicationCores();
161161
systemMarkReady();
162162

163-
logInfo("jumping from BSP");
164163
interruptsEnable();
165164
for(;;)
166165
asm("hlt");
@@ -216,11 +215,12 @@ void kernelInitializationThread()
216215
{
217216
logInfo("%! loading system services", "init");
218217

219-
logInfo("%! we are in a thread!", "success");
220-
asm("cli; hlt;");
221-
222218
G_PRETTY_BOOT_STATUS_P(20);
223219
kernelSpawnService("/applications/pcidriver.bin", "", G_SECURITY_LEVEL_DRIVER);
220+
221+
logInfo("%! init finished, exiting %i", "init", taskingGetCurrentTask()->id);
222+
taskingExit();
223+
224224
G_PRETTY_BOOT_STATUS_P(20);
225225
kernelSpawnService("/applications/devicemanager.bin", "", G_SECURITY_LEVEL_DRIVER);
226226
G_PRETTY_BOOT_STATUS_P(40);

0 commit comments

Comments
 (0)