Debug, add memory print driver
This commit is contained in:
parent
067d6e340b
commit
fde8a1ab65
17 changed files with 108 additions and 36 deletions
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "include/boucane.hpp"
|
||||
#include "boucane.hpp"
|
||||
|
||||
#define ACPI_RSDP_SIGNATURE 0x2052545020445352
|
||||
#define ACPI_RSDT_SIGNATURE 0x54445352
|
||||
|
|
|
@ -22,7 +22,7 @@ void framebuffer_draw(FB_PIXEL p){
|
|||
void framebuffer_scrollup(u32 npixel){
|
||||
u64 start=fb_cfg.location+npixel*fb_cfg.pitch;
|
||||
u64 amount=fb_cfg.pitch*(fb_cfg.height-npixel);
|
||||
memcpy((void*)start,(void*)fb_cfg.location,amount);
|
||||
memcpy((void*)start,(void*)fb_cfg.location,amount); // TODO change because page fault can occurs
|
||||
}
|
||||
|
||||
void framebuffer_clear(){
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "include/boucane.hpp"
|
||||
#include "boucane.hpp"
|
||||
|
||||
typedef struct {
|
||||
u32 pitch;
|
||||
|
|
41
src/drivers/memtext.cc
Normal file
41
src/drivers/memtext.cc
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "memtext.hpp"
|
||||
#include "core/paging.hpp"
|
||||
#include "core/types.hpp"
|
||||
#include "libs/string.hpp"
|
||||
|
||||
|
||||
|
||||
char memtext_buffer[MEMTEXT_BUFFER_SIZE];
|
||||
u64 memtext_x=0;
|
||||
|
||||
void memtext_init(){
|
||||
PAGING_MAP2_RANGE(MEMTEXT_ADDR_LOCATION,0x0,8);
|
||||
u64* p_addr=(u64*)MEMTEXT_ADDR_LOCATION;
|
||||
*p_addr=(u64)memtext_buffer;
|
||||
|
||||
// Cleaning buffer
|
||||
for(memtext_x=0;memtext_x<MEMTEXT_BUFFER_SIZE;memtext_x++)
|
||||
memtext_buffer[memtext_x]=0;
|
||||
memtext_x=0;
|
||||
}
|
||||
|
||||
void memtext_putchar(char c){
|
||||
|
||||
if(memtext_x>=MEMTEXT_BUFFER_SIZE){
|
||||
memtext_scrollup(1);
|
||||
memtext_buffer[memtext_x-1]=c;
|
||||
return;
|
||||
}
|
||||
memtext_buffer[memtext_x]=c;
|
||||
memtext_x++;
|
||||
}
|
||||
|
||||
void memtext_scrollup(u32 n){
|
||||
u64 start=(u64)memtext_buffer;
|
||||
for(u64 i=0;i<MEMTEXT_BUFFER_SIZE;i++){
|
||||
if(i+n<MEMTEXT_BUFFER_SIZE)
|
||||
memtext_buffer[i]=memtext_buffer[i+n];
|
||||
else
|
||||
memtext_buffer[i]=0;
|
||||
}
|
||||
}
|
11
src/drivers/memtext.hpp
Normal file
11
src/drivers/memtext.hpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "boucane.hpp"
|
||||
|
||||
#define MEMTEXT_BUFFER_SIZE 1024
|
||||
#define MEMTEXT_ADDR_LOCATION 0x0
|
||||
|
||||
|
||||
void memtext_init();
|
||||
void memtext_putchar(char c);
|
||||
void memtext_scrollup(u32 n);
|
|
@ -1,11 +1,11 @@
|
|||
#include "psf.hpp"
|
||||
#include "psftext.hpp"
|
||||
#include "core/paging.hpp"
|
||||
#include "libs/string.hpp"
|
||||
#include "drivers/framebuffer.hpp"
|
||||
|
||||
PSF_STATUS psf_status;
|
||||
|
||||
void psf_init(void* psf_addr){
|
||||
void psftext_init(void* psf_addr){
|
||||
printk("Loading PSF font... ");
|
||||
memcpy(psf_addr, &psf_status.header, sizeof(PSF_HEADER));
|
||||
if(psf_status.header.magic!=PSF_MAGIC){
|
||||
|
@ -26,7 +26,7 @@ void psf_init(void* psf_addr){
|
|||
print("\n");
|
||||
}
|
||||
|
||||
void psf_putchar(char c){
|
||||
void psftext_putchar(char c){
|
||||
if(c=='\n'){
|
||||
psf_status.y++;
|
||||
psf_status.x=0;
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "include/boucane.hpp"
|
||||
#include "boucane.hpp"
|
||||
|
||||
#define PSF_MAGIC 0x864ab572
|
||||
|
||||
|
@ -27,5 +27,5 @@ typedef struct PSF_STATUS {
|
|||
|
||||
extern PSF_HEADER psf_header;
|
||||
|
||||
void psf_init(void* psf_addr);
|
||||
void psf_putchar(char c);
|
||||
void psftext_init(void* psf_addr);
|
||||
void psftext_putchar(char c);
|
|
@ -1,6 +1,6 @@
|
|||
#include "vga_t.hpp"
|
||||
#include "vgatext.hpp"
|
||||
|
||||
#include "include/boucane.hpp"
|
||||
#include "boucane.hpp"
|
||||
|
||||
#define MAX_COL 80
|
||||
#define MAX_LINE 25
|
||||
|
@ -13,19 +13,19 @@ VIDEO_STATE VS={
|
|||
GRAY,
|
||||
};
|
||||
|
||||
void vga_t_init(){
|
||||
void vgatext_init(){
|
||||
PAGING_MAP(0xB8000);
|
||||
PAGING_MAP(0xB8000+4096);
|
||||
}
|
||||
|
||||
void vga_t_putchar(char c){
|
||||
void vgatext_putchar(char c){
|
||||
// Handle newline here
|
||||
if(c=='\n'){
|
||||
VS.col=0;
|
||||
VS.line+=1;
|
||||
if(VS.line>=MAX_LINE){
|
||||
VS.line=MAX_LINE-1;
|
||||
vga_t_scrollup();
|
||||
vgatext_scrollup();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -41,18 +41,18 @@ void vga_t_putchar(char c){
|
|||
VS.line+=1;
|
||||
if(VS.line>=MAX_LINE){
|
||||
VS.line=MAX_LINE-1;
|
||||
vga_t_scrollup();
|
||||
vgatext_scrollup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vga_t_clear(){
|
||||
void vgatext_clear(){
|
||||
for(u8 i=0;i<MAX_LINE;i++){
|
||||
vga_t_scrollup();
|
||||
vgatext_scrollup();
|
||||
}
|
||||
}
|
||||
|
||||
void vga_t_scrollup(){
|
||||
void vgatext_scrollup(){
|
||||
// Move VS.line up
|
||||
for(u8 i=1;i<=MAX_LINE;i++){
|
||||
for(u8 j=0;j<=MAX_COL;j++)
|
|
@ -16,20 +16,20 @@ typedef struct VIDEO_STATE {
|
|||
u8 fg;
|
||||
} VIDEO_STATE;
|
||||
|
||||
void vga_t_init();
|
||||
void vgatext_init();
|
||||
|
||||
/**
|
||||
* Print char
|
||||
*/
|
||||
void vga_t_putchar(char);
|
||||
void vgatext_putchar(char);
|
||||
|
||||
/**
|
||||
* Scroll the framebuffer from one line
|
||||
*/
|
||||
void vga_t_scrollup();
|
||||
void vgatext_scrollup();
|
||||
|
||||
/**
|
||||
* Clear all char from the framebuffer
|
||||
*/
|
||||
void vga_t_clear();
|
||||
void vgatext_clear();
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue