Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

segment registers in struct trapframe



'struct trapframe' (sys/arch/i386/include/frame.h) currently uses 'int'
for all the fields.

This is a problem for the segment registers where the asm code only
writes 16 bits - leaving the high bits unchanged.

The kernel doesn't care it will only load the low bits, however the
values get passed to userspace (eg to signal handlers) where the
high bits are distracting at best.

The following patch make all the copies 16bit (without affecting binary
conpatibility anywhere).

RCS file: /cvsroot/src/sys/arch/i386/include/frame.h,v
retrieving revision 1.33
diff -u -p -r1.33 frame.h
--- frame.h     14 Nov 2008 13:05:34 -0000      1.33
+++ frame.h     10 Jan 2010 16:16:15 -0000
@@ -77,10 +77,14 @@
  * Exception/Trap Stack Frame
  */
 struct trapframe {
-       int     tf_gs;
-       int     tf_fs;
-       int     tf_es;
-       int     tf_ds;
+       uint16_t        tf_gs;
+       uint16_t        tf_gs_pad;
+       uint16_t        tf_fs;
+       uint16_t        tf_fs_pad;
+       uint16_t        tf_es;
+       uint16_t        tf_es_pad;
+       uint16_t        tf_ds;
+       uint16_t        tf_ds_pad;
        int     tf_edi;
        int     tf_esi;
        int     tf_ebp;

Thoughts>

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index