Add syscall to check whether a process has finished RPC initialization.
This commit is contained in:
parent
9dde61b9df
commit
9f5df75c9d
@ -129,8 +129,10 @@ int main() {
|
|||||||
initrd_get(initrd);
|
initrd_get(initrd);
|
||||||
size_t datapos=find_loc("vfs",initrd);
|
size_t datapos=find_loc("vfs",initrd);
|
||||||
load_proc(datapos,initrd);
|
load_proc(datapos,initrd);
|
||||||
|
while(rpc_is_init(2)==0);
|
||||||
datapos=find_loc("devfs",initrd);
|
datapos=find_loc("devfs",initrd);
|
||||||
load_proc(datapos,initrd);
|
load_proc(datapos,initrd);
|
||||||
|
while(rpc_is_init(3)==0);
|
||||||
int err=mount("","devfs","/dev");
|
int err=mount("","devfs","/dev");
|
||||||
if (err) {
|
if (err) {
|
||||||
serial_print("Failed to mount devfs\n");
|
serial_print("Failed to mount devfs\n");
|
||||||
@ -138,11 +140,11 @@ int main() {
|
|||||||
}
|
}
|
||||||
datapos=find_loc("initrd_drv",initrd);
|
datapos=find_loc("initrd_drv",initrd);
|
||||||
load_proc(datapos,initrd);
|
load_proc(datapos,initrd);
|
||||||
for(int i=0;i<10000000;i++);
|
while(rpc_is_init(4)==0);
|
||||||
serial_print("Loading VGA driver\n");
|
serial_print("Loading VGA driver\n");
|
||||||
datapos=find_loc("vga_drv",initrd);
|
datapos=find_loc("vga_drv",initrd);
|
||||||
load_proc_devfs(datapos);
|
load_proc_devfs(datapos);
|
||||||
for(int i=0;i<10000000;i++);
|
while(rpc_is_init(5)==0);
|
||||||
serial_print("Opening /dev/vga\n");
|
serial_print("Opening /dev/vga\n");
|
||||||
stdout=fopen("/dev/vga","w");
|
stdout=fopen("/dev/vga","w");
|
||||||
if (!stdout) {
|
if (!stdout) {
|
||||||
|
Binary file not shown.
@ -290,6 +290,9 @@ void isr_handler(registers_t* r) {
|
|||||||
case SYSCALL_RPC_MARK_AS_INIT:
|
case SYSCALL_RPC_MARK_AS_INIT:
|
||||||
kernel_rpc_mark_as_init();
|
kernel_rpc_mark_as_init();
|
||||||
break;
|
break;
|
||||||
|
case SYSCALL_RPC_IS_INIT:
|
||||||
|
r->ecx=kernel_rpc_is_init((pid_t)r->ebx);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
10
kernel/rpc.c
10
kernel/rpc.c
@ -48,13 +48,7 @@ static void clear_init(pid_t pid) {
|
|||||||
process_ready_bmap[byte]=process_ready_bmap[byte]&(~(1<<bit));
|
process_ready_bmap[byte]=process_ready_bmap[byte]&(~(1<<bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char kernel_rpc_is_init(pid_t pid) {
|
||||||
/**
|
|
||||||
* Check if a process is ready to accept RPC calls
|
|
||||||
* \param pid The pid to check
|
|
||||||
* \return whether the process is ready
|
|
||||||
*/
|
|
||||||
static char is_init(pid_t pid) {
|
|
||||||
size_t byte=pid/8;
|
size_t byte=pid/8;
|
||||||
size_t bit=pid%8;
|
size_t bit=pid%8;
|
||||||
char entry=process_ready_bmap[byte];
|
char entry=process_ready_bmap[byte];
|
||||||
@ -63,7 +57,7 @@ static char is_init(pid_t pid) {
|
|||||||
|
|
||||||
void* kernel_rpc_call(pid_t pid,char* name,void* buf,size_t size) {
|
void* kernel_rpc_call(pid_t pid,char* name,void* buf,size_t size) {
|
||||||
//serial_printf("PID %d calling %s on PID %d\n",tasking_get_PID(),name,pid);
|
//serial_printf("PID %d calling %s on PID %d\n",tasking_get_PID(),name,pid);
|
||||||
if (is_init(pid)==0) {
|
if (kernel_rpc_is_init(pid)==0) {
|
||||||
rpc_waiting_thread* waiting_thread=kmalloc(sizeof(rpc_waiting_thread));
|
rpc_waiting_thread* waiting_thread=kmalloc(sizeof(rpc_waiting_thread));
|
||||||
if (waiting_thread==NULL) {
|
if (waiting_thread==NULL) {
|
||||||
serial_printf("Kmalloc unable to allocate waiting_thread\n");
|
serial_printf("Kmalloc unable to allocate waiting_thread\n");
|
||||||
|
@ -59,4 +59,12 @@ size_t kernel_get_num_rpc_funcs(pid_t pid);
|
|||||||
* Mark the current process as ready to accept RPC calls
|
* Mark the current process as ready to accept RPC calls
|
||||||
*/
|
*/
|
||||||
void kernel_rpc_mark_as_init();
|
void kernel_rpc_mark_as_init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a process is ready to accept RPC calls
|
||||||
|
* \param pid The pid to check
|
||||||
|
* \return whether the process is ready
|
||||||
|
*/
|
||||||
|
char kernel_rpc_is_init(pid_t pid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,3 +41,11 @@ void rpc_mark_as_init() {
|
|||||||
int $80; \
|
int $80; \
|
||||||
"::);
|
"::);
|
||||||
}
|
}
|
||||||
|
char rpc_is_init(pid_t pid) {
|
||||||
|
char is_init;
|
||||||
|
asm volatile(" \
|
||||||
|
mov $" QU(SYSCALL_RPC_IS_INIT) ", %%eax; \
|
||||||
|
int $80; \
|
||||||
|
":"=c"(is_init):"b"(pid));
|
||||||
|
return is_init;
|
||||||
|
}
|
||||||
|
@ -43,4 +43,11 @@ void rpc_return(void* buf,size_t size);
|
|||||||
*/
|
*/
|
||||||
void rpc_mark_as_init();
|
void rpc_mark_as_init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a process is ready to accept RPC calls
|
||||||
|
* \param pid The pid to check
|
||||||
|
* \return whether the process is ready
|
||||||
|
*/
|
||||||
|
char rpc_is_init(pid_t pid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user