2d72cbec41
. add cpufeature detection of both . use it for both ipc and kernelcall traps, using a register for call number . SYSENTER/SYSCALL does not save any context, therefore userland has to save it . to accomodate multiple kernel entry/exit types, the entry type is recorded in the process struct. hitherto all types were interrupt (soft int, exception, hard int); now SYSENTER/SYSCALL is new, with the difference that context is not fully restored from proc struct when running the process again. this can't be done as some information is missing. . complication: cases in which the kernel has to fully change process context (i.e. sigreturn). in that case the exit type is changed from SYSENTER/SYSEXIT to soft-int (i.e. iret) and context is fully restored from the proc struct. this does mean the PC and SP must change, as the sysenter/sysexit userland code will otherwise try to restore its own context. this is true in the sigreturn case. . override all usage by setting libc_ipc=1
80 lines
2.4 KiB
Makefile
80 lines
2.4 KiB
Makefile
|
|
# Makefile for arch-dependent kernel code
|
|
.include <bsd.own.mk>
|
|
|
|
HERE=${.CURDIR}/arch/${MACHINE_ARCH}
|
|
.PATH: ${HERE}
|
|
|
|
# objects we want unpaged from -lminlib, -lminc
|
|
MINLIB_OBJS_UNPAGED=_cpufeature.o _cpuid.o get_bp.o
|
|
MINC_OBJS_UNPAGED=strcat.o strlen.o memcpy.o strcpy.o strncmp.o memset.o \
|
|
memmove.o strcmp.o atoi.o ctype_.o _stdfile.o strtol.o _errno.o errno.o \
|
|
udivdi3.o umoddi3.o qdivrem.o
|
|
SYS_OBJS_UNPAGED=kprintf.o vprintf.o assert.o stacktrace.o
|
|
|
|
# some object files we give a symbol prefix (or namespace) of __k_unpaged_
|
|
# that must live in their own unique namespace.
|
|
#
|
|
.for UNPAGED_OBJ in head.o pre_init.o direct_tty_utils.o io_outb.o \
|
|
io_inb.o pg_utils.o klib.o utility.o arch_reset.o \
|
|
$(MINLIB_OBJS_UNPAGED) $(MINC_OBJS_UNPAGED) $(SYS_OBJS_UNPAGED)
|
|
unpaged_${UNPAGED_OBJ}: ${UNPAGED_OBJ}
|
|
objcopy --prefix-symbols=__k_unpaged_ ${UNPAGED_OBJ} unpaged_${UNPAGED_OBJ}
|
|
UNPAGED_OBJS += unpaged_${UNPAGED_OBJ}
|
|
ORIG_UNPAGED_OBJS += ${UNPAGED_OBJ}
|
|
.endfor
|
|
|
|
# we have to extract some object files from libminc.a and libminlib.a
|
|
$(MINLIB_OBJS_UNPAGED) $(MINC_OBJS_UNPAGED) $(SYS_OBJS_UNPAGED): $(LIBMINLIB) $(LIBMINC) $(LIBSYS)
|
|
ar x $(LIBMINLIB) $(MINLIB_OBJS_UNPAGED)
|
|
ar x $(LIBMINC) $(MINC_OBJS_UNPAGED)
|
|
ar x $(LIBSYS) $(SYS_OBJS_UNPAGED)
|
|
|
|
CLEANFILES+= $(ORIG_UNPAGED_OBJS)
|
|
|
|
SRCS+= mpx.S arch_clock.c arch_do_vmctl.c arch_system.c \
|
|
do_iopenable.c do_readbios.c do_sdevio.c exception.c i8259.c io_inb.S \
|
|
io_inl.S io_intr.S io_inw.S io_outb.S io_outl.S io_outw.S klib.S klib16.S memory.c \
|
|
oxpcie.c protect.c direct_tty_utils.c arch_reset.c \
|
|
pg_utils.c usermapped_glo_ipc.S usermapped_data_arch.c
|
|
|
|
OBJS.kernel+= ${UNPAGED_OBJS}
|
|
|
|
.if ${USE_ACPI} != "no"
|
|
SRCS+= acpi.c
|
|
CPPFLAGS+= -DUSE_ACPI
|
|
.endif
|
|
|
|
.if ${USE_APIC} != "no"
|
|
SRCS+= apic.c apic_asm.S
|
|
CPPFLAGS+= -DUSE_APIC
|
|
.endif
|
|
|
|
.if ${USE_DEBUGREG} != "no"
|
|
SRCS+= breakpoints.c debugreg.S
|
|
.endif
|
|
|
|
.if ${USE_WATCHDOG} != "no"
|
|
SRCS+= arch_watchdog.c
|
|
CPPFLAGS+= -DUSE_WATCHDOG
|
|
.endif
|
|
|
|
apic_asm.d klib.d mpx.d head.d: procoffsets.h
|
|
|
|
# It's OK to hardcode the arch as i386 here as this and procoffsets.cf
|
|
# are i386-specific.
|
|
TMP=procoffsets.h.tmp
|
|
INCLS=../include/arch/i386/include/
|
|
PROCOFFSETSCF=procoffsets.cf
|
|
|
|
procoffsets.h: $(PROCOFFSETSCF) kernel.h proc.h $(INCLS)/stackframe.h $(INCLS)/archtypes.h
|
|
${_MKTARGET_CREATE}
|
|
cat ${HERE}/$(PROCOFFSETSCF) | \
|
|
${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} >$TMP && \
|
|
mv -f $TMP $@
|
|
|
|
.ifdef CONFIG_SMP
|
|
SRCS += arch_smp.c trampoline.S
|
|
.endif
|
|
|
|
|