Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
0003  * Licensed under the GPL
0004  */
0005 
0006 #ifndef __UM_PROCESSOR_I386_H
0007 #define __UM_PROCESSOR_I386_H
0008 
0009 #include <linux/string.h>
0010 #include <asm/segment.h>
0011 #include <asm/ldt.h>
0012 
0013 extern int host_has_cmov;
0014 
0015 struct uml_tls_struct {
0016     struct user_desc tls;
0017     unsigned flushed:1;
0018     unsigned present:1;
0019 };
0020 
0021 struct arch_thread {
0022     struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
0023     unsigned long debugregs[8];
0024     int debugregs_seq;
0025     struct faultinfo faultinfo;
0026 };
0027 
0028 #define INIT_ARCH_THREAD { \
0029     .tls_array          = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \
0030                     { .present = 0, .flushed = 0 } }, \
0031     .debugregs          = { [ 0 ... 7 ] = 0 }, \
0032     .debugregs_seq      = 0, \
0033     .faultinfo      = { 0, 0, 0 } \
0034 }
0035 
0036 #define STACKSLOTS_PER_LINE 8
0037 
0038 static inline void arch_flush_thread(struct arch_thread *thread)
0039 {
0040     /* Clear any TLS still hanging */
0041     memset(&thread->tls_array, 0, sizeof(thread->tls_array));
0042 }
0043 
0044 static inline void arch_copy_thread(struct arch_thread *from,
0045                                     struct arch_thread *to)
0046 {
0047         memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array));
0048 }
0049 
0050 #define current_sp() ({ void *sp; __asm__("movl %%esp, %0" : "=r" (sp) : ); sp; })
0051 #define current_bp() ({ unsigned long bp; __asm__("movl %%ebp, %0" : "=r" (bp) : ); bp; })
0052 
0053 #endif