mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-10 13:04:53 -04:00
Improve debugging
This commit is contained in:
parent
252f46692b
commit
c1e8ee5cd0
@ -11,10 +11,7 @@
|
|||||||
#include <array.hpp>
|
#include <array.hpp>
|
||||||
|
|
||||||
#include "bitmap.hpp"
|
#include "bitmap.hpp"
|
||||||
|
#include "logging.hpp"
|
||||||
//For problems during boot
|
|
||||||
#include "kernel.hpp"
|
|
||||||
#include "console.hpp"
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline constexpr T pow(T const& x, size_t n){
|
inline constexpr T pow(T const& x, size_t n){
|
||||||
@ -52,12 +49,8 @@ public:
|
|||||||
size_t allocate(size_t pages){
|
size_t allocate(size_t pages){
|
||||||
if(pages > max_block){
|
if(pages > max_block){
|
||||||
if(pages > max_block * static_bitmap::bits_per_word){
|
if(pages > max_block * static_bitmap::bits_per_word){
|
||||||
k_print_line("Virtual block too big");
|
logging::logf(logging::log_level::ERROR, "buddy: Impossible to allocate mor than 33M block:%u\n", pages);
|
||||||
suspend_boot();
|
//TODO Implement larger allocation
|
||||||
|
|
||||||
//That means we try to allocate more than 33M at the same time
|
|
||||||
//probably not a good idea
|
|
||||||
//TODO Implement it all the same
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
auto l = bitmaps.size() - 1;
|
auto l = bitmaps.size() - 1;
|
||||||
@ -65,6 +58,7 @@ public:
|
|||||||
auto address = block_start(l, index);
|
auto address = block_start(l, index);
|
||||||
|
|
||||||
if(address + level_size(pages) >= last_address){
|
if(address + level_size(pages) >= last_address){
|
||||||
|
logging::logf(logging::log_level::ERROR, "buddy: Address too high level:%u index:%u address:%h\n", l, index, address);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +75,7 @@ public:
|
|||||||
auto address = block_start(l, index);
|
auto address = block_start(l, index);
|
||||||
|
|
||||||
if(address + level_size(pages) >= last_address){
|
if(address + level_size(pages) >= last_address){
|
||||||
|
logging::logf(logging::log_level::ERROR, "buddy: Address too high pages:%u level:%u index:%u address:%h\n", pages, l, index, address);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,12 +88,8 @@ public:
|
|||||||
void free(size_t address, size_t pages){
|
void free(size_t address, size_t pages){
|
||||||
if(pages > max_block){
|
if(pages > max_block){
|
||||||
if(pages > max_block * static_bitmap::bits_per_word){
|
if(pages > max_block * static_bitmap::bits_per_word){
|
||||||
k_print_line("Virtual block too big");
|
logging::logf(logging::log_level::ERROR, "buddy: Impossible to free more than 33M block:%u\n", pages);
|
||||||
suspend_boot();
|
//TODO Implement larger allocation
|
||||||
|
|
||||||
//That means we try to allocate more than 33M at the same time
|
|
||||||
//probably not a good idea
|
|
||||||
//TODO Implement it all the same
|
|
||||||
} else {
|
} else {
|
||||||
auto l = level(pages);
|
auto l = level(pages);
|
||||||
auto index = get_block_index(address, l);
|
auto index = get_block_index(address, l);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user