From cb1418a5e176e431bdd6acfcecc3c00032f2ed7e Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 19 Jun 2012 02:16:41 +0000 Subject: [PATCH] generate offsets for ucontext.S --- lib/libc/arch/i386/sys-minix/Makefile.inc | 19 +++++++++++++- lib/libc/arch/i386/sys-minix/ucontext.S | 26 +------------------ .../arch/i386/sys-minix/ucontextoffsets.cf | 18 +++++++++++++ 3 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 lib/libc/arch/i386/sys-minix/ucontextoffsets.cf diff --git a/lib/libc/arch/i386/sys-minix/Makefile.inc b/lib/libc/arch/i386/sys-minix/Makefile.inc index 82b6ee2ed..0c933edca 100644 --- a/lib/libc/arch/i386/sys-minix/Makefile.inc +++ b/lib/libc/arch/i386/sys-minix/Makefile.inc @@ -1,5 +1,15 @@ # rts sources -.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/sys-minix +HERE=${.CURDIR}/arch/${MACHINE_ARCH}/sys-minix +.PATH: ${HERE} + +TMP=ucontextoffsets.h.tmp +INCLS=../../include +ARCHINCLS=$(INCLS)/arch/i386/include/ +CF=ucontextoffsets.cf + +INCS+=ucontextoffsets.h + +ucontext.d: ucontextoffsets.h SRCS+= \ __sigreturn.S \ @@ -7,3 +17,10 @@ SRCS+= \ _senda.S \ brksize.S \ ucontext.S + +ucontextoffsets.h: $(CF) $(ARCHINCLS)/stackframe.h $(INCLS)/sys/ucontext.h + ${_MKTARGET_CREATE} + cat ${HERE}/$(CF) | \ + ${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} >$TMP && \ + mv -f $TMP $@ + diff --git a/lib/libc/arch/i386/sys-minix/ucontext.S b/lib/libc/arch/i386/sys-minix/ucontext.S index 27e237e36..3c73c0970 100644 --- a/lib/libc/arch/i386/sys-minix/ucontext.S +++ b/lib/libc/arch/i386/sys-minix/ucontext.S @@ -1,4 +1,5 @@ #include +#include #ifdef __ACK__ .text @@ -21,31 +22,6 @@ IMPORT(setuctx) IMPORT(resumecontext) -/* Offsets into ucontext_t structure. Keep in sync with ! */ -#define UC_FLAGS 0 -#define UC_LINK UC_FLAGS + 4 -#define MCTX UC_LINK + 4 -#define MAGIC MCTX -#define GS MAGIC+4 -#define FS GS+2 -#define ES FS+2 -#define DS ES+2 -#define DI DS+2 -#define SI DI+4 -#define BP SI+4 -#define ST BP+4 /* Hole for another SP */ -#define BX ST+4 -#define DX BX+4 -#define CX DX+4 -#define AX CX+4 -#define RETADR AX+4 -#define PC RETADR+4 -#define CS PC+4 -#define PSW CS+4 -#define SP PSW+4 -#define SS SP+4 - - /* MCF_MAGIC value from */ #define MCF_MAGIC 0xc0ffee diff --git a/lib/libc/arch/i386/sys-minix/ucontextoffsets.cf b/lib/libc/arch/i386/sys-minix/ucontextoffsets.cf new file mode 100644 index 000000000..6473f569a --- /dev/null +++ b/lib/libc/arch/i386/sys-minix/ucontextoffsets.cf @@ -0,0 +1,18 @@ + +include +include + +struct __ucontext +member UC_FLAGS uc_flags +member UC_LINK uc_link +member MAGIC uc_mcontext.mc_magic +member DI uc_mcontext.mc_p_reg.di +member SI uc_mcontext.mc_p_reg.si +member BP uc_mcontext.mc_p_reg.fp +member AX uc_mcontext.mc_p_reg.retreg +member BX uc_mcontext.mc_p_reg.bx +member CX uc_mcontext.mc_p_reg.cx +member DX uc_mcontext.mc_p_reg.dx +member PC uc_mcontext.mc_p_reg.pc +member SP uc_mcontext.mc_p_reg.sp + -- 2.44.0