Fix most warnings

This commit is contained in:
pjht 2019-06-29 09:04:34 -05:00
parent 51bb986d76
commit 7611d929a3
11 changed files with 50 additions and 18 deletions

View File

@ -100,8 +100,8 @@ int main(char* initrd, uint32_t initrd_sz) {
vfs_message* msg_data=malloc(sizeof(vfs_message));
msg_data->type=VFS_OPEN;
msg_data->id=1;
strcpy(&msg_data->mode,"r");
strcpy(&msg_data->path,"/dev/sda");
strcpy(&msg_data->mode[0],"r");
strcpy(&msg_data->path[0],"/dev/sda");
Message msg;
msg.from=box;
msg.to=1;
@ -126,7 +126,7 @@ int main(char* initrd, uint32_t initrd_sz) {
vga_write_string(str);
vga_write_string("\n");
vga_write_string("Mode ");
vga_write_string(&vfs_msg->mode);
vga_write_string(&vfs_msg->mode[0]);
vga_write_string("\n");
vga_write_string("FD ");
str[0]='\0';
@ -134,7 +134,7 @@ int main(char* initrd, uint32_t initrd_sz) {
vga_write_string(str);
vga_write_string("\n");
vga_write_string("Path ");
vga_write_string(&vfs_msg->path);
vga_write_string(&vfs_msg->path[0]);
vga_write_string("\n");
}
for(;;);

View File

@ -14,7 +14,7 @@ void* address_spaces_put_data(void* cr3, void* data,uint32_t size) {
asm volatile("movl %%cr3, %%eax; movl %%eax, %0;":"=m"(old_cr3)::"%eax");
void* phys_addr=virt_to_phys(data);
load_smap((uint32_t)cr3);
void* virt_addr=find_free_pages((size/4096)+1)<<12;
void* virt_addr=(void*)(find_free_pages((size/4096)+1)<<12);
map_pages(virt_addr,phys_addr,(size/4096)+1,1,1);
load_smap(old_cr3);
return virt_addr;

View File

@ -9,6 +9,7 @@
#include "interrupt.h"
#include "address_spaces.h"
#include "mailboxes.h"
#include <mailboxes.h>
#include <string.h>
#include <stdint.h>
void irq_handler(registers_t r);
@ -187,7 +188,7 @@ void isr_handler(registers_t r) {
} else if (r.eax==5) {
r.ebx=(uint32_t)tasking_get_errno_address();
} else if (r.eax==6) {
kernel_mailbox_get_msg(r.ebx,r.ecx,r.edx);
kernel_mailbox_get_msg(r.ebx,(Message*)r.ecx,r.edx);
} else if (r.eax==7) {
kernel_mailbox_send_msg((Message*)r.ebx);
} else if (r.eax==8) {
@ -204,7 +205,7 @@ void isr_handler(registers_t r) {
uint32_t page_idx=find_free_pages(r.ecx);
void* virt_addr=(void*)(page_idx<<12);
map_pages(virt_addr,(void*)r.ebx,r.ecx,1,1);
r.ebx=virt_addr;
r.ebx=(uint32_t)virt_addr;
} else if (r.eax==12) {
tasking_createTaskCr3KmodeParam((void*)r.ebx,(void*)r.ecx,0,1,r.edx,1,r.esi);
} else if (r.eax==13) {

View File

@ -4,7 +4,7 @@
#include <stdint.h>
#include <mailboxes.h>
Mailbox* mailboxes=0xF6400000;
Mailbox* mailboxes=(Mailbox*)0xF6400000;
uint32_t next_box=0;
uint32_t kernel_mailbox_new(uint16_t size) {

View File

@ -46,7 +46,7 @@ void map_pages(void* virt_addr_ptr,void* phys_addr_ptr,int num_pages,char usr,ch
}
void map_kstack(uint32_t pid) {
if (kstack_page_tables[pid]==NULL) {
if (!(kstack_page_tables[pid]&0x1)) {
kstack_page_tables[pid]=(uint32_t)pmem_alloc(1)|0x3;
}
}
@ -158,7 +158,7 @@ void unmap_pages(void* start_virt,uint32_t num_pages) {
uint32_t virt_addr=(uint32_t)start_virt;
int dir_entry=(virt_addr&0xFFC00000)>>22;
int table_entry=(virt_addr&0x3FF000)>>12;
for (int i=0;i<=num_pages;i++) {
for (uint32_t i=0;i<=num_pages;i++) {
if (smap[dir_entry]&0x1) {
smap_page_tables[dir_entry+1]=(smap[dir_entry]&0xFFFFFC00)|0x3;
smap[(1024+(1024*dir_entry))+table_entry]=0;

View File

@ -10,10 +10,11 @@
#include "paging.h"
#include <stdint.h>
#include <stdlib.h>
#include "../halt.h"
#define STACK_PAGES 2
extern void task_init();
static uint32_t* kstacks=(char*)0xF6800000;
static uint32_t* kstacks=(uint32_t*)0xF6800000;
uint32_t next_pid;
@ -56,7 +57,7 @@ Task* tasking_createTaskCr3KmodeParam(void* eip,void* cr3,char kmode,char param1
kstacks[top_idx-4]=0;
kstacks[top_idx-3]=0;
kstacks[top_idx-2]=0;
kstacks[top_idx-1]=eip;
kstacks[top_idx-1]=(uint32_t)eip;
} else {
uint32_t top_idx=(1024*(next_pid+1));
task->kernel_esp=((uint32_t)(&kstacks[top_idx-7]));
@ -65,13 +66,13 @@ Task* tasking_createTaskCr3KmodeParam(void* eip,void* cr3,char kmode,char param1
kstacks[top_idx-6]=0;
kstacks[top_idx-5]=0;
kstacks[top_idx-4]=0;
kstacks[top_idx-3]=task_init;
uint32_t* user_stack=(((uint32_t)alloc_pages(1))+0x1000);
kstacks[top_idx-3]=(uint32_t)task_init;
uint32_t* user_stack=(uint32_t*)(((uint32_t)alloc_pages(1))+0x1000);
user_stack-=2;
user_stack[0]=param1;
user_stack[1]=param2;
kstacks[top_idx-2]=user_stack;
kstacks[top_idx-1]=eip;
kstacks[top_idx-2]=(uint32_t)user_stack;
kstacks[top_idx-1]=(uint32_t)eip;
}
load_address_space(old_cr3);
task->next=NULL;

View File

@ -3,7 +3,7 @@
#include "tasking.h"
void switchTask(uint32_t stack);
void switch_to_task(Task* task);
uint32_t readEip();
#endif

View File

@ -7,6 +7,6 @@
void tasking_init();
void tasking_yield();
Task* tasking_createTask(void* eip);
Task* tasking_createTaskCr3(void* eip,void* cr3);
Task* tasking_createTaskCr3KmodeParam(void* eip,void* cr3,char kmode,char param1_exists,uint32_t param1_arg,char param2_exists,uint32_t param2_arg);
char isPrivleged(uint32_t pid);
#endif

27
log Normal file
View File

@ -0,0 +1,27 @@
kernel/cpu/i386/isr.c:91:14: warning: 'exception_messages' defined but not used [-Wunused-variable]
static char *exception_messages[] = {
^~~~~~~~~~~~~~~~~~
kernel/cpu/i386/pmem.c: In function 'pmem_alloc':
kernel/cpu/i386/pmem.c:72:16: warning: comparison is always true due to limited range of data type [-Wtype-limits]
if (bmap[i]!=0xFF) {
^~
libc/stdlib.c: In function 'malloc':
libc/stdlib.c:68:20: warning: comparison is always true due to limited range of data type [-Wtype-limits]
if (bmap[i]!=0xFF) {
^~
grub-mkrescue: warning: cannot open directory `/usr/local/Cellar/i386-elf-grub/2.02/share/locale': No such file or directory.
GNU xorriso 1.4.8 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:os.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 33.5g free
Added to ISO image: directory '/'='/tmp/grub.i7L624'
xorriso : UPDATE : 279 files added in 1 seconds
Added to ISO image: directory '/'='/Users/peterterpstra/Desktop/projects/os/iso'
xorriso : UPDATE : 286 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/local/Cellar/i386-elf-grub/2.02/lib/grub/i386-pc/boot_hybrid.img'
ISO image produced: 1294 sectors
Written to medium : 1294 sectors at LBA 0
Writing to 'stdio:os.iso' completed successfully.

View File

@ -19,4 +19,6 @@ typedef struct {
uint32_t mailbox_new(uint16_t size);
void mailbox_send_msg(Message* msg);
void mailbox_get_msg(uint32_t box, Message* recv_msg, uint32_t buffer_sz);
#endif

View File

@ -1,6 +1,7 @@
#include <tasking.h>
#include <ipc/vfs.h>
#include <mailboxes.h>
#include <stdlib.h>
int main() {
uint32_t box=mailbox_new(16);