mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
Fix stack overruns
This commit is contained in:
@@ -48,7 +48,7 @@ interrupts_disable:
|
|||||||
section .bss
|
section .bss
|
||||||
align 0x100
|
align 0x100
|
||||||
idle_stack_begin:
|
idle_stack_begin:
|
||||||
resb 0x1000 ; 4KiB stack space
|
resb 0x4000 ; 16KiB stack space
|
||||||
|
|
||||||
global idle_stack_end
|
global idle_stack_end
|
||||||
idle_stack_end:
|
idle_stack_end:
|
||||||
|
|||||||
@@ -184,7 +184,10 @@ isr_handler(cpu_state *regs)
|
|||||||
uintptr_t cr2 = 0;
|
uintptr_t cr2 = 0;
|
||||||
__asm__ __volatile__ ("mov %%cr2, %0" : "=r"(cr2));
|
__asm__ __volatile__ ("mov %%cr2, %0" : "=r"(cr2));
|
||||||
|
|
||||||
if (!page_manager::get()->fault_handler(cr2)) {
|
if ((regs->errorcode & 0x9) == 0 &&
|
||||||
|
page_manager::get()->fault_handler(cr2))
|
||||||
|
break;
|
||||||
|
|
||||||
cons->set_color(11);
|
cons->set_color(11);
|
||||||
cons->puts("\nPage Fault:\n");
|
cons->puts("\nPage Fault:\n");
|
||||||
cons->set_color();
|
cons->set_color();
|
||||||
@@ -200,7 +203,6 @@ isr_handler(cpu_state *regs)
|
|||||||
print_stacktrace(2);
|
print_stacktrace(2);
|
||||||
_halt();
|
_halt();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case isr::isrTimer:
|
case isr::isrTimer:
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void fatal(area_t area, const char *fmt, ...);
|
|||||||
} // namespace log
|
} // namespace log
|
||||||
|
|
||||||
namespace logs {
|
namespace logs {
|
||||||
#define LOG(name, lvl) extern log::area_t name;
|
#define LOG(name, lvl) extern const log::area_t name;
|
||||||
#include "log_areas.inc"
|
#include "log_areas.inc"
|
||||||
#undef LOG
|
#undef LOG
|
||||||
} // namespace logs
|
} // namespace logs
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
/// \returns An allocated element
|
/// \returns An allocated element
|
||||||
inline item_type * pop()
|
inline item_type * pop()
|
||||||
{
|
{
|
||||||
if (this->empty()) allocate();
|
if (this->empty()) this->allocate();
|
||||||
kassert(!this->empty(), "Slab allocator is empty after allocate()");
|
kassert(!this->empty(), "Slab allocator is empty after allocate()");
|
||||||
item_type *item = this->pop_front();
|
item_type *item = this->pop_front();
|
||||||
kutil::memset(item, 0, sizeof(item_type));
|
kutil::memset(item, 0, sizeof(item_type));
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
namespace kutil {
|
namespace kutil {
|
||||||
namespace logs {
|
namespace logs {
|
||||||
#define LOG(name, lvl) \
|
#define LOG(name, lvl) \
|
||||||
log::area_t name = #name ## _h; \
|
const log::area_t name = #name ## _h; \
|
||||||
const char * name ## _name = #name;
|
const char * name ## _name = #name;
|
||||||
#include "log_areas.inc"
|
#include "log_areas.inc"
|
||||||
#undef LOG
|
#undef LOG
|
||||||
@@ -19,7 +19,7 @@ using kutil::memset;
|
|||||||
using kutil::memcpy;
|
using kutil::memcpy;
|
||||||
|
|
||||||
logger *logger::s_log = nullptr;
|
logger *logger::s_log = nullptr;
|
||||||
const char *logger::s_level_names[] = {"", "debug", " info", " warn", "error", "fatal"};
|
const char *logger::s_level_names[] = {"", "debug", "info", "warn", "error", "fatal"};
|
||||||
|
|
||||||
logger::logger() :
|
logger::logger() :
|
||||||
m_buffer(nullptr, 0),
|
m_buffer(nullptr, 0),
|
||||||
|
|||||||
Reference in New Issue
Block a user