Mercurial > ecos-v3_0-branch
changeset 260:922ca26d90c4
Add variables cyg_hal_sys_argc/argv/environ, corresponding to the
arguments and environment vector passed to the synthetic target
application.
| author | bartv |
|---|---|
| date | Sun, 04 Aug 2002 23:18:58 +0000 |
| parents | d3fa78927b0f |
| children | 72947dc266ac |
| files | packages/hal/synth/arch/current/ChangeLog packages/hal/synth/arch/current/include/hal_io.h packages/hal/synth/i386linux/current/ChangeLog packages/hal/synth/i386linux/current/src/vectors.S |
| diffstat | 4 files changed, 52 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/hal/synth/arch/current/ChangeLog +++ b/packages/hal/synth/arch/current/ChangeLog @@ -1,3 +1,7 @@ +2002-08-04 Bart Veer <bartv@tymora.demon.co.uk> + + * include/hal_io.h: added argv/argv/environ definitions + 2002-05-23 Jesper Skov <jskov@redhat.com> * cdl/hal_synth.cdl: Don't run cache tests.
--- a/packages/hal/synth/arch/current/include/hal_io.h +++ b/packages/hal/synth/arch/current/include/hal_io.h @@ -409,6 +409,11 @@ externC int cyg_hal_sys_getc // mmap on the "host" system - this may be unportable. externC int cyg_hal_sys_mmap(struct cyg_hal_sys_mmap_args *); +// Access to environmental data +extern int cyg_hal_sys_argc; +extern const char** cyg_hal_sys_argv; +extern const char** cyg_hal_sys_environ; + // ---------------------------------------------------------------------------- // Interaction between the application and the auxiliary. // Not yet available, but there is a hardware-initialization routine.
--- a/packages/hal/synth/i386linux/current/ChangeLog +++ b/packages/hal/synth/i386linux/current/ChangeLog @@ -1,3 +1,8 @@ +2002-08-04 Bart Veer <bartv@tymora.demon.co.uk> + + * src/vectors.S (_start): + Store argv and environ in cyg_hal_sys_... variables + 2002-04-29 Jonathan Larmour <jlarmour@redhat.com> * src/vectors.S:
--- a/packages/hal/synth/i386linux/current/src/vectors.S +++ b/packages/hal/synth/i386linux/current/src/vectors.S @@ -47,20 +47,56 @@ ## Description: When running on real hardware vectors.S contains ## initialization code and usually the low-level interrupt and ## exception support. On the synthetic target the latter is -## handled by C code. The only initialization that is needed is +## handled by C code. The main initialization that is needed is ## to jump into the C startup. ## ######DESCRIPTIONEND#### ## ##============================================================================= +# According the SVR4/i386 ABI, most registers are undefined. However +# there is some interesting information on the stack: +# %esp argc +# %esp+4 argv[0] +# ... argv[1 onwards] +# %esp + (argc*4) NULL +# ... environ[0] +# ... ... +# ... NULL +# +# There are some other things that could be done, for example aligning +# the stack to a 16-byte boundary for SSE, but it is not clear which of +# those things are actually useful. The glibc source file +# sysdeps/i386/elf/start.S contains some relevant information. #============================================================================== -// .file "vectors.S" + .file "vectors.S" .extern _linux_entry + + .data + .global cyg_hal_sys_argc +cyg_hal_sys_argc: + .long 0 + .global cyg_hal_sys_argv +cyg_hal_sys_argv: + .long 0 + .global cyg_hal_sys_environ +cyg_hal_sys_environ: + .long 0 + .text .globl _start _start: + popl %eax + movl %eax, cyg_hal_sys_argc + movl %esp, %ebx + movl %ebx, cyg_hal_sys_argv + inc %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %ebx + movl %ebx, cyg_hal_sys_environ + jmp _linux_entry
