All of lore.kernel.org
 help / color / mirror / Atom feed
* Grab the physical address of a label
@ 2012-06-05  6:07 Zeinab Alebouyeh
  2012-06-06  9:43 ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Zeinab Alebouyeh @ 2012-06-05  6:07 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 264 bytes --]

Hi everyone,
I'm working on a research project. I add a hypercall to xen. It works
properly.
In my Hypercall function I have a label and I want the physical address of
my label to pass to another function. How can I grab the physical address
of the label?

Thanks

[-- Attachment #1.2: Type: text/html, Size: 288 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Grab the physical address of a label
  2012-06-05  6:07 Grab the physical address of a label Zeinab Alebouyeh
@ 2012-06-06  9:43 ` Ian Campbell
  2012-06-07  4:29   ` Zeinab Alebouyeh
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2012-06-06  9:43 UTC (permalink / raw)
  To: Zeinab Alebouyeh; +Cc: xen-devel

On Tue, 2012-06-05 at 07:07 +0100, Zeinab Alebouyeh wrote:
> Hi everyone,
> I'm working on a research project. I add a hypercall to xen. It works
> properly. 
> In my Hypercall function I have a label and I want the physical
> address of my label to pass to another function. How can I grab the
> physical address of the label?

AFAIK there is no way to do this in standard C.

xen-devel isn't really the best place to be asking C programming
questions. I suggest you either speak to your advisor/mentor or seek out
one of the C forums on the Internet.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Grab the physical address of a label
  2012-06-06  9:43 ` Ian Campbell
@ 2012-06-07  4:29   ` Zeinab Alebouyeh
  2012-06-07  6:31     ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Zeinab Alebouyeh @ 2012-06-07  4:29 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1001 bytes --]

Thanks but I think if I find the base physical address of xen image I can
convert virtual address to physical address
I'm working in xen4 and my platform is: Processor AMD 64 and Centos 6 i386
with 8G of RAM
Can anyone tell me The physical address that xen image load in it? This
physical address depends on platform?

Thanks a lot


On Wed, Jun 6, 2012 at 2:43 AM, Ian Campbell <Ian.Campbell@citrix.com>wrote:

> On Tue, 2012-06-05 at 07:07 +0100, Zeinab Alebouyeh wrote:
> > Hi everyone,
> > I'm working on a research project. I add a hypercall to xen. It works
> > properly.
> > In my Hypercall function I have a label and I want the physical
> > address of my label to pass to another function. How can I grab the
> > physical address of the label?
>
> AFAIK there is no way to do this in standard C.
>
> xen-devel isn't really the best place to be asking C programming
> questions. I suggest you either speak to your advisor/mentor or seek out
> one of the C forums on the Internet.
>
> Ian.
>
>

[-- Attachment #1.2: Type: text/html, Size: 1456 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Grab the physical address of a label
  2012-06-07  4:29   ` Zeinab Alebouyeh
@ 2012-06-07  6:31     ` Ian Campbell
  2012-06-08 18:15       ` Zeinab Alebouyeh
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2012-06-07  6:31 UTC (permalink / raw)
  To: Zeinab Alebouyeh; +Cc: xen-devel

Please don't top post, it makes it hard to follow the flow of the
conversation.

You might also find it useful to read
http://wiki.xen.org/wiki/Asking_Xen_Devel_Questions

On Thu, 2012-06-07 at 05:29 +0100, Zeinab Alebouyeh wrote:
> Thanks but I think if I find the base physical address of xen image I
> can convert virtual address to physical address

I'm not sure what this has to do with taking the address of a label,
like you originally asked, but...

There are macros to convert a xenheap virtual address into a physical
one and back, see __pa and __va. (Note that these only work for xenheap
addresses).

> I'm working in xen4 and my platform is: Processor AMD 64 and Centos 6
> i386 with 8G of RAM

Are you using a 32-bit or 64-bit hypervisor? 

I strongly recommend basing all future x86 work on 64-bit Xen, even if
you are using a 32 bit dom0.

> Can anyone tell me The physical address that xen image load in it?
> This physical address depends on platform?

Yes, Xen will relocate itself at start of day. You should be able to
figure out the details from the implementation of __pa and __va.

It might be helpful if you described what you are actually trying to
achieve here -- what is your end goal?

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Grab the physical address of a label
  2012-06-07  6:31     ` Ian Campbell
@ 2012-06-08 18:15       ` Zeinab Alebouyeh
  2012-06-12  9:05         ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Zeinab Alebouyeh @ 2012-06-08 18:15 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 2098 bytes --]

On Wed, Jun 6, 2012 at 11:31 PM, Ian Campbell <Ian.Campbell@citrix.com>wrote:

> Please don't top post, it makes it hard to follow the flow of the
> conversation.
>
> You might also find it useful to read
> http://wiki.xen.org/wiki/Asking_Xen_Devel_Questions
>
> On Thu, 2012-06-07 at 05:29 +0100, Zeinab Alebouyeh wrote:
> > Thanks but I think if I find the base physical address of xen image I
> > can convert virtual address to physical address
>
> I'm not sure what this has to do with taking the address of a label,
> like you originally asked, but...
>
> There are macros to convert a xenheap virtual address into a physical
> one and back, see __pa and __va. (Note that these only work for xenheap
> addresses).
>
> > I'm working in xen4 and my platform is: Processor AMD 64 and Centos 6
> > i386 with 8G of RAM
>
> Are you using a 32-bit or 64-bit hypervisor?
>
> I strongly recommend basing all future x86 work on 64-bit Xen, even if
> you are using a 32 bit dom0.
>
> > Can anyone tell me The physical address that xen image load in it?
> > This physical address depends on platform?
>
> Yes, Xen will relocate itself at start of day. You should be able to
> figure out the details from the implementation of __pa and __va.
>
> It might be helpful if you described what you are actually trying to
> achieve here -- what is your end goal?
>
> Ian.
>

Hi
Because currently I'm not in lab I don't know my hypervisor is 32b or 64
bit.
I'm working in a security project. for improve security of applications
running in virtualized environment. I want to use the security instruction
of AMD SVM named SKINIT.
because this instruction must run in ring0, I add a hypercall in xen and
write my codes in my hypercall function.
The skinit instruction takes the physical address of a block as an input
operand( in the eax register) and establish a secure execution environment
for a software component(block)
I have a label in my hypercall function that is the start of my block. In
order to use skinit I want grab the physical address of my label to save in
eax register.

Thanks if anyone help me.

[-- Attachment #1.2: Type: text/html, Size: 2754 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Grab the physical address of a label
  2012-06-08 18:15       ` Zeinab Alebouyeh
@ 2012-06-12  9:05         ` Ian Campbell
  2012-06-14 15:59           ` Zeinab Alebouyeh
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2012-06-12  9:05 UTC (permalink / raw)
  To: Zeinab Alebouyeh; +Cc: xen-devel

On Fri, 2012-06-08 at 19:15 +0100, Zeinab Alebouyeh wrote:

> Because currently I'm not in lab I don't know my hypervisor is 32b or
> 64 bit.
> I'm working in a security project. for improve security of
> applications running in virtualized environment. I want to use the
> security instruction of AMD SVM named SKINIT.
> because this instruction must run in ring0, I add a hypercall in xen
> and write my codes in my hypercall function.
> The skinit instruction takes the physical address of a block as an
> input operand( in the eax register) and establish a secure execution
> environment for a software component(block)
> I have a label in my hypercall function that is the start of my block.
> In order to use skinit I want grab the physical address of my label to
> save in eax register.

Rather than use a label in the current function for this magic block you
should use a separate function, either in a .S or a .c file. Then you
can simply use &function_name to get the address and you don't run the
risk of accidentally falling through into the special code from the
non-skinit context etc.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Grab the physical address of a label
  2012-06-12  9:05         ` Ian Campbell
@ 2012-06-14 15:59           ` Zeinab Alebouyeh
  2012-06-19  9:59             ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Zeinab Alebouyeh @ 2012-06-14 15:59 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1388 bytes --]

On Tue, Jun 12, 2012 at 2:05 AM, Ian Campbell <Ian.Campbell@citrix.com>wrote:

> On Fri, 2012-06-08 at 19:15 +0100, Zeinab Alebouyeh wrote:
>
> > Because currently I'm not in lab I don't know my hypervisor is 32b or
> > 64 bit.
> > I'm working in a security project. for improve security of
> > applications running in virtualized environment. I want to use the
> > security instruction of AMD SVM named SKINIT.
> > because this instruction must run in ring0, I add a hypercall in xen
> > and write my codes in my hypercall function.
> > The skinit instruction takes the physical address of a block as an
> > input operand( in the eax register) and establish a secure execution
> > environment for a software component(block)
> > I have a label in my hypercall function that is the start of my block.
> > In order to use skinit I want grab the physical address of my label to
> > save in eax register.
>
> Rather than use a label in the current function for this magic block you
> should use a separate function, either in a .S or a .c file. Then you
> can simply use &function_name to get the address and you don't run the
> risk of accidentally falling through into the special code from the
> non-skinit context etc.
>
> Ian.
>
> Thanks for your guidance,
you means that if I use a function, &function_name gives me the physical
address of function or the virtual address of function?

[-- Attachment #1.2: Type: text/html, Size: 1861 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Grab the physical address of a label
  2012-06-14 15:59           ` Zeinab Alebouyeh
@ 2012-06-19  9:59             ` Ian Campbell
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Campbell @ 2012-06-19  9:59 UTC (permalink / raw)
  To: Zeinab Alebouyeh; +Cc: xen-devel

On Thu, 2012-06-14 at 16:59 +0100, Zeinab Alebouyeh wrote:
> you means that if I use a function, &function_name gives me the
> physical address of function or the virtual address of function?

virtual.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-06-19  9:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05  6:07 Grab the physical address of a label Zeinab Alebouyeh
2012-06-06  9:43 ` Ian Campbell
2012-06-07  4:29   ` Zeinab Alebouyeh
2012-06-07  6:31     ` Ian Campbell
2012-06-08 18:15       ` Zeinab Alebouyeh
2012-06-12  9:05         ` Ian Campbell
2012-06-14 15:59           ` Zeinab Alebouyeh
2012-06-19  9:59             ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.