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);
|
||||
size_t datapos=find_loc("vfs",initrd);
|
||||
load_proc(datapos,initrd);
|
||||
while(rpc_is_init(2)==0);
|
||||
datapos=find_loc("devfs",initrd);
|
||||
load_proc(datapos,initrd);
|
||||
while(rpc_is_init(3)==0);
|
||||
int err=mount("","devfs","/dev");
|
||||
if (err) {
|
||||
serial_print("Failed to mount devfs\n");
|
||||
@ -138,11 +140,11 @@ int main() {
|
||||
}
|
||||
datapos=find_loc("initrd_drv",initrd);
|
||||
load_proc(datapos,initrd);
|
||||
for(int i=0;i<10000000;i++);
|
||||
while(rpc_is_init(4)==0);
|
||||
serial_print("Loading VGA driver\n");
|
||||
datapos=find_loc("vga_drv",initrd);
|
||||
load_proc_devfs(datapos);
|
||||
for(int i=0;i<10000000;i++);
|
||||
while(rpc_is_init(5)==0);
|
||||
serial_print("Opening /dev/vga\n");
|
||||
stdout=fopen("/dev/vga","w");
|
||||
if (!stdout) {
|
||||
|
Binary file not shown.
@ -290,6 +290,9 @@ void isr_handler(registers_t* r) {
|
||||
case SYSCALL_RPC_MARK_AS_INIT:
|
||||
kernel_rpc_mark_as_init();
|
||||
break;
|
||||
case SYSCALL_RPC_IS_INIT:
|
||||
r->ecx=kernel_rpc_is_init((pid_t)r->ebx);
|
||||
break;
|
||||
default:
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
char kernel_rpc_is_init(pid_t pid) {
|
||||
size_t byte=pid/8;
|
||||
size_t bit=pid%8;
|
||||
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) {
|
||||
//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));
|
||||
if (waiting_thread==NULL) {
|
||||
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
|
||||
*/
|
||||
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
|
||||
|
@ -41,3 +41,11 @@ void rpc_mark_as_init() {
|
||||
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();
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user