processor_32.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __UM_PROCESSOR_I386_H
  6. #define __UM_PROCESSOR_I386_H
  7. #include <linux/string.h>
  8. #include <asm/segment.h>
  9. #include <asm/ldt.h>
  10. extern int host_has_cmov;
  11. struct uml_tls_struct {
  12. struct user_desc tls;
  13. unsigned flushed:1;
  14. unsigned present:1;
  15. };
  16. struct arch_thread {
  17. struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
  18. unsigned long debugregs[8];
  19. int debugregs_seq;
  20. struct faultinfo faultinfo;
  21. };
  22. #define INIT_ARCH_THREAD { \
  23. .tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \
  24. { .present = 0, .flushed = 0 } }, \
  25. .debugregs = { [ 0 ... 7 ] = 0 }, \
  26. .debugregs_seq = 0, \
  27. .faultinfo = { 0, 0, 0 } \
  28. }
  29. static inline void arch_flush_thread(struct arch_thread *thread)
  30. {
  31. /* Clear any TLS still hanging */
  32. memset(&thread->tls_array, 0, sizeof(thread->tls_array));
  33. }
  34. static inline void arch_copy_thread(struct arch_thread *from,
  35. struct arch_thread *to)
  36. {
  37. memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array));
  38. }
  39. /*
  40. * Default implementation of macro that returns current
  41. * instruction pointer ("program counter"). Stolen
  42. * from asm-i386/processor.h
  43. */
  44. #define current_text_addr() \
  45. ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; })
  46. #endif