From: David Given Date: Sat, 23 Jan 2016 23:51:29 +0000 (+0100) Subject: Fix data corruption issue. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d8312b79de3f0407a1981ae98b750d68b60e90d0;p=FUZIX.git Fix data corruption issue. --- diff --git a/Kernel/include/kernel.h b/Kernel/include/kernel.h index 84af6d41..0c4d1757 100644 --- a/Kernel/include/kernel.h +++ b/Kernel/include/kernel.h @@ -381,7 +381,8 @@ typedef struct p_tab { #ifdef udata struct u_data *p_udata; /* Udata pointer for platforms using dynamic udata */ #endif - /* Everything below here is overlaid by time info at exit */ + /* Everything below here is overlaid by time info at exit. + * Make sure it's 32-bit aligned. */ uint16_t p_priority; /* Process priority */ uint32_t p_pending; /* Bitmask of pending signals */ uint32_t p_ignored; /* Bitmask of ignored signals */ diff --git a/Kernel/syscall_proc.c b/Kernel/syscall_proc.c index 213d3173..ff900ee7 100644 --- a/Kernel/syscall_proc.c +++ b/Kernel/syscall_proc.c @@ -315,8 +315,8 @@ arg_t _waitpid(void) /* Add in child's time info. It was stored on top */ /* of p_priority in the childs process table entry. */ - udata.u_cutime += ((clock_t *)p->p_priority)[0]; - udata.u_cstime += ((clock_t *)p->p_priority)[1]; + udata.u_cutime += ((clock_t *)&p->p_priority)[0]; + udata.u_cstime += ((clock_t *)&p->p_priority)[1]; return retval; } }