flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
gunblade 29 Jan 2006, 22:15
Took me longer to find out where to get cdecl.inc from than to find the error.
![]() You forgot to take into account that intel is small-endian which means data is stored backwards. Basically.. replace 0x7F000001 with 0x0100007F. I found this out using strace. Great little program which shows all kernel calls a program makes, such as read, open, accept, listen, etc.. and its parameters. So using that i could easily see that the address the client was trying to connect to was 1.0.0.127 rather than 127.0.0.1. You should use it for debugging programs in linux. If i ever have any problems with a program i made, i usually strace it, if that doesnt show the problem (such as a SIGSERV), then i use ald (assembly language debugger). If that doesnt work, i run around the room screaming ![]() gunblade |
|||
![]() |
|
aseptik 30 Jan 2006, 14:20
Quote: 0x0100007F Yes that's correct but I've just wrote this as optimization to not call inet_aton - i've corrected this just after posting here but still doesn't work... Tried tracing it with ald, also made a c version which works but this asm version just won't give any results! Did it work for you after correcting the ip addr? |
|||
![]() |
|
Endre 31 Jan 2006, 11:32
Can it not be that your assembly implementation of sockaddr_in is wrong?
I mean here that every member of a C-structure is usually aligned to dword boundary. |
|||
![]() |
|
gunblade 01 Feb 2006, 12:30
Worked fine for me after i fixed the address.
Server listens on 0.0.0.0, client connects to it through 127.0.0.1, displays the message, then quits. I'm almost certain i didnt make any other modifications, i'll test it again and edit the post to let you know. edit: That's funny, theres another error there, dunno how it worked before, not on my home computer so i cant test it in the same conditions. But i've tested it on a 2.4 kernel and a 2.6, and the error was in your recv call. You're missing the buffer parameter. You have: Code: ccall recv, [sockfd], 128, 0 Should be: Code: ccall recv, [sockfd], buffer, 128, 0 So just that problem, and the IP address being the wrong way round, and it should work. Good luck, gunblade |
|||
![]() |
|
aseptik 01 Feb 2006, 15:53
Hehe, funny error. (there's no i'm with stupid emoticon so i'll just leave it like this)
I've just started to examine that code from start and saw that thingiee lying there missing one parameter, fixed it and it worked. Then I saw you came to same conclusion. It was quite late when I coded that so I'll blame the no-sleep ghost for this. ![]() Regards. |
|||
![]() |
|
noob 06 Sep 2006, 11:13
excuse my ignorance, where do I find cdecl.inc ?
thanks |
|||
![]() |
|
vid 06 Sep 2006, 11:19
i believe you can include PROC32.inc from standard win32 FASM package...
|
|||
![]() |
|
noob 06 Sep 2006, 11:42
win32 even though this is a linux machine ?
|
|||
![]() |
|
vid 06 Sep 2006, 14:37
it is only macros package. in fact, you only need "ccall" macro from it
|
|||
![]() |
|
RedGhost 06 Sep 2006, 19:31
vid wrote: it is only macros package. in fact, you only need "ccall" macro from it Code: add esp, # _________________ redghost.ca |
|||
![]() |
|
noob 06 Sep 2006, 20:15
I'm still confused with this, is this socket example supposed to be for windows or linux ? I'm looking for a client socket example for linux, I dont have cdecl.inc, and not sure how this example has worked on linux. Vid, I dont follow your post on macros, I think I need to find myself some more reading material!
|
|||
![]() |
|
okasvi 06 Sep 2006, 22:06
noob wrote: I'm still confused with this, is this socket example supposed to be for windows or linux ? I'm looking for a client socket example for linux, I dont have cdecl.inc, and not sure how this example has worked on linux. Vid, I dont follow your post on macros, I think I need to find myself some more reading material! cdecl.inc is for ccall macro. Code: ccall send, [clientfd], buffer, buff_size, 0 without macro: Code: push 0 push buff_size push buffer push [clientfd] call send add esp, 4*4 ;to balance stack the 4*4 is how many bytes you pushed to stack for send, 4 params, 4bytes each. and these examples are for Linux. _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
![]() |
|
vid 07 Sep 2006, 07:09
CDECL.INC:
Code: macro ccall proc,[arg] ; directly call CDECL procedure { common size@ccall = 0 if ~ arg eq reverse pushd arg size@ccall = size@ccall+4 common end if call proc if size@ccall add esp,size@ccall end if } |
|||
![]() |
|
sylwek32 07 Sep 2006, 20:18
how to use .O on linux ?
i type chmod 777 srva.O and it says ok then ./srva.O proxy:/var/www# ./srva.O -bash: ./srva.O: cannot execute binary file proxy:/var/www# |
|||
![]() |
|
gunblade 07 Sep 2006, 21:20
.o are the linux equivalent of MSCOFF .obj files.
You got 2 choices, either use gcc/ld to link it into an executable. Code: ld filename.o -o filename should link it fine, if it gives you errors about undefined symbols and such, use: Code: gcc filename.o -o filename gcc uses ld to link the object into an executable too, but it includes the default libraries by default, meaning you dont have to. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.