Discussion:
Hi, a question about "struct sysentvc"
mokhi
2016-03-15 21:46:56 UTC
Permalink
Hi guys.
I was reading/studying code of Elf image activator to see how binary
stars on FreeBSD.
On included file (sysent.h), I saw 3 declarations:
extern struct sysentvec aout_sysvec;
extern struct sysentvec elf_freebsd_sysvec;
extern struct sysentvec null_sysvec;

I looked at their definitions too (though i couldn't find
elf_freebsd_sysvec, where's it ?).
I have some (maybe simple, so sorry for it :D) questions.

1) what's sysentvec for, basically ? and in which concept it connects
to image-activators (such as ELF image activator [or a.out's])

2) is there any reference/guide to see how should/can we define a
"struct sysentvec" for new format ?

FWIW, I'm also a little familiar with NetBSD way of binary
running/compat layer devel.

Thanks and thousands of regards, Mokhi.
Konstantin Belousov
2016-03-16 00:25:24 UTC
Permalink
Post by mokhi
Hi guys.
I was reading/studying code of Elf image activator to see how binary
stars on FreeBSD.
extern struct sysentvec aout_sysvec;
extern struct sysentvec elf_freebsd_sysvec;
extern struct sysentvec null_sysvec;
I looked at their definitions too (though i couldn't find
elf_freebsd_sysvec, where's it ?).
It is in sys/<arch>/<arch>/elf_machdep.c. Grep would find it to you.
Post by mokhi
I have some (maybe simple, so sorry for it :D) questions.
1) what's sysentvec for, basically ? and in which concept it connects
to image-activators (such as ELF image activator [or a.out's])
The structure describes an ABI to kernel. Consider it the object
in C++ sense which provides implementations of the ABI-specific
operations from the kernel side. Image activator sets curproc->p_sysent
for the process at exec(2) time according to the information specified
in the binary, which effectively determines the kernel-side of the ABI
for the process.
Post by mokhi
2) is there any reference/guide to see how should/can we define a
"struct sysentvec" for new format ?
There is no guide, read the code.
mokhi
2016-03-16 12:18:13 UTC
Permalink
Thanks for your answer :D
Post by Konstantin Belousov
There is no guide, read the code.
Elf code is better in help ? or aout ?

Regards, Mokhi.
Konstantin Belousov
2016-03-16 15:40:23 UTC
Permalink
Post by mokhi
Thanks for your answer :D
Post by Konstantin Belousov
There is no guide, read the code.
Elf code is better in help ? or aout ?
You need to read all the involved code to understand the interface.
You could start with a.out part since it is easier, but the point is
that you must read the callers code to see what for are the sysent
methods.

Loading...