Fix warnings

This commit is contained in:
pjht 2020-08-23 08:46:38 -05:00
parent 9f5df75c9d
commit f2b9c1f481
14 changed files with 2611 additions and 2516 deletions

View File

@ -6,6 +6,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
int num_devs;
int max_devs;
@ -79,8 +80,8 @@ int main() {
rpc_register_func("mount",&devfs_mount);
rpc_register_func("open",&open);
rpc_register_func("register_dev",&register_dev);
rpc_mark_as_init();
register_fs("devfs",getpid());
serial_print("Initialized devfs\n");
rpc_mark_as_init();
}

5063
init/dump

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -5,17 +5,18 @@
#include <string.h>
#include <pthread.h>
#include <serdes.h>
#include <unistd.h>
char* initrd;
long initrd_size;
void read(char* args) {
void read(void* args) {
serdes_state state;
start_deserialize(args,&state);
deserialize_ptr(&state);
size_t size=deserialize_int(&state);
int pos=deserialize_int(&state);
rpc_deallocate_buf(args,state.buf);
rpc_deallocate_buf(args,state.sizeorpos);
long max_data=initrd_size-pos;
if (size>max_data) {
serial_print("Reading too much data from initrd\n");
@ -52,13 +53,13 @@ int main() {
initrd=malloc(initrd_size);
initrd_get(initrd);
rpc_register_func("read",&read);
rpc_mark_as_init();
serdes_state state={0};
serialize_str("initrd",&state);
serialize_int(getpid(),&state);
rpc_call(3,"register_dev",state.buf,state.sizeorpos);
free(state.buf);
serial_print("Initrd driver initialized\n");
rpc_mark_as_init();
}
// #include <dbg.h>

View File

@ -236,6 +236,6 @@ void* get_address_space() {
}
void dealloc_pages(int num_pages,void* addr) {
pmem_free((uint32_t)virt_to_phys(addr)>>12,num_pages);
pmem_free((void*)((uint32_t)virt_to_phys(addr)>>12),num_pages);
unmap_pages(addr,num_pages);
}

View File

@ -1,6 +1,7 @@
#include "serial.h"
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
void serial_write_string(const char* s) {
for (int i=0;s[i]!='\0';i++) {

View File

@ -12,6 +12,7 @@
#include "kmalloc.h"
#include <string.h>
#include "cpu/serial.h"
#include "cpu/halt.h"
/**
* Represents a thread waiting for a process to finish RPC init
@ -38,15 +39,15 @@ static void mark_init(pid_t pid) {
process_ready_bmap[byte]=process_ready_bmap[byte]|(1<<bit);
}
/**
* Mark a process as not ready to accept RPC calls
* \param pid The pid to mark
*/
static void clear_init(pid_t pid) {
size_t byte=pid/8;
size_t bit=pid%8;
process_ready_bmap[byte]=process_ready_bmap[byte]&(~(1<<bit));
}
// /**
// * Mark a process as not ready to accept RPC calls
// * \param pid The pid to mark
// */
// static void clear_init(pid_t pid) {
// size_t byte=pid/8;
// size_t bit=pid%8;
// process_ready_bmap[byte]=process_ready_bmap[byte]&(~(1<<bit));
// }
char kernel_rpc_is_init(pid_t pid) {
size_t byte=pid/8;

View File

@ -7,7 +7,7 @@
#include <stddef.h>
typedef void* (*rpc_func)(void*); //!< Type of an RPC function
typedef void (*rpc_func)(void*); //!< Type of an RPC function
/**
* Represents an RPC fumctiom with name

View File

@ -157,7 +157,7 @@ pid_t tasking_new_thread(void* start,pid_t pid,void* param) {
*/
static Thread* get_next_ready_thread(Thread* thread,Thread* thread_to_skip) {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define HELPER \
#define HELPER \
while (thread&&(thread->state!=THREAD_READY||SAME_THREAD(thread,thread_to_skip))) { \
thread=thread->next_thread_in_process; \
}

View File

@ -4,7 +4,7 @@
#include <sys/types.h>
#include <stddef.h>
typedef void* (*rpc_func)(void*); //!< Type of an RPC function
typedef void (*rpc_func)(void*); //!< Type of an RPC function
/**
* Call an RPC function

View File

@ -23,14 +23,12 @@ void __stdio_init() {
FILE* fopen(char* filename,char* mode) {
serdes_state state={0};
serialize_int(1,&state);
serialize_int(0,&state);
serialize_str(filename,&state);
void* retval=rpc_call(2,"open",state.buf,state.sizeorpos);
free(state.buf);
start_deserialize(retval,&state);
int err=deserialize_int(&state);
void* fs_data=deserialize_int(&state);
void* fs_data=deserialize_ptr(&state);
pid_t fs_pid=deserialize_int(&state);
rpc_deallocate_buf(retval,state.sizeorpos);
if (err) {
@ -144,7 +142,7 @@ size_t fwrite(void* buffer_ptr,size_t size,size_t count,FILE* stream) {
void register_fs(const char* name,pid_t pid) {
serdes_state state={0};
serialize_str(name,&state);
serialize_str((char*)name,&state);
serialize_int(pid,&state);
rpc_call(2,"register_fs",state.buf,state.sizeorpos);
}
@ -257,4 +255,5 @@ int fseek(FILE* stream,long offset,int origin) {
default:
break;
}
return 0;
}

View File

@ -27,6 +27,6 @@
#define SYSCALL_DEALLOCTATE_RPC_RET 17
#define SYSCALL_RPC_RET 18
#define SYSCALL_RPC_MARK_AS_INIT 21
#define SYSCALL_RPC_IS_INIT 22
#endif

View File

@ -30,7 +30,7 @@ static int vfsstrcmp(const char* s1,const char* s2) {
mount_point* mount_point_list=NULL;
fs_type* fs_type_list=NULL;
void vfs_mount(char* args) {
void vfs_mount(void* args) {
serdes_state state;
start_deserialize(args,&state);
char* type=deserialize_str(&state);
@ -39,7 +39,6 @@ void vfs_mount(char* args) {
rpc_deallocate_buf(args,state.sizeorpos);
fs_type* fstype=fs_type_list;
pid_t fs_pid=0;
size_t mntpnt_len=0;
for (;fstype!=NULL;fstype=fstype->next) {
if (vfsstrcmp(type,fstype->name)==0) {
fs_pid=fstype->fs_pid;
@ -74,7 +73,7 @@ void vfs_mount(char* args) {
pthread_exit(NULL);
}
void vfs_register_fs(char* args) {
void vfs_register_fs(void* args) {
serdes_state state;
start_deserialize(args,&state);
char* name=deserialize_str(&state);
@ -89,11 +88,9 @@ void vfs_register_fs(char* args) {
pthread_exit(NULL);
}
void open(char* args) {
void open(void* args) {
serdes_state state;
start_deserialize(args,&state);
pid_t pid=deserialize_int(&state);
int perms=deserialize_int(&state);
char* path=deserialize_str(&state);
rpc_deallocate_buf(args,state.sizeorpos);
mount_point* mnt=mount_point_list;

View File

@ -2,6 +2,8 @@
#include <serdes.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <dbg.h>
#include "vga.h"
void write(void* args) {
@ -9,9 +11,9 @@ void write(void* args) {
start_deserialize(args,&state);
deserialize_ptr(&state);
size_t size=deserialize_int(&state);
int pos=deserialize_int(&state);
deserialize_int(&state);
char* buf=deserialize_ary(size,&state);
rpc_deallocate_buf(args,state.buf);
rpc_deallocate_buf(args,state.sizeorpos);
vga_write_string(buf);
state.buf=NULL;
state.sizeorpos=0;
@ -24,11 +26,11 @@ void write(void* args) {
int main() {
vga_init();
rpc_register_func("write",&write);
rpc_mark_as_init();
serdes_state state={0};
serialize_str("vga",&state);
serialize_int(getpid(),&state);
rpc_call(3,"register_dev",state.buf,state.sizeorpos);
free(state.buf);
serial_print("VGA driver initialized\n");
rpc_mark_as_init();
}