more debugging
This commit is contained in:
parent
479553d12b
commit
cab68ebc36
@ -206,8 +206,7 @@ int fault_handler(struct regs *r) {
|
||||
kprintf("Kernel Page Fault: %p\n", fault_address);
|
||||
print_regs(r);
|
||||
gui_flip();
|
||||
while (1)
|
||||
;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
4
ipv4.c
4
ipv4.c
@ -72,9 +72,10 @@ void ipv4_fragment_trim() {
|
||||
hashmap_iterate(ipv4_frag_map, ipv4_fragment_trim_iter, &totrim);
|
||||
|
||||
for (size_t i = 0; i < ptr_vector_len(&totrim); i++) {
|
||||
struct ipv4_frag_t *frag = (struct ipv4_frag_t *)ptr_vector_get(&totrim, i);
|
||||
struct ipv4_frag_t *frag = (struct ipv4_frag_t *)ptr_vector_del(&totrim, 0);
|
||||
|
||||
hashmap_remove(ipv4_frag_map, frag->key);
|
||||
|
||||
if (frag->first_packet != NULL) {
|
||||
dbfree(frag->first_packet, "ipv4_fragment_trim 1");
|
||||
}
|
||||
@ -87,6 +88,7 @@ void ipv4_fragment_trim() {
|
||||
if (frag->middle_packet_count > 0) {
|
||||
dbfree(frag->middle_packets, "ipv4_fragment_trim 4");
|
||||
}
|
||||
dbfree(frag, "ipv4_fragment_trim 5");
|
||||
}
|
||||
|
||||
destroy_ptr_vector(&totrim);
|
||||
|
8
kernel.c
8
kernel.c
@ -40,7 +40,9 @@ void __assert_fail(const char *__assertion, const char *__file, unsigned int __l
|
||||
void abort(void) {
|
||||
kprintf("Abort.\n");
|
||||
for (int i = 0; i < 20; i++) {
|
||||
kprintf("DBMALLOC[%d]. %s\n", i, db_malloc_caller[i]);
|
||||
if (db_malloc_caller[i] != NULL) {
|
||||
kprintf("DBMALLOC[%d]. %s\n", i, db_malloc_caller[i]);
|
||||
}
|
||||
}
|
||||
kprintf("PID: %d (%s)\n", current_task->pid, current_task->name);
|
||||
kprintf("LAST SYSCALL %d\n", last_syscall);
|
||||
@ -51,7 +53,9 @@ void abort(void) {
|
||||
void abort_on_usage(void *m) {
|
||||
kprintf("Abort on Usage error\n");
|
||||
for (int i = 0; i < 20; i++) {
|
||||
kprintf("DBMALLOC[%d]. %s\n", i, db_malloc_caller[i]);
|
||||
if (db_malloc_caller[i] != NULL) {
|
||||
kprintf("DBMALLOC[%d]. %s\n", i, db_malloc_caller[i]);
|
||||
}
|
||||
}
|
||||
kprintf("PID: %d\n", current_task->pid);
|
||||
kprintf("LAST SYSCALL %d\n", last_syscall);
|
||||
|
16
string.c
16
string.c
@ -4,12 +4,15 @@
|
||||
|
||||
void memset(char *ptr, char value, int len) {
|
||||
int i;
|
||||
assert(ptr != NULL);
|
||||
for (i = 0; i < len; i++) {
|
||||
ptr[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
void *memmove(void *dest, const void *src, uint32_t n) {
|
||||
assert(dest != NULL && src != NULL);
|
||||
|
||||
char *pDest = (char *)dest;
|
||||
const char *pSrc = (const char *)src;
|
||||
// allocate memory for tmp array
|
||||
@ -32,6 +35,7 @@ void *memmove(void *dest, const void *src, uint32_t n) {
|
||||
}
|
||||
|
||||
void memcpy(void *dest, void *src, int size) {
|
||||
assert(dest != NULL && src != NULL);
|
||||
uint8_t *pdest = (uint8_t *)dest;
|
||||
uint8_t *psrc = (uint8_t *)src;
|
||||
|
||||
@ -51,6 +55,7 @@ void memcpy(void *dest, void *src, int size) {
|
||||
}
|
||||
|
||||
char *strncpy(char *dest, const char *src, int len) {
|
||||
assert(dest != NULL && src != NULL);
|
||||
const char *ptr = src;
|
||||
char *ptr2 = dest;
|
||||
int i = 0;
|
||||
@ -67,6 +72,7 @@ char *strncpy(char *dest, const char *src, int len) {
|
||||
}
|
||||
|
||||
char *strcpy(char *dest, const char *src) {
|
||||
assert(dest != NULL && src != NULL);
|
||||
const char *ptr = src;
|
||||
char *ptr2 = dest;
|
||||
while (*ptr != '\0') {
|
||||
@ -79,6 +85,9 @@ char *strcpy(char *dest, const char *src) {
|
||||
}
|
||||
|
||||
int memcmp(const uint8_t *m1, const uint8_t *m2, int size) {
|
||||
|
||||
assert(m1 != NULL && m2 != NULL);
|
||||
|
||||
while ((*m1) && (*m1 == *m2) && size > 0) {
|
||||
--size;
|
||||
++m1;
|
||||
@ -88,6 +97,8 @@ int memcmp(const uint8_t *m1, const uint8_t *m2, int size) {
|
||||
}
|
||||
|
||||
int strncmp(const char *s1, const char *s2, int n) {
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
while ((*s1) && (*s1 == *s2) && n > 0) {
|
||||
--n;
|
||||
++s1;
|
||||
@ -97,6 +108,8 @@ int strncmp(const char *s1, const char *s2, int n) {
|
||||
}
|
||||
|
||||
int strcmp(const char *s1, const char *s2) {
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
while ((*s1) && (*s1 == *s2)) {
|
||||
++s1;
|
||||
++s2;
|
||||
@ -107,6 +120,8 @@ int strcmp(const char *s1, const char *s2) {
|
||||
int strlen(const char *str) {
|
||||
int i = 0;
|
||||
|
||||
assert(str != NULL);
|
||||
|
||||
while (*str != '\0') {
|
||||
str++;
|
||||
i++;
|
||||
@ -115,6 +130,7 @@ int strlen(const char *str) {
|
||||
}
|
||||
|
||||
char *strcat(char *dest, const char *src) {
|
||||
assert(dest != NULL && src != NULL);
|
||||
char *ptr = dest;
|
||||
while (*dest != '\0') {
|
||||
dest++;
|
||||
|
6
vfs.c
6
vfs.c
@ -410,6 +410,7 @@ void vfs_close_file(int fno) {
|
||||
if (current_task->filehandles[fno].info->ref == 0) {
|
||||
free(current_task->filehandles[fno].info);
|
||||
}
|
||||
free(current_task->filehandles[fno].filepath);
|
||||
current_task->filehandles[fno].device = NULL;
|
||||
break;
|
||||
case 3:
|
||||
@ -802,17 +803,18 @@ int vfs_open_file_dev(struct vfs_device_t *device, char *path, int flags, int mo
|
||||
}
|
||||
}
|
||||
if (i == 256) {
|
||||
dbfree(temppath, "vfs_open file dev 4");
|
||||
return -1;
|
||||
}
|
||||
|
||||
current_task->filehandles[i].free = 0;
|
||||
current_task->filehandles[i].device = device;
|
||||
current_task->filehandles[i].filepath = NULL;
|
||||
current_task->filehandles[i].filepath = (char *)dbmalloc(strlen(temppath) + 1, "vfs_open file dev 4");
|
||||
strcpy(current_task->filehandles[i].filepath, temppath);
|
||||
current_task->filehandles[i].info = (struct vfs_file_handle_info_t *)dbmalloc(sizeof(struct vfs_file_handle_info_t), "vfs_open file dev 3");
|
||||
current_task->filehandles[i].info->position = 0;
|
||||
current_task->filehandles[i].info->size = 0;
|
||||
current_task->filehandles[i].info->ref = 1;
|
||||
|
||||
dbfree(temppath, "vfs_open file dev 4");
|
||||
return i;
|
||||
case 3: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user