Mail Archives: djgpp/1996/07/24/12:45:26
Leath Muller <leathm AT gbrmpa DOT gov DOT au> wrote:
>void fill_block()
>{
> asm volatile ("
> pushl %eax;
> pushl %ebx;
> pushl %ecx;
> movl $50, %ecx;
> movl _value, %ebx;
> movl _mem_block, %eax;
> loop:
> movl %ebx, (%eax);
> addl $4, %eax;
> decl %ecx;
> cmpl $0, %ecx;
> jnz loop;
> popl %ecx;
> popl %ebx;
> popl %eax;
> ");
>}
>int main(void)
>{
> mem_block = (char *)malloc(200);
> value = 0; // not really needed
> fill_block();
> free(mem_block);
>}
>Leathal.
Ok, but I'm not sure what the pushing and popping is about. Does the
compiler rely on certain registers being left alone, and is this why
you're your storing these registers? If so, which registers does the
compiler rely on the value of?
--
Luke Steele
(luke AT jags DOT co DOT uk)
- Raw text -