From: Jorrit Herder Date: Thu, 20 Oct 2005 20:25:32 +0000 (+0000) Subject: New error codes for IPC errors. X-Git-Tag: v3.1.2a~597 X-Git-Url: http://zhaoyanbai.com/repos/cppcheck-error.log?a=commitdiff_plain;h=86e333345458317f34c66547282aef3a65a25970;p=minix.git New error codes for IPC errors. Made VM code debug output disappear. --- diff --git a/kernel/proc.c b/kernel/proc.c index 1a050d74a..ec92b52d2 100755 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -115,7 +115,7 @@ message *m_ptr; /* pointer to message in the caller's space */ kprintf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", function, proc_nr(caller_ptr), src_dst); #endif - return(ECALLDENIED); /* trap denied by mask or kernel */ + return(ETRAPDENIED); /* trap denied by mask or kernel */ } /* Require a valid source and/ or destination process, unless echoing. */ diff --git a/kernel/system/do_exit.c b/kernel/system/do_exit.c index 2bf89992a..fd6b6fc0b 100644 --- a/kernel/system/do_exit.c +++ b/kernel/system/do_exit.c @@ -65,8 +65,10 @@ register struct proc *rc; /* slot of process to clean up */ while (*xpp != NIL_PROC) { /* check entire queue */ if (*xpp == rc) { /* process is on the queue */ *xpp = (*xpp)->p_q_link; /* replace by next process */ +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("Proc %d removed from queue at %d\n", proc_nr(rc), rc->p_sendto); +#endif break; /* can only be queued once */ } xpp = &(*xpp)->p_q_link; /* proceed to next queued */ @@ -79,17 +81,24 @@ register struct proc *rc; /* slot of process to clean up */ */ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; rp++) { + /* Unset pending notification bits. */ + unset_sys_bit(priv(rp)->s_notify_pending, priv(rc)->s_id); + /* Check if process is receiving from exiting process. */ if ((rp->p_rts_flags & RECEIVING) && rp->p_getfrom == proc_nr(rc)) { - rp->p_reg.retreg = EDEADSRCDST; /* report source died */ + rp->p_reg.retreg = ESRCDIED; /* report source died */ rp->p_rts_flags &= ~RECEIVING; /* no longer receiving */ +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("Proc %d receive dead src %d\n", proc_nr(rp), proc_nr(rc)); +#endif lock_enqueue(rp); /* let process run again */ } else if ((rp->p_rts_flags & SENDING) && rp->p_sendto == proc_nr(rc)) { - rp->p_reg.retreg = EDEADSRCDST; /* report destination died */ + rp->p_reg.retreg = EDSTDIED; /* report destination died */ rp->p_rts_flags &= ~SENDING; /* no longer sending */ +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("Proc %d send dead dst %d\n", proc_nr(rp), proc_nr(rc)); +#endif lock_enqueue(rp); /* let process run again */ } } diff --git a/kernel/system/do_vm.c b/kernel/system/do_vm.c index f1114fae7..2fc08cea7 100644 --- a/kernel/system/do_vm.c +++ b/kernel/system/do_vm.c @@ -24,6 +24,8 @@ FORWARD _PROTOTYPE( void vm_enable_paging, (void) ); FORWARD _PROTOTYPE( void map_range, (u32_t base, u32_t size, u32_t offset) ); +#define VM_DEBUG 0 /* enable/ disable debug output */ + /*===========================================================================* * do_vm_setbuf * *===========================================================================*/ @@ -36,7 +38,9 @@ message *m_ptr; /* pointer to request message */ /* do_serial_debug= 1; */ +#if VM_DEBUG kprintf("in do_vm_map\n"); +#endif if (vm_needs_init) { @@ -54,14 +58,18 @@ message *m_ptr; /* pointer to request message */ p_phys= umap_local(pp, D, base, size); if (p_phys == 0) return EFAULT; +#if VM_DEBUG kprintf("got 0x%x for 0x%x [D].mem_start = 0x%x\n", p_phys, base, pp->p_memmap[D].mem_phys); +#endif if (do_map) { +#if VM_DEBUG kprintf( "do_vm_map: mapping 0x%x @ 0x%x to 0x%x @ proc %d\n", size, offset, base, proc_nr); +#endif pp->p_misc_flags |= MF_VM; map_range(p_phys, size, offset); @@ -102,9 +110,10 @@ PRIVATE void vm_init(void) u32_t entry; unsigned pages; +#if VM_DEBUG kprintf("in vm_init\n"); - -kprintf("%s, %d\n", __FILE__, __LINE__); + kprintf("%s, %d\n", __FILE__, __LINE__); +#endif if (!vm_size) panic("vm_init: no space for page tables", NO_NUM); @@ -126,7 +135,9 @@ kprintf("%s, %d\n", __FILE__, __LINE__); if (pages * I386_VM_PT_ENT_SIZE > pt_size) panic("vm_init: page table too small", NO_NUM); -kprintf("%s, %d\n", __FILE__, __LINE__); +#if VM_DEBUG + kprintf("%s, %d\n", __FILE__, __LINE__); +#endif for (p= 0; p*I386_VM_PT_ENT_SIZE < pt_size; p++) { @@ -147,8 +158,9 @@ kprintf("%s, %d\n", __FILE__, __LINE__); entry= 0; phys_put32(vm_dir_base + p*I386_VM_PT_ENT_SIZE, entry); } - -kprintf("%s, %d\n", __FILE__, __LINE__); +#if VM_DEBUG + kprintf("%s, %d\n", __FILE__, __LINE__); +#endif vm_set_cr3(vm_dir_base); level0(vm_enable_paging); } @@ -157,7 +169,7 @@ PRIVATE void phys_put32(addr, value) phys_bytes addr; u32_t value; { -#if 0 +#if VM_DEBUG kprintf("%s, %d: %d bytes from 0x%x to 0x%x\n", __FILE__, __LINE__, sizeof(value), vir2phys((vir_bytes)&value), addr); #endif @@ -178,11 +190,17 @@ phys_bytes addr; PRIVATE void vm_set_cr3(value) u32_t value; { +#if VM_DEBUG kprintf("%s, %d\n", __FILE__, __LINE__); +#endif vm_cr3= value; +#if VM_DEBUG kprintf("%s, %d\n", __FILE__, __LINE__); +#endif level0(set_cr3); +#if VM_DEBUG kprintf("%s, %d\n", __FILE__, __LINE__); +#endif } PRIVATE void set_cr3() @@ -226,12 +244,14 @@ u32_t offset; curr_pt_addr= phys_get32(vm_cr3 + dir_ent * I386_VM_PT_ENT_SIZE); curr_pt_addr &= I386_VM_ADDR_MASK; +#if VM_DEBUG kprintf("got address 0x%x for page table 0x%x\n", curr_pt_addr, curr_pt); +#endif } entry= offset | I386_VM_USER | I386_VM_WRITE | I386_VM_PRESENT; -#if 0 +#if VM_DEBUG kprintf( "putting 0x%x at dir_ent 0x%x, pt_ent 0x%x (addr 0x%x)\n", entry, dir_ent, pt_ent, diff --git a/kernel/system/do_vm_setbuf.c b/kernel/system/do_vm_setbuf.c index 75c9af71f..484c43559 100644 --- a/kernel/system/do_vm_setbuf.c +++ b/kernel/system/do_vm_setbuf.c @@ -8,6 +8,8 @@ */ #include "../system.h" +#define VM_DEBUG 0 /* enable/ disable debug output */ + /*===========================================================================* * do_vm_setbuf * *===========================================================================*/ @@ -18,8 +20,10 @@ message *m_ptr; /* pointer to request message */ vm_size= m_ptr->m4_l2; vm_mem_high= m_ptr->m4_l3; +#if VM_DEBUG kprintf("do_vm_setbuf: got 0x%x @ 0x%x for 0x%x\n", vm_size, vm_base, vm_mem_high); +#endif return OK; } diff --git a/kernel/table.c b/kernel/table.c index 066ea77df..dbc40e64d 100755 --- a/kernel/table.c +++ b/kernel/table.c @@ -69,7 +69,7 @@ PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)]; #define SRV_M (~0) #define SYS_M (~0) #define USR_M (s(PM_PROC_NR) | s(FS_PROC_NR) | s(RS_PROC_NR) | s(SYSTEM)) -#define DRV_M (USR_M | s(SYSTEM) | s(CLOCK) | s(LOG_PROC_NR) | s(TTY_PROC_NR)) +#define DRV_M (USR_M | s(SYSTEM) | s(CLOCK) | s(DS_PROC_NR) | s(LOG_PROC_NR) | s(TTY_PROC_NR)) /* Define kernel calls that processes are allowed to make. This is not looking * very nice, but we need to define the access rights on a per call basis. @@ -78,12 +78,10 @@ PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)]; */ #define c(n) (1 << ((n)-KERNEL_CALL)) #define RS_C ~0 -#define PM_C ~(c(SYS_DEVIO) | c(SYS_SDEVIO) | c(SYS_VDEVIO) \ - | c(SYS_IRQCTL) | c(SYS_INT86)) -#define FS_C (c(SYS_KILL) | c(SYS_VIRCOPY) | c(SYS_VIRVCOPY) | c(SYS_UMAP) \ - | c(SYS_GETINFO) | c(SYS_EXIT) | c(SYS_TIMES) | c(SYS_SETALARM)) -#define DRV_C (FS_C | c(SYS_SEGCTL) | c(SYS_IRQCTL) | c(SYS_INT86) \ - | c(SYS_DEVIO) | c(SYS_VDEVIO) | c(SYS_SDEVIO)) +#define DS_C ~0 +#define PM_C ~(c(SYS_DEVIO) | c(SYS_SDEVIO) | c(SYS_VDEVIO) | c(SYS_IRQCTL) | c(SYS_INT86)) +#define FS_C (c(SYS_KILL) | c(SYS_VIRCOPY) | c(SYS_VIRVCOPY) | c(SYS_UMAP) | c(SYS_GETINFO) | c(SYS_EXIT) | c(SYS_TIMES) | c(SYS_SETALARM)) +#define DRV_C (FS_C | c(SYS_SEGCTL) | c(SYS_IRQCTL) | c(SYS_INT86) | c(SYS_DEVIO) | c(SYS_VDEVIO) | c(SYS_SDEVIO)) #define TTY_C (DRV_C | c(SYS_ABORT)) #define MEM_C (DRV_C | c(SYS_PHYSCOPY) | c(SYS_PHYSVCOPY) | c(SYS_VM_MAP)) @@ -103,8 +101,9 @@ PUBLIC struct boot_image image[] = { { PM_PROC_NR, 0, SRV_F, 32, 3, 0, SRV_T, SRV_M, PM_C, "pm" }, { FS_PROC_NR, 0, SRV_F, 32, 4, 0, SRV_T, SRV_M, FS_C, "fs" }, { RS_PROC_NR, 0, SRV_F, 4, 3, 0, SRV_T, SYS_M, RS_C, "rs" }, + { DS_PROC_NR, 0, SRV_F, 4, 3, 0, SRV_T, SYS_M, DS_C, "ds" }, { TTY_PROC_NR, 0, SRV_F, 4, 1, 0, SRV_T, SYS_M, TTY_C, "tty" }, - { MEM_PROC_NR, 0, SRV_F, 4, 2, 0, SRV_T, DRV_M, MEM_C, "memory"}, + { MEM_PROC_NR, 0, SRV_F, 4, 2, 0, SRV_T, SYS_M, MEM_C, "memory"}, { LOG_PROC_NR, 0, SRV_F, 4, 2, 0, SRV_T, SYS_M, DRV_C, "log" }, { DRVR_PROC_NR, 0, SRV_F, 4, 2, 0, SRV_T, SYS_M, DRV_C, "driver"}, { INIT_PROC_NR, 0, USR_F, 8, USER_Q, 0, USR_T, USR_M, 0, "init" },