| |
| |
| |
|
Comments:
<0> heheh <1> When a process is started, can it ***ume the floating-point stack is empty? When an external library call is made? <1> A better question.. I have a asm-coded object file that I want to link into a bigger C-coded project. It needs to use 6 floating-point registers per call. How can I be sure that six are available? <2> http://x-os.homeip.net/x-os/hdir/pdf/sysv/psABI-i386.pdf <2> you can be sure. <1> reading... <2> it's just that you shouldn't call any C code while stack is non-empty. <1> noted. that's won't be a problem ;-) <1> *that <3> let's go the bed <1> I have an object file compiled using 'as' under windows. I am linking it into a C project. I call one function in the asm object file (_asm_function) from C. I am getting an "undefined reference to _asm_function) from the linker. Under linux, all I had to do to export _asm_function was add .global _asm_function below .section .text Is there something else I need to do under win32? <4> WHERE can i learn more about how/what a linker like ld does besides the gnu ld manual? <4> (not sure ld manual goes into much details i'm interested in)
<5> I can tell you exactly what a linker does <4> __mikem: great, thanks...the reason i'm asking is cuz i'm having problems combining my toy C kernel with my toy boot loader i wrote <5> Do you want to know about dynamic linking or static linking <4> __mikem: i guess static would be good enough...if my kernel was in asm then i could just append it to boot loader <5> ok static linking is relatively streight forward <4> __mikem: actually...i'd have to join the data/text/bss sections into one...etc. <5> when the code is ***embled, symbols that represent certain functions are left behind. The linker looks at those symbols and tries to find the respective code in the static libraries. <5> the code from the static libraries is "included" in the final output file <4> __mikem: ok <5> theres a bit more <5> when the code is included, since there are a lot of sections in the file that come AFTER the executable code section, refferences to data in that section have to be updated. This is done in the relocation table <5> actually that is an over simplistic explaination of the relocation table, but it really isn't important to know about that <5> in reality, everything is moved around, not just the sections that have to move to make room for the additional code <4> __mikem: doesn't every included piece have its own data/text/bss section? seems like quite a feat to combine all of 'em into one super text/data/bss chunk <5> I am actually not sure how that works. <5> Seb, it is posible to have more than one section marked 'executable' but I have never actually seen this when examening dis***embled code <5> Dynamic linking is a bit different, in the PE format, its accomplished with a jump table <4> __mikem: there is a ld linking script on 3 page of http://osdever.net/bkerndev/index.php?the_id=90 <5> THis jump table lists the name of each function in plain text. Each function name is listed under its library name <4> __mikem: there are commands like . = ALIGN(4096) ...i'm not sure what is purpose of "aligning" code <5> code that is aligned on addresses that are multiples of four require less time to execute <4> __mikem: i like your good info....WHERE did you read/learn about this stuff? got any good books to recommend? <5> seb- I have a lot of time on my hands <4> __mikem: GOOD! aligning is just an optimization!! yay! something a newbie can ignore for now! <4> __mikem: so do i but i still need a *source* to learn from during all that free time! <5> lol, I really wouldn't say that. Optomization is one of the primary reasons to learn ***embly language in the first place now days <5> seb- I learned about pe format off of documentation on msdn, I had to learn about linkers in order to understand what I was looking at. I was building my own dis***embler at the time <4> __mikem: what is pe? <5> Portable Executable Format. Its the binary format windows uses for executable files <5> Mac also uses it <1> really? <5> Mac OS I mean <1> I thought mac had their own <5> nope <5> or if they do, they switched after the documentation on msdn was writen <1> I'd hazard a guess that Mac is ELF since OS X <1> or whatever BSD uses <5> It wouldn't surprise me <5> But, in all fairness, PE is a prety elegent format <1> anyways... I need to repost my question <4> __mikem: are you sure PE doesn't stand for "pretty elegant" ? <1> I have an object file compiled using 'as' under windows. I am linking it into a C project. I call one function in the asm object file (_asm_function) from C. I am getting an "undefined reference to _asm_function) from the linker. Under linux, all I had to do to export _asm_function was add .global _asm_function below .section .text Is there something else I need to do under win32? <1> heh heh <5> Probably a different object file format <5> seb positive <5> diodesign why are you doing that? <6> appears to be xcode's default output with gcc <5> but I can't see why mac osx would use Mach-0 <1> ah... I got it. Win32 has some stupid requirement about symbol names <7> Hi <7> I have an array, and a variable, the variable used as an offset in the array.
<7> How can I write to the array ? <7> I guess mov DWORD PTR Array + DWORD PTR Offst, 42; won't work... <4> Axioplase: you want lea a, [b] <4> Axioplase: you can't do math outside of []'s <4> such as addition <7> lea [DWORD PTR Array + DWORD Ptr Offst], 42 ? <7> I still guess there are too many memory operands... <7> (I want to do it with as few instructions as possible) <4> Axioplase: that is what lea is for...to use a few opcodes as possible <4> Axioplase: if you were concerned with optimization you could add Array and Offset in another step first and store result in eax <4> not* <4> were not* <7> If I were not, yes I would... <7> hum... What if I use a real pointer and not an offset... <4> Axioplase: are you trying to step thru an array? <4> Axioplase: because you might like lodsb and friends if so <7> seb-, well... yes.. filling an array/list, with a few bunch of elements at time... <7> I ll get a look a lodsb then, thanks <7> Hum... I only wish it could use something else than al/ax/eax ... <4> Axioplase: why? <7> seb-, because I'll have to save eax before using it... <7> I didn't choose where data is sotred (reg or stack). <7> I wrote a register allcoation program for that.. <7> And therefore, chances are there is some Important data in eax that I'll have to save/restore each time I wan't to append something to my array. <4> Axioplase: then perhaps a loop with some lea's is preferred <7> maybe... <7> argh... <7> I have defined an area to be used later....comm HEAP,4000000,32 <7> How can I get a pointer to this area ? <7> mov eax, HEAP dosn't work... (it moves 0 in eax) <8> lea eax, HEAP <7> haa.. <7> seb-, err.. would you mind telling me if those (commented) 10 lines of code really do what I want them to do ? http://cpp.sourceforge.net/?show=19321 <7> because I ddidn't succeed in incrementing my pointer in the array.. <9> hello <9> I wonder... in AT&T syntax, is jmpl == ljmp? <9> I only know about ljmp (far jump) -- is jmpl the same (and with the same syntax)? <10> ljmp? what ***embly is that? <9> I try to understand this code: http://kernel25.sourcesdb.com/r.php?num=1094 <9> x86 <10> there is really no ljmp in x86 afaik, just jmp far, you mean that? <9> yes, JUMP FAR in Intel syntax it is written as ljmp in gas syntax (gcc ***embler) <9> JMP* <10> hmm, k, sorry that I can't be of much help, not too familiar with GAS. <9> I see this: jmpl$BOOTSEG, $start2 -- and from what I understand, is a far jump (because the code is 16 bit) to 0x07C0:start2 <9> ok, thanks anyway :) <10> yeah, that's a far jump because it involves a segment selection <11> http://rafb.net/paste/results/CPEVbE69.html the idct_row for coldfire line 327, I am not sure if the (int_16 * block) pointer is p***ed appropriately to the asm function. I use the "a" modifier, to force gcc to use an adress operand. I am also not sure the words are in the appropriate order (big endian or not) <11> that's coldfire ***embly <12> seems pretty much right <2> however, you use quite a lot registers... gcc could run out of them if you use it without optimisation options <2> also, i'm not quite sure if [block]"a"(block) is the right syntax... but then, i never used it, so don't rely on this info <11> what do you mean ? <11> mwk: I tell gcc to not use this register <11> I have not other choice by the way <2> ok. <11> mwk there is a problem indeed <11> the screen is garbeled <11> though it's supposed ot be the copy of the C part in asm <11> I believe I have a problem with bits order <11> something like that
Return to
#asm or Go to some related
logs:
#oe #perl ubuntu bbo yapgvb StringIO error opening security policy ubuntu vncserver #php tombrt kismet autoconfig #perl #web
|
|