Skip to contentSkip to conversation

A question related with symbol reference?

DISCUSSION Zang Hongyong 3 participants 5 messages Mar 18, 2008 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

anyone can help?
I'm confused too.

======== 2008-03-18 14:04:50 您在来信中写道: ========

hi, my friends:

recently, i am reading the source codes about hypercall.

First, i study a simple hypercall, for example, the "do_xen_version".

In "xen-3.1.0-src\xen\common\kernel.c", the definition of "do_xen_version" is:

DO(xen_version) (int cmd, XEN_GUEST_HANDLE(void) arg) {
....
}

according to the " #define DO(fn) long do_##fn ", the expanded form is "do_xen_version (...)".

then, in the "xen-3.1.0-src\xen\arch\x86\x86_32\entry.S", there is an item in the "hypercall_table", like this:

ENTRY(hypercall_table)
....
.long do_xen_version
....

as we all known, for a symbol reference of function there need to be a header file contained, or a "global" declaration.

By searching the header files, i found the file, "xen-3.1.0-src\xen\include\xen\hypercall.h" that declared the function in a form as follows:

extern long
do_xen_version(
int cmd,
XEN_GUEST_HANDLE(void) arg);

But, i can not find where the file "hypercall.h" is contained in order to link it with the reference of "do_xen_version" in the "entry.S"

So, please help me, or give me some advice.

thanks advance.

2008-03-18

房海峰

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Assembly code does not need a function prototype or indeed any label declaration to be able to reference that function/label.

-- Keir

Quoted 60 lines · Zang Hongyong

anyone can help?
I'm confused too.

======== 2008-03-18 14:04:50 您在来信中写道: ========

hi, my friends:

recently, i am reading the source codes about hypercall.

First, i study a simple hypercall, for example, the "do_xen_version".

In "xen-3.1.0-src\xen\common\kernel.c", the definition of "do_xen_version" is:

DO(xen_version) (int cmd, XEN_GUEST_HANDLE(void) arg) {
....
}

according to the " #define DO(fn) long do_##fn ", the expanded form is "do_xen_version (...)".

then, in the "xen-3.1.0-src\xen\arch\x86\x86_32\entry.S", there is an item in the "hypercall_table", like this:

ENTRY(hypercall_table)
....
.long do_xen_version
....

as we all known, for a symbol reference of function there need to be a header file contained, or a "global" declaration.

By searching the header files, i found the file, "xen-3.1.0-src\xen\include\xen\hypercall.h" that declared the function in a form as follows:

extern long
do_xen_version(
int cmd,
XEN_GUEST_HANDLE(void) arg);

But, i can not find where the file "hypercall.h" is contained in order to link it with the reference of "do_xen_version" in the "entry.S"

So, please help me, or give me some advice.

thanks advance.

2008-03-18

房海峰

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

2008-03-18

房海峰

发件人: 房海峰
发送时间: 2008-03-18 16:49:06
收件人: Keir Fraser
抄送:
主题: Re: Re: [Xen-devel] A question related with symbol reference?

I have been programmed assembly code with "nasm" language.
in "nasm", when you refere to a function/label that come from another file, you should make a declaration of the function with "extern" keywords in advance.

i don't know whether "at&t" assembly language is different with "nasm"?

thanks again!

2008-03-18

房海峰

发件人: Keir Fraser
发送时间: 2008-03-18 16:12:41
收件人: Zang Hongyong; [email protected]; xen-devel
抄送:
主题: Re: [Xen-devel] A question related with symbol reference? Assembly code does not need a function prototype or indeed any label declaration to be able to reference that function/label.
-- Keir

Quoted 53 lines · Zang Hongyong

anyone can help?
I'm confused too.

======== 2008-03-18 14:04:50 您在来信中写道: ========

hi, my friends:

recently, i am reading the source codes about hypercall.

First, i study a simple hypercall, for example, the "do_xen_version".

In "xen-3.1.0-src\xen\common\kernel.c", the definition of "do_xen_version" is:

DO(xen_version) (int cmd, XEN_GUEST_HANDLE(void) arg) {
....
}

according to the " #define DO(fn) long do_##fn ", the expanded form is "do_xen_version (...)".

then, in the "xen-3.1.0-src\xen\arch\x86\x86_32\entry.S", there is an item in the "hypercall_table", like this:

ENTRY(hypercall_table)
....
.long do_xen_version
....

as we all known, for a symbol reference of function there need to be a header file contained, or a "global" declaration.

By searching the header files, i found the file, "xen-3.1.0-src\xen\include\xen\hypercall.h" that declared the function in a form as follows:

extern long
do_xen_version(
int cmd,
XEN_GUEST_HANDLE(void) arg);

But, i can not find where the file "hypercall.h" is contained in order to link it with the reference of "do_xen_version" in the "entry.S"

So, please help me, or give me some advice.

thanks advance.

2008-03-18

Quoted 7 lines

房海峰

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

The EXTERN directive is specific to nasm.

-- Keir

Quoted 8 lines · 房海峰

I have been programmed assembly code with "nasm" language.
in "nasm", when you refere to a function/label that come from another file, you should make a declaration of the function with "extern" keywords in advance.

i don't know whether "at&t" assembly language is different with "nasm"?

thanks again!

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw

maybe! i will study "at&t" indepth.

thank you for your reply.

2008-03-18

房海峰

发件人: Keir Fraser
发送时间: 2008-03-18 16:35:27
收件人: [email protected]; xen-devel
抄送:
主题: Re: [Xen-devel] A question related with symbol reference?

The EXTERN directive is specific to nasm.

-- Keir

On 18/3/08 08:49, "$BK<3$Jv(B" <[email protected]> wrote:

I have been programmed assembly code with "nasm" language.
in "nasm", when you refere to a function/label that come from another file, you should make a declaration of the function with "extern" keywords in advance.

i don't know whether "at&t" assembly language is different with "nasm"?

thanks again!

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel