|
From: <sv...@va...> - 2005-11-14 14:37:08
|
Author: tom
Date: 2005-11-14 14:37:02 +0000 (Mon, 14 Nov 2005)
New Revision: 5123
Log:
Document sign extension of si_code by the kernel.
Modified:
trunk/coregrind/m_signals.c
Modified: trunk/coregrind/m_signals.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_signals.c 2005-11-14 12:15:27 UTC (rev 5122)
+++ trunk/coregrind/m_signals.c 2005-11-14 14:37:02 UTC (rev 5123)
@@ -1358,7 +1358,11 @@
/* The linux kernel uses the top 16 bits of si_code for it's own
use and only exports the bottom 16 bits to user space - at least
that is the theory, but it turns out that there are some kernels
- around that forget to mask out the top 16 bits so we do it here. *=
/
+ around that forget to mask out the top 16 bits so we do it here.
+
+ The kernel treats the bottom 16 bits as signed and (when it does
+ mask them off) sign extends them when exporting to user space so
+ we do the same thing here. */
info->si_code =3D (Short)info->si_code;
#endif
=20
@@ -1475,7 +1479,11 @@
/* The linux kernel uses the top 16 bits of si_code for it's own
use and only exports the bottom 16 bits to user space - at least
that is the theory, but it turns out that there are some kernels
- around that forget to mask out the top 16 bits so we do it here. *=
/
+ around that forget to mask out the top 16 bits so we do it here.
+
+ The kernel treats the bottom 16 bits as signed and (when it does
+ mask them off) sign extends them when exporting to user space so
+ we do the same thing here. */
info->si_code =3D (Short)info->si_code;
#endif
=20
|