Hello James,
James Vahn wrote to Jan Wagemakers :
JV> ~/asm$ gcc tijd.s -o tijd
JV> For what it's worth, that ran without a segfault here (kernel 2.0.30,
JV> gcc 2.7.2.1, libc5.4.33).
Well, I was using a Slackware-distribution here, but because Slackware
was/is difficult to upgrade, I have installed Debian here. And indeed, now
there is no segfault :-)
But still, it doesn't work like I expected :-/
/* (/home/jan/assembler/time/tijd.s)
.globl main
main:
pushl $currenttime # push adres of currenttime on the stack
call time # call time
addl $4,%esp
movl currenttime,%eax # test-rout. print value in currenttime
pushl %eax
pushl $.printdec
call printf
addl $8,%esp
ret
.printdec:
.string "%d"
currenttime:
.byte 0,0,0,0
.END
*/
gcc tijd.s -o tijd
This example prints always the value zero on the screen instead of second
since 01Jan1970.
/* (/home/jan/assembler/time/tijd2.S)
.globl main
main:
pushl $0 # push zero on the stack
call time # call time
addl $4,%esp
movl %eax,currenttime # push value in currenttime on stack
movl currenttime,%eax # test rout. print value in currenttime
pushl %eax
pushl $.printdec
call printf
addl $8,%esp
ret
.printdec:
.string "%d"
currenttime:
.byte 0,0,0,0
.END
*/
gcc tijd2.s -o tijd2
And this example gives a segfault. This segfault disappears when I erase
the line with "movl %eax,currenttime". But I don't know why?
Anyone an idea?
Regards - Jan Wagemakers -
o_o Life is short and love is always over in the morning (The Sisters of
Mercy)
--- Terminate 5.00/Pro /Linux.DosEmu.JanW-DOS(PTS)
---------------
* Origin: Linux & Assembler : http://bewoner.dma.be/JanW (2:292/854.19)
|