Fix warnings

This commit is contained in:
pjht 2019-04-21 14:19:52 -05:00
parent 2697eb9551
commit d78e7743ce
4 changed files with 8 additions and 6 deletions

View File

@ -35,7 +35,7 @@ static Task* createTaskKmode(void* eip,char kmode) {
task->regs.edi=0; task->regs.edi=0;
asm volatile("pushfl; movl (%%esp), %%eax; movl %%eax, %0; popfl;":"=m"(task->regs.eflags)::"%eax"); asm volatile("pushfl; movl (%%esp), %%eax; movl %%eax, %0; popfl;":"=m"(task->regs.eflags)::"%eax");
task->regs.eip=(uint32_t)eip; task->regs.eip=(uint32_t)eip;
task->regs.cr3=new_address_space(); task->regs.cr3=(uint32_t)new_address_space();
uint32_t cr3; uint32_t cr3;
asm volatile("movl %%cr3, %%eax; movl %%eax, %0;":"=m"(cr3)::"%eax"); asm volatile("movl %%cr3, %%eax; movl %%eax, %0;":"=m"(cr3)::"%eax");
load_address_space(task->regs.cr3); load_address_space(task->regs.cr3);

View File

@ -177,7 +177,7 @@ int write_char(inode node,uint8_t c,uint64_t pos,FILE* f,int num) {
return EFBIG; return EFBIG;
} else { } else {
if (node.i_block[blk_idx]==0) { if (node.i_block[blk_idx]==0) {
for (int i=0;i<=blk_idx;i++) { for (uint32_t i=0;i<=blk_idx;i++) {
// node.i_block[blk_idx]=reserve_block(f,num); // node.i_block[blk_idx]=reserve_block(f,num);
return 0; return 0;
} }
@ -187,7 +187,7 @@ int write_char(inode node,uint8_t c,uint64_t pos,FILE* f,int num) {
} }
} }
uint32_t offset=pos%blk_size[num]; uint32_t offset=pos%blk_size[num];
if (blk_idx>12||(node.i_block[blk_idx]==0)) return; if (blk_idx>12||(node.i_block[blk_idx]==0)) return 0;
uint32_t blk=node.i_block[blk_idx]; uint32_t blk=node.i_block[blk_idx];
uint8_t* block=read_blk(blk,f,num); uint8_t* block=read_blk(blk,f,num);
block[offset]=c; block[offset]=c;

View File

@ -16,6 +16,7 @@
#include "elf.h" #include "elf.h"
#include <errno.h> #include <errno.h>
#include "../drivers/ide.h" #include "../drivers/ide.h"
#include "parts.h"
#include "../fs/ext2.h" #include "../fs/ext2.h"
static long initrd_sz; static long initrd_sz;

View File

@ -2,6 +2,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <klog.h>
#include "../fs/devfs.h" #include "../fs/devfs.h"
typedef struct { typedef struct {
@ -13,7 +14,7 @@ typedef struct {
uint32_t length; uint32_t length;
} partition; } partition;
static char** part_devs=NULL; static const char** part_devs=NULL;
static partition** parts=NULL; static partition** parts=NULL;
static uint32_t num_part_devs=0; static uint32_t num_part_devs=0;
static uint32_t max_part_devs=0; static uint32_t max_part_devs=0;
@ -37,7 +38,7 @@ int drv(char* filename,int c,long pos,char wr) {
char* str=malloc(sizeof(char)*(strlen(filename)+1)); char* str=malloc(sizeof(char)*(strlen(filename)+1));
strcpy(str,filename); strcpy(str,filename);
str[strlen(str)-1]='\0'; str[strlen(str)-1]='\0';
int i; uint32_t i;
for (i=0;i<num_part_devs;i++) { for (i=0;i<num_part_devs;i++) {
if (strcmp(part_devs[i]+5,str)==0) { if (strcmp(part_devs[i]+5,str)==0) {
break; break;
@ -63,7 +64,7 @@ int drv(char* filename,int c,long pos,char wr) {
} else { } else {
FILE* f=fopen(part_devs[i],"r"); FILE* f=fopen(part_devs[i],"r");
fseek(f,pos,SEEK_SET); fseek(f,pos,SEEK_SET);
char* c=fgetc(f); int c=fgetc(f);
fclose(f); fclose(f);
return c; return c;
} }