TODO and stuff

rust
E. Almqvist 3 years ago
parent 572be221b3
commit 9649d1a10d
  1. 21
      TODO.md
  2. 6
      drivers/vga.c
  3. 9
      kernel/kernel.c
  4. 1
      kernel/kernel.h
  5. 6
      kernel/memory.c
  6. 2
      kernel/memory.h
  7. 31
      lib/conv.c
  8. 3
      lib/math.c
  9. 2
      lib/math.h

@ -1,9 +1,14 @@
# TO DO
- Multiboot (read end of memory etc)
- String interpolation
- Screen scrolling
# TO DO
- Math lib: powf, log10, numlen
- Str lib: int\_to\_str
- Read and display e820 memory mapping
- (Random lib: random num from a to b?)
- Shell: input, execute
## Long term
- Get rust lang to work/switch to rust
- Shell?
- Improve memory management
- prog/time: show time
- prog/date: show date
- prog/mem: show amount of memory
- prog/bitmap: show phys bitmap
# Long term
- Rust?

@ -11,14 +11,14 @@ static uint cursor_col = 0;
void vga_init() {
// Disable cursor
port_outb(0x3d4, 0x0a);
port_outb(0x3d5, 0x20);
// port_outb(0x3d4, 0x0a);
// port_outb(0x3d5, 0x20);
// Clear screen
// clear_row(0);
// clear_screen();
set_cursor_pos(0, 0);
//set_cursor_pos(0, 0);
}
/*

@ -23,9 +23,14 @@ void kernel_init() {
// Allocate VGA memory range
pm_malloc_range(VGA_ADDRESS, VGA_ADDRESS_MAX, true); // force alloc the VGA range
// ENABLE PAGING
// TODO: make this work
// enable_paging();
set_cursor_pos(0, 8);
print("E820 loaded entries: ", DEFAULT_COLOR);
uint entries = get_phys_mem_size();
char* buf;
buf = int_to_str(entries, buf);
println(buf, DEFAULT_COLOR);
}

@ -6,4 +6,5 @@
#define BANNER_COLOR 0x0f
void kernel_motd();
void kernel_init();

@ -23,6 +23,12 @@
static int bitmap = 0;
static uint last_block;
uint get_phys_mem_size() {
// TODO: read actual mappings
uint entry_count = (uint) *BIOS_E820;
return entry_count;
}
void mod_bitmap(uint bit, uint bflag) {
// create a bitmask that will be applied to the bitmap
int bitmask = 1 << bit;

@ -25,3 +25,5 @@ void pm_malloc_range(ulong start, ulong end, bool force); // allocate a range of
pointer pm_malloc(uint block_count); // allocate some blocks
void pm_free(int* p); // free a var (if allocated with pm_malloc)
uint get_phys_mem_size(); // physical memory size with e820 left by the bootloader

@ -1,18 +1,23 @@
#include "conv.h"
#include "../drivers/vga.h"
char* int_to_str(int i, char* buf) {
ulong num = (ulong)i; // convert to ulong
uint len = ulong_len(num); // number of digits
*(buf+len) = '\0'; // add a "end-of-string" at the end
// char* int_to_str(int i, char* buf) {
// ulong num = (ulong)i; // convert to ulong
// uint len = ulong_len(num); // number of digits
//
// *(buf+len) = '\0'; // add a "end-of-string" at the end
//
// int j;
// for(j = 0; j < len; j++) { // iterate over each digit and assign it to the buffer
// // super dangerous memory write
// *(buf+j) = (char)(ndigit(num, len-1-j) + ASCII_OFFSET); // apply the ascii offset so that i becomes a char
// println(*(buf+j), 0xc0);
// }
//
// return buf;
// }
int j;
for(j = 0; j < len; j++) { // iterate over each digit and assign it to the buffer
// super dangerous memory write
*(buf+j) = (char)(ndigit(num, len-1-j) + ASCII_OFFSET); // apply the ascii offset so that i becomes a char
println(*(buf+j), 0xc0);
}
return buf;
char* int_to_str(int i, char* buf) {
char* sign = (i < 0) ? "-" : "+";
return (char*) sign;
}

@ -17,3 +17,6 @@ long square(uint num) {
}
return sum + 1;
}
float powf(float n) {}

@ -2,3 +2,5 @@
long pow(int, uint);
long square(uint);
float powf(float);

Loading…
Cancel
Save