Author Topic: fs/gs  (Read 203 times)

JK

  • Regular Member
  • *
  • Posts: 46
fs/gs
« on: July 24, 2020, 06:42:47 AM »
While in 64 bit this works:

Code: [Select]
  mov qword ptr rax, gs:[...] 
  mov gs:[...], rax 

this 32 bit code doesn´t:

Code: [Select]
  mov dword ptr eax, fs:[...]
  mov fs:[...], eax

What am i doing wrong? I want to read/write data from/to the TEB.


JK

nidud

  • Member
  • *****
  • Posts: 1980
    • https://github.com/nidud/asmc
Re: fs/gs
« Reply #1 on: July 24, 2020, 07:06:44 AM »
fs is assumed to error so you have to assume fs:nothing first.

    assume fs:nothing
    mov eax,fs:[0]
    assume fs:error

JK

  • Regular Member
  • *
  • Posts: 46
Re: fs/gs
« Reply #2 on: July 24, 2020, 08:04:48 PM »
Ok - thanks, indeed this solves the problem!

Quote
fs is assumed to error ...

just to understand the background - why?