flat assembler
Message board for the users of flat assembler.

Index > Main > confused about virtual

Author
Thread Post new topic Reply to topic
funggong



Joined: 08 Nov 2016
Posts: 6
funggong 16 Nov 2016, 01:40
Code:
use64
org 0x40000000000
xor eax,eax
virtual at 0
abc:
end virtual
mov rax,[gs:abc]
    


Code:
test.asm [7]:
mov rax,[gs:abc]
error: value out of range.
    


the lable starts at 0,isn't it?
Post 16 Nov 2016, 01:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20453
Location: In your JS exploiting you and your system
revolution 16 Nov 2016, 01:56
By default fasm uses RIP relative addressing, and you can't reach 0x0 from 0x40000000000 with a 31 bit offset. To use absolute addressing you can use this:
Code:
mov rax,[gs:qword abc]    
Post 16 Nov 2016, 01:56
View user's profile Send private message Visit poster's website Reply with quote
funggong



Joined: 08 Nov 2016
Posts: 6
funggong 16 Nov 2016, 02:24
revolution wrote:
By default fasm uses RIP relative addressing, and you can't reach 0x0 from 0x40000000000 with a 31 bit offset. To use absolute addressing you can use this:
Code:
mov rax,[gs:qword abc]    


thanks revolution,I am developing a 64bit kernel now,andwill type more letter to addressing cpu private data ^_^
Post 16 Nov 2016, 02:24
View user's profile Send private message Reply with quote
funggong



Joined: 08 Nov 2016
Posts: 6
funggong 16 Nov 2016, 02:33
revolution wrote:
By default fasm uses RIP relative addressing, and you can't reach 0x0 from 0x40000000000 with a 31 bit offset. To use absolute addressing you can use this:
Code:
mov rax,[gs:qword abc]    


but this type of code generate more binary byte,a better way to addressing cpu self data struct?
Post 16 Nov 2016, 02:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20453
Location: In your JS exploiting you and your system
revolution 16 Nov 2016, 02:42
funggong wrote:
but this type of code generate more binary byte, ...
Than what? Even so, is byte count really a problem for your application? Are you in a memory constrained environment? Do you have cache thrashing problems?
funggong wrote:
... a better way to addressing cpu self data struct?
"better" depends upon what you are doing. It would probably be "better" IMO to firstly get the code working, and only later worry abut things like byte counts and performance problems once you have identified where any problems actually occur.
Post 16 Nov 2016, 02:42
View user's profile Send private message Visit poster's website Reply with quote
funggong



Joined: 08 Nov 2016
Posts: 6
funggong 16 Nov 2016, 02:51
revolution wrote:
funggong wrote:
but this type of code generate more binary byte, ...
Than what? Even so, is byte count really a problem for your application? Are you in a memory constrained environment? Do you have cache thrashing problems?
funggong wrote:
... a better way to addressing cpu self data struct?
"better" depends upon what you are doing. It would probably be "better" IMO to firstly get the code working, and only later worry abut things like byte counts and performance problems once you have identified where any problems actually occur.


may be I am worry about more detail aspect of the design,thanks your suggestion,I try to make it work first
Post 16 Nov 2016, 02:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.