generate offsets for ucontext.S

This commit is contained in:
Ben Gras 2012-06-19 02:16:41 +00:00
parent 9b7938d815
commit cb1418a5e1
3 changed files with 37 additions and 26 deletions

View file

@ -1,5 +1,15 @@
# rts sources # 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+= \ SRCS+= \
__sigreturn.S \ __sigreturn.S \
@ -7,3 +17,10 @@ SRCS+= \
_senda.S \ _senda.S \
brksize.S \ brksize.S \
ucontext.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 $@

View file

@ -1,4 +1,5 @@
#include <machine/asm.h> #include <machine/asm.h>
#include <ucontextoffsets.h>
#ifdef __ACK__ #ifdef __ACK__
.text .text
@ -21,31 +22,6 @@ IMPORT(setuctx)
IMPORT(resumecontext) 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> */ /* MCF_MAGIC value from <mcontext.h> */
#define MCF_MAGIC 0xc0ffee #define MCF_MAGIC 0xc0ffee

View file

@ -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