> TT> I also read that it ran fine on James Vahn's machine..
> Yes. I have compiled another version of my Linux-kernel (2.0.30),
> and now it doesn't generated a seg-fault. But I have (see a
> previous message of me) some other problems now.....
And like a kid with a new toy, I've been playing some more..
From what I've been finding is that while most libc calls are
straightforward in their useage of the stack, ctime isn't.
Further, it seems that ECX and EDX are usually modified on
return from calls and meaningless, while EAX contains meaningful
data (a pointer to the last result?).. EBX seems unchanged.
EAX can be used to return an exitcode but I'm not sure of the
format- experiments with gdb have been as confusing as usual.
; nasm ddate.asm
; gcc ddate.o -o ddate
global main
extern time
extern ctime
extern printf
section .text
main:
push ebp ;Save these.
mov ebp,esp ;
sub esp,4 ;Adjust stack.
push esp ;Begin to build a string
call time ; on the stack for printf.
add esp,4
mov eax,esp ;Find our data on the stack.
push eax ;
call ctime ;Convert time to ASCII.
add esp,4 ;Adjust stack.
push eax ;Finish the printf string.
push dword .printdec ;
call printf
xor eax,eax ;Exitcode 0.
mov esp,ebp ;Clean up and
pop ebp ; exit.
ret
section .data
.printdec db "===========>>> %s",0
--- ifmail-tx (i386 Linux)
---------------
* Origin: jvahn@short.circuit.com (1:346/15.1@fidonet)
|