mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Implemented Higher Half Kernel!
- Minor makefile chnages - stage3.c "prekernel", sets up memory stuff and jumps to kernel - kernel is now at 0xC0000000 - 3GB+ "higher half" - Added some global variables in memory/addresses.h
This commit is contained in:
@@ -48,14 +48,15 @@ void updateFiletable() {
|
||||
// TODO: Update the filetable by writing data from memory to disk!
|
||||
}
|
||||
|
||||
void readFile(char* filename, void* buffer) { // Hopefully the buffer is large enought :/
|
||||
uint8_t readFile(char* filename, void* buffer) { // Hopefully the buffer is large enought :/
|
||||
fileEntry_t* file = findFile(filename);
|
||||
if (file == NULL) { return; } // File doesn't exist!
|
||||
if (file == NULL) { return 1; } // File doesn't exist!
|
||||
|
||||
diskRead(file->startAddress, file->length, buffer);
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void writeFile(char* filename, void* buffer) { // TODO: Add length so we don't write too much/too little
|
||||
uint8_t writeFile(char* filename, void* buffer) { // TODO: Add length so we don't write too much/too little
|
||||
fileEntry_t* file = findFile(filetable);
|
||||
if (file == NULL) { // File exists -> override
|
||||
// File doesn't exist -> create new file
|
||||
@@ -74,6 +75,7 @@ void writeFile(char* filename, void* buffer) { // TODO: Add length so we don't w
|
||||
}
|
||||
|
||||
diskWrite(file->startAddress, file->length, buffer); // Write the file
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void printFiletable(char* ft) {
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
#ifndef ADDRESSES_H
|
||||
#define ADDRESSES_H
|
||||
|
||||
#define MEMMAP_AREA 0x30000
|
||||
#define KERNEL_LOC 0x50000
|
||||
#define FILETABLE_LOC 0x7000
|
||||
#define SMAP_ENTRY_COUNT 0x8500
|
||||
#define SMAP_ENTRIES 0x8504
|
||||
// Locations
|
||||
#define KERNEL_LOC 0x100000
|
||||
#define FILETABLE_LOC 0x7000
|
||||
|
||||
// Physical memory manager
|
||||
#define MEMMAP_AREA 0x30000
|
||||
#define SMAP_ENTRY_COUNT 0x8500
|
||||
#define SMAP_ENTRIES 0x8504
|
||||
#define PHYS_MEM_MAX_BLOCKS 0x1804
|
||||
#define PHYS_MEM_USED_BLOCKS 0x1808
|
||||
|
||||
// Virtual memory manager
|
||||
#define CURRENT_PAGE_DIR_ADDR 0x1800
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user