Searching the Net I wasn't able to find the right formula for the stack padding calculation on the Solaris/SPARC platform. I studied it a little and came up with the following formula. Please contact me if you find it to be incorrect. Solaris stack: [ ............. ] [ argv 0 ] <- argv0 address will be [ ... ] always padded [ argv n ] [ env 0 ] [ ... ] [ env n ] [ hardware name ] [ prog name ] [ padding ] [ 0000 ] <- stack base A little example: 0xffbeffc0 2e 2f 68 6f 6c 65 00 41 52 47 56 31 00 41 52 47 | ./hole.ARGV1.ARG 0xffbeffd0 56 32 00 45 4e 56 30 3d 58 58 58 00 45 4e 56 31 | V2.ENV0=XXX.ENV1 0xffbeffe0 3d 5a 5a 5a 00 53 55 4e 57 2c 55 6c 74 72 61 2d | =ZZZ.SUNW,Ultra- 0xffbefff0 35 5f 31 30 00 68 6f 6c 65 00 00 00 00 00 00 00 | 5_10.hole....... * Important * The program name will be stored without any prefix (as here) if you use the ./ to run it, else the complete path will be included. The formula seems different between solaris versions. ------------------------------------------------------------------------ offset = args_len + envs_len + plat_len + prog_len; if (solaris_version >= 8) offset += 7 - ((offset + (arg_pos + env_pos + 1) * 4 + 3) % 8); else { offset--; offset += (((plat_len + prog_len - 1) % 4 - (offset % 4)) < 0) ? (8 - offset % 4) : (4 - offset % 4); } argv[0] will be at: stack base - offset - 4 (if you start from ffff) Where: arg_pos = number of arguments args_len = length of arguments env_pos = number of environnments envs_len = length of environnments plat_len = hardware name len prog_len = program name len ------------------------------------------------------------------------ other part of this little document: http://wayreth.eu.org/sparc_stack.tar http://wayreth.eu.org/solaris_sparc_32bit.xls http://wayreth.eu.org/solaris_sparc_64bit.xls Inode Raptor