[mirmince commits] {mirmince} branch master updated. 8766f7baa3f2277f64a463e5d9f348149f4e1a90
tg at freewrt.org
tg at freewrt.org
Mon Jul 15 23:17:52 UTC 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main git repository for FreeWRT project mirmince".
The branch, master has been updated
via 8766f7baa3f2277f64a463e5d9f348149f4e1a90 (commit)
via eff1beb2b74004ac4658f430586a5f1b9c405f41 (commit)
from cc491667cee3162e5181fcb99974a2276e075df1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8766f7baa3f2277f64a463e5d9f348149f4e1a90
Author: Thorsten Glaser <tg at mirbsd.org>
Date: Mon Jul 15 23:16:30 2013 +0000
add _exit(), make exit() use it, ensure hlt in _exit() when syscall returns
commit eff1beb2b74004ac4658f430586a5f1b9c405f41
Author: Thorsten Glaser <tg at mirbsd.org>
Date: Mon Jul 15 22:42:58 2013 +0000
ensure stack frames that gdb(1) can handle
-----------------------------------------------------------------------
Summary of changes:
include/unistd.h | 3 +++
md/i386/Makefile.inc | 5 +++++
mi/Makefile.inc | 1 +
mi/{exit.c => _exit.c} | 13 +++++++++----
mi/exit.c | 7 ++-----
osdep/linux/i386/mincebeg_md.S | 3 ++-
osdep/midnightbsd/amd64/mincebeg_md.S | 14 +++++++-------
osdep/midnightbsd/i386/mincebeg_md.S | 12 +++++-------
osdep/mirbsd/i386/mincebeg_md.S | 12 +++++-------
9 files changed, 39 insertions(+), 31 deletions(-)
copy mi/{exit.c => _exit.c} (80%)
diff --git a/include/unistd.h b/include/unistd.h
index 7ad37ab..3f9ff09 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -19,6 +19,9 @@
#define STDERR_FILENO 2
__BEGIN_DECLS
+void _exit(int status)
+ mirmince_dead
+ mirmince_cc_userspc;
int close(int fd)
mirmincE_cc_close;
ssize_t read(int fd, void *buf, size_t nbytes)
diff --git a/md/i386/Makefile.inc b/md/i386/Makefile.inc
index c187f55..e36e076 100644
--- a/md/i386/Makefile.inc
+++ b/md/i386/Makefile.inc
@@ -1,3 +1,8 @@
+.ifdef DEBUG
+MD_USE_REGPARM?= No
+MD_USE_RTD?= No
+.endif
+
MD_USE_REGPARM?= Yes
MD_USE_RTD?= Yes
diff --git a/mi/Makefile.inc b/mi/Makefile.inc
index fbf9400..847ef35 100644
--- a/mi/Makefile.inc
+++ b/mi/Makefile.inc
@@ -1,5 +1,6 @@
SRCS+= vars.c
+SRCS+= _exit.c
SRCS+= exit.c
SRCS+= strlen.c
diff --git a/mi/exit.c b/mi/_exit.c
similarity index 80%
copy from mi/exit.c
copy to mi/_exit.c
index ec8af0b..a475b0d 100644
--- a/mi/exit.c
+++ b/mi/_exit.c
@@ -18,14 +18,19 @@
* of said person’s immediate fault when using the work as intended.
*/
-#include <stdlib.h>
+#include <unistd.h>
extern int _exit__(int status)
- mirmince_dead
mirmincE_cc__exit__;
-mirmincE_cc_exit void
-exit(int status)
+mirmince_dead mirmince_cc_userspc void
+_exit(int status)
{
_exit__(status);
+#if defined(__mirmincE_arch_amd64) || defined(__mirmincE_arch_i386)
+ __asm__ volatile ("hlt" : : : "memory");
+#else
+# warning need HLT instruction
+#endif
+ loop: goto loop;
}
diff --git a/mi/exit.c b/mi/exit.c
index ec8af0b..2b37a31 100644
--- a/mi/exit.c
+++ b/mi/exit.c
@@ -19,13 +19,10 @@
*/
#include <stdlib.h>
-
-extern int _exit__(int status)
- mirmince_dead
- mirmincE_cc__exit__;
+#include <unistd.h>
mirmincE_cc_exit void
exit(int status)
{
- _exit__(status);
+ _exit(status);
}
diff --git a/osdep/linux/i386/mincebeg_md.S b/osdep/linux/i386/mincebeg_md.S
index 71ce8e6..80690a4 100644
--- a/osdep/linux/i386/mincebeg_md.S
+++ b/osdep/linux/i386/mincebeg_md.S
@@ -1,5 +1,5 @@
/*-
- * Copyright © 2004, 2005, 2007, 2013
+ * Copyright © 2013
* Thorsten Glaser <tg at mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@@ -24,6 +24,7 @@ _TEXT
_ALIGN_TEXT
ASENTRY(_mince_csu_init)
cld /* required by the ABI */
+ xor ebp,ebp /* clear the frame pointer */
pop eax /* argc */
mov edx,esp /* argv */
lea ecx,[edx+4*eax+4] /* envp = argv[argc + 1] */
diff --git a/osdep/midnightbsd/amd64/mincebeg_md.S b/osdep/midnightbsd/amd64/mincebeg_md.S
index f93ab60..77b9e65 100644
--- a/osdep/midnightbsd/amd64/mincebeg_md.S
+++ b/osdep/midnightbsd/amd64/mincebeg_md.S
@@ -24,14 +24,14 @@ _TEXT
_ALIGN_TEXT
ASENTRY(_mince_csu_init)
cld /* required by the ABI */
- xor ebp,ebp /* clear the frame pointer */
/* should be rsp according to the ELF psABI, but FreeBSD uses rdi */
- mov rcx,rdi
+ mov rbp,rdi
/* load arguments */
- mov rdi,[rcx] /* argc */
- lea rsi,8[rcx] /* argv */
- lea rdx,[rcx+8*rdi+16] /* envp */
- /* align the stack */
- and rsp,0xFFFFFFFFFFFFFFF0
+ mov rdi,[rbp] /* argc */
+ lea rsi,[rbp+8] /* argv */
+ lea rdx,[rbp+8*rdi+16] /* envp */
+ /* create an aligned stack frame */
+ xor ebp,ebp /* clear the frame pointer */
+ and rsp,0xFFFFFFFFFFFFFFF0 /* align the stack pointer */
call _C_LABEL(_mince_csu_run)
ENDSYM(_mince_csu_init)
diff --git a/osdep/midnightbsd/i386/mincebeg_md.S b/osdep/midnightbsd/i386/mincebeg_md.S
index a5252c5..80690a4 100644
--- a/osdep/midnightbsd/i386/mincebeg_md.S
+++ b/osdep/midnightbsd/i386/mincebeg_md.S
@@ -1,5 +1,5 @@
/*-
- * Copyright © 2004, 2005, 2007, 2013
+ * Copyright © 2013
* Thorsten Glaser <tg at mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@@ -24,12 +24,10 @@ _TEXT
_ALIGN_TEXT
ASENTRY(_mince_csu_init)
cld /* required by the ABI */
- push ebx /* ps_strings (unused) */
- push ecx /* obj (unused) */
- push edx /* cleanup (unused) */
- mov eax,[esp+12]
- lea ecx,[esp+4*eax+20]
- lea edx,[esp+16]
+ xor ebp,ebp /* clear the frame pointer */
+ pop eax /* argc */
+ mov edx,esp /* argv */
+ lea ecx,[edx+4*eax+4] /* envp = argv[argc + 1] */
push ecx /* envp */
push edx /* argv */
push eax /* argc */
diff --git a/osdep/mirbsd/i386/mincebeg_md.S b/osdep/mirbsd/i386/mincebeg_md.S
index a5252c5..80690a4 100644
--- a/osdep/mirbsd/i386/mincebeg_md.S
+++ b/osdep/mirbsd/i386/mincebeg_md.S
@@ -1,5 +1,5 @@
/*-
- * Copyright © 2004, 2005, 2007, 2013
+ * Copyright © 2013
* Thorsten Glaser <tg at mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@@ -24,12 +24,10 @@ _TEXT
_ALIGN_TEXT
ASENTRY(_mince_csu_init)
cld /* required by the ABI */
- push ebx /* ps_strings (unused) */
- push ecx /* obj (unused) */
- push edx /* cleanup (unused) */
- mov eax,[esp+12]
- lea ecx,[esp+4*eax+20]
- lea edx,[esp+16]
+ xor ebp,ebp /* clear the frame pointer */
+ pop eax /* argc */
+ mov edx,esp /* argv */
+ lea ecx,[edx+4*eax+4] /* envp = argv[argc + 1] */
push ecx /* envp */
push edx /* argv */
push eax /* argc */
hooks/post-receive
--
Main git repository for FreeWRT project mirmince
(FreeWRT project mirmince repository mirmince)
More information about the mirmince-commits
mailing list