Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.4 KiB

  1. title "NtCurTeb.asm"
  2. ;++
  3. ;
  4. ; Copyright (c) 1989 Microsoft Corporation
  5. ;
  6. ; Module Name:
  7. ;
  8. ; NtCurTeb.asm
  9. ;
  10. ; Abstract:
  11. ;
  12. ; Efficient NtCurrentTeb code.
  13. ;
  14. ; Author:
  15. ;
  16. ; Bryan Willman (bryanwi) 28 feb 90
  17. ;
  18. ; Environment:
  19. ;
  20. ; Revision History:
  21. ;
  22. ;--
  23. .386p
  24. .xlist
  25. include ks386.inc
  26. include callconv.inc ; calling convention macros
  27. .list
  28. page ,132
  29. subttl "NtCurrentTeb"
  30. IFDEF NTOS_KERNEL_RUNTIME
  31. .PAGE SEGMENT DWORD PUBLIC 'CODE'
  32. ELSE
  33. _TEXT SEGMENT DWORD PUBLIC 'CODE'
  34. ENDIF
  35. ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
  36. ;++
  37. ;
  38. ; PTEB
  39. ; NtCurrentTeb();
  40. ;
  41. ; Routine Description:
  42. ;
  43. ; This routine returns the address of the current TEB.
  44. ;
  45. ; Arguments:
  46. ;
  47. ; None
  48. ;
  49. ; Return Value:
  50. ;
  51. ; Address of TEB.
  52. ;
  53. ;--
  54. cPublicProc ___NtCurrentTeb ,0
  55. cPublicFpo 0,0
  56. ;
  57. ; How this works in both user and kernel mode.
  58. ;
  59. ; In user mode, TEB.TIB.Self is flat address of containing structure.
  60. ; In kernel mode, PCR.TIB.Self is flat address of the TEB.
  61. ; Same offset both places, so fs:PcTeb is always the flat address
  62. ; of the TEB.
  63. ;
  64. mov eax,fs:[PcTeb]
  65. stdRET ___NtCurrentTeb
  66. stdENDP ___NtCurrentTeb
  67. IFDEF NTOS_KERNEL_RUNTIME
  68. .PAGE ENDS
  69. ELSE
  70. _TEXT ENDS
  71. ENDIF
  72. end