flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Main > confused about virtual

Author
Thread Post new topic Reply to topic
funggong



Joined: 08 Nov 2016
Posts: 6
confused about virtual

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]
errorvalue 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: 15233
Location: 1I/╩╗Oumuamua
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

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

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: 15233
Location: 1I/╩╗Oumuamua

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

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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.