Remove debug code from terminal.cpp. Update kmain, update world.c, update process.cpp to construct the initial value of EBP correctly.
This commit is contained in:
parent
d6c1cc1869
commit
5d4454e57a
@ -73,11 +73,11 @@ __attribute__((interrupt)) void context_switch(interrupt_frame* frame) {
|
|||||||
processes->start->next->prev = processes->start;
|
processes->start->next->prev = processes->start;
|
||||||
processes->end->prev->next = processes->end;
|
processes->end->prev->next = processes->end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the next process.
|
|
||||||
nextProc = processes->start->elem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the next process.
|
||||||
|
nextProc = processes->start->elem;
|
||||||
|
|
||||||
Global::currentProc = nextProc;
|
Global::currentProc = nextProc;
|
||||||
|
|
||||||
uint32_t cESP;
|
uint32_t cESP;
|
||||||
@ -94,7 +94,7 @@ __attribute__((interrupt)) void context_switch(interrupt_frame* frame) {
|
|||||||
asm ("popa");
|
asm ("popa");
|
||||||
|
|
||||||
// Clear the garbage that was on the stack from previous switch_context call.
|
// Clear the garbage that was on the stack from previous switch_context call.
|
||||||
asm ("add $84, %esp");
|
asm ("mov %ebp, %esp");
|
||||||
|
|
||||||
// Pop EBP
|
// Pop EBP
|
||||||
asm ("pop %ebp");
|
asm ("pop %ebp");
|
||||||
|
@ -47,7 +47,7 @@ int main() {
|
|||||||
Global::currentProc = &kernel;
|
Global::currentProc = &kernel;
|
||||||
|
|
||||||
Process* p1 = kernel.createProcess("WORLD BIN");
|
Process* p1 = kernel.createProcess("WORLD BIN");
|
||||||
Process* p2 = kernel.createProcess("HELLO BIN");
|
//Process* p2 = kernel.createProcess("HELLO BIN");
|
||||||
|
|
||||||
init_keyboard();
|
init_keyboard();
|
||||||
|
|
||||||
|
@ -59,6 +59,8 @@ Process::Process(uint32_t PID, PageDirectory* inherit, uint32_t inheritBase, cha
|
|||||||
stack32--;
|
stack32--;
|
||||||
*stack32 = ((uint32_t)this->stack + 0x8000); // EBP
|
*stack32 = ((uint32_t)this->stack + 0x8000); // EBP
|
||||||
|
|
||||||
|
uint32_t rEBP = stack32;
|
||||||
|
|
||||||
stack32 -= 21;
|
stack32 -= 21;
|
||||||
|
|
||||||
stack32--;
|
stack32--;
|
||||||
@ -72,7 +74,7 @@ Process::Process(uint32_t PID, PageDirectory* inherit, uint32_t inheritBase, cha
|
|||||||
stack32--;
|
stack32--;
|
||||||
*stack32 = 0; // ESP
|
*stack32 = 0; // ESP
|
||||||
stack32--;
|
stack32--;
|
||||||
*stack32 = (uint32_t)this->stack + 0x7ffc; // EBP
|
*stack32 = rEBP; // EBP
|
||||||
stack32--;
|
stack32--;
|
||||||
*stack32 = 0; // ESI
|
*stack32 = 0; // ESI
|
||||||
stack32--;
|
stack32--;
|
||||||
|
@ -20,8 +20,6 @@ struct AllocTracker {
|
|||||||
|
|
||||||
class Process : public Allocator {
|
class Process : public Allocator {
|
||||||
private:
|
private:
|
||||||
uint32_t PID;
|
|
||||||
|
|
||||||
uint32_t last_page_pointer;
|
uint32_t last_page_pointer;
|
||||||
uint32_t page_remaining;
|
uint32_t page_remaining;
|
||||||
|
|
||||||
@ -33,6 +31,7 @@ private:
|
|||||||
xnoe::Maybe<xnoe::linkedlistelem<AllocTracker>*> get_alloc_tracker(uint32_t address);
|
xnoe::Maybe<xnoe::linkedlistelem<AllocTracker>*> get_alloc_tracker(uint32_t address);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
uint32_t PID;
|
||||||
uint32_t esp;
|
uint32_t esp;
|
||||||
|
|
||||||
Process(uint32_t PID, void* stack, PageDirectory* page_directory, PageMap* phys, PageMap* virt, uint32_t virt_alloc_base);
|
Process(uint32_t PID, void* stack, PageDirectory* page_directory, PageMap* phys, PageMap* virt, uint32_t virt_alloc_base);
|
||||||
|
@ -63,10 +63,8 @@ void Terminal::printf(const char* string, ...) {
|
|||||||
this->cur_y++;
|
this->cur_y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->cur_y == this->height) {
|
if (this->cur_y == this->height)
|
||||||
this->scroll_up();
|
this->scroll_up();
|
||||||
printf("This gets called...");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current == '%') {
|
if (current == '%') {
|
||||||
int type = string[index++];
|
int type = string[index++];
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
#include "../common/common.h"
|
#include "../common/common.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
char buffer[2];
|
||||||
|
buffer[0] = 0;
|
||||||
|
buffer[1] = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
print("World");
|
buffer[0] = getch();
|
||||||
|
print(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user