[EMAIL PROTECTED] said this stuff: > This code works to return 0x57: 31 c0 40 6a 57 50 cd 80 > But that needs 8 bytes! Can't it be shortened? > I noticed that some registers contain zero on program startup. Can I safely > assume they are always initialized to zero and just leave that 31 c0 out?
Freebsd explicitly zeros its registers before executing a program (it then sets specific registers, such as the program counter, flags, and stack pointer). This behavior takes place in an architecture-dependent function, however, so one cannot take for granted that such a thing will occur, nor can one necessarily presume that all generic registers will be zero (indeed, on i386, ebx is set to ps_strings, which may be nonzero when executing bsdi binaries). Still, this is the case as of freebsd 4.5 (alpha, i386) and 5.1 (alpha, amd64, i386, sparc64). Those are the versions and architectures that i briefly checked. This information is in the files with pattern: <arch>/<arch>/machdep.c The function in question is "exec_setregs" on freebsd 5.x, or "setregs" on freebsd 4.x. ari _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"