Various code fix
This commit is contained in:
parent
44fa5967dd
commit
bff24b2213
@ -41,7 +41,7 @@ void printStackTrace(unsigned int maxFrames)
|
|||||||
#else
|
#else
|
||||||
printf("Must be compiled with -fno-omit-frame-pointer for full stack\n");
|
printf("Must be compiled with -fno-omit-frame-pointer for full stack\n");
|
||||||
unsigned int *ebp = &maxFrames - 2;
|
unsigned int *ebp = &maxFrames - 2;
|
||||||
unsigned int eip = ebp[1];
|
unsigned int *eip = ebp + sizeof(unsigned int);
|
||||||
printf("[0] 0x%x\n", eip);
|
printf("[0] 0x%x\n", eip);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@ void threadExit()
|
|||||||
int threadSetup(vaddr_t mainStack, size_t mainStackSize)
|
int threadSetup(vaddr_t mainStack, size_t mainStackSize)
|
||||||
{
|
{
|
||||||
struct thread *current = (struct thread *)malloc(sizeof(struct thread));
|
struct thread *current = (struct thread *)malloc(sizeof(struct thread));
|
||||||
|
if (current == NULL)
|
||||||
|
return -ENOMEM;
|
||||||
strzcpy(current->name, "[KINIT]", THREAD_NAME_MAX_LENGTH);
|
strzcpy(current->name, "[KINIT]", THREAD_NAME_MAX_LENGTH);
|
||||||
current->stackAddr = mainStack;
|
current->stackAddr = mainStack;
|
||||||
current->stackSize = mainStackSize;
|
current->stackSize = mainStackSize;
|
||||||
@ -345,7 +347,11 @@ static void threadPrepareContext(struct thread *th)
|
|||||||
int threadChangeCurrentContext(struct mmu_context *ctx)
|
int threadChangeCurrentContext(struct mmu_context *ctx)
|
||||||
{
|
{
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
struct mmu_context *prev = currentThread->squattedContext;
|
struct mmu_context *prev;
|
||||||
|
|
||||||
|
assert(currentThread != NULL);
|
||||||
|
|
||||||
|
prev = currentThread->squattedContext;
|
||||||
|
|
||||||
if (ctx != NULL) {
|
if (ctx != NULL) {
|
||||||
assert(prev == NULL);
|
assert(prev == NULL);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
|
#include "errno.h"
|
||||||
#include "mmuContext.h"
|
#include "mmuContext.h"
|
||||||
#include "paging.h"
|
#include "paging.h"
|
||||||
|
#include "process.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "uaccess.h"
|
#include "uaccess.h"
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void testPhymem(void)
|
|||||||
assert(freePageStatAlloc == 0);
|
assert(freePageStatAlloc == 0);
|
||||||
assert((usedPageStatAlloc - usedPageStatBegin) == (uint)allocCount);
|
assert((usedPageStatAlloc - usedPageStatBegin) == (uint)allocCount);
|
||||||
|
|
||||||
while ((page = list_pop_head(allocated_page_list)) != NULL) {
|
while ((allocated_page_list != NULL) && (page = list_pop_head(allocated_page_list)) != NULL) {
|
||||||
assertmsg(page->phy_addr == (ulong)freeCount, "page %d modified", page);
|
assertmsg(page->phy_addr == (ulong)freeCount, "page %d modified", page);
|
||||||
assertmsg(unrefPhyPage((ulong)page) >= 0, "Failed to free page %d\n", (ulong)page);
|
assertmsg(unrefPhyPage((ulong)page) >= 0, "Failed to free page %d\n", (ulong)page);
|
||||||
freeCount++;
|
freeCount++;
|
||||||
|
Loading…
Reference in New Issue
Block a user