I already did the skeleton ☺

We have a C file (not included in builds - as in producing .o results)
which looks like:

[elsewhere in our foo.h file]
struct abc {

        float h[6];
    int a[32];
    long b;
    double c;
};

[asm-offsets.c]
#include <foo.h>
...


#define EMIT_OFFSET(name, type, field) \
    unsigned long __offsetof_ ## name = (unsigned long) &(((type *) 0)->field)

EMIT_OFFSET(abc_a, struct abc, a);
EMIT_OFFSET(abc_b, struct abc, b);
EMIT_OFFSET(abc_c, struct abc, c);
...

Then we have a perl script (Yay!) like this:

https://gist.github.com/dlibenzi/a31c823a0c8adedd66ab

That we run as:

$ gen_offsets -i asm-offsets.c -o somewhere/generated/asm-offset.h
x86_64-ucb-akaros-gcc -Isomewhere -Dsomething ...

That will use gcc-S to generate an asm file, than the Perl script
parses it and create the H file.




On Fri, Dec 4, 2015 at 11:28 AM, Barret Rhoden <[email protected]> wrote:

> On 2015-12-04 at 10:47 "'Davide Libenzi' via Akaros"
> <[email protected]> wrote:
> > I didn't say do it like exactly Linux ☺
> > Let me take a look ...
>
> just don't go nuts with it.  =)  trapentry and all of the asm related
> to context switches are delicate things.  you just happened to see some
> of it in this diff.  =)
>
> barret
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akaros" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to