]> Zhao Yanbai Git Server - minix.git/commitdiff
generate offsets for ucontext.S
authorBen Gras <ben@minix3.org>
Tue, 19 Jun 2012 02:16:41 +0000 (02:16 +0000)
committerBen Gras <ben@minix3.org>
Tue, 19 Jun 2012 13:47:25 +0000 (15:47 +0200)
lib/libc/arch/i386/sys-minix/Makefile.inc
lib/libc/arch/i386/sys-minix/ucontext.S
lib/libc/arch/i386/sys-minix/ucontextoffsets.cf [new file with mode: 0644]

index 82b6ee2ed5cf535afd422594209119eff9650229..0c933edca2a0fc42e06b88ffd2440933921736bc 100644 (file)
@@ -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 $@
+
index 27e237e364c0b237d3826b9c8b58c2bfd57aa261..3c73c0970b91b66f046eddd9534203abf27d18f0 100644 (file)
@@ -1,4 +1,5 @@
 #include <machine/asm.h>
+#include <ucontextoffsets.h>
 
 #ifdef __ACK__
 .text
@@ -21,31 +22,6 @@ IMPORT(setuctx)
 IMPORT(resumecontext)
 
 
-/* Offsets into ucontext_t structure. Keep in sync with <sys/ucontext.h>! */
-#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 <mcontext.h> */
 #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 (file)
index 0000000..6473f56
--- /dev/null
@@ -0,0 +1,18 @@
+
+include <minix/type.h>
+include <sys/ucontext.h>
+
+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
+