2 # Makefile for arch-dependent kernel code
5 HERE=${.CURDIR}/arch/${MACHINE_ARCH}
8 # objects we want unpaged from -lminlib, -lminc
9 MINLIB_OBJS_UNPAGED=_cpufeature.o _cpuid.o get_bp.o
10 MINC_OBJS_UNPAGED=strcat.o strlen.o memcpy.o strcpy.o strncmp.o memset.o \
11 memmove.o strcmp.o atoi.o ctype_.o _stdfile.o strtol.o _errno.o errno.o \
12 udivdi3.o umoddi3.o qdivrem.o
13 SYS_OBJS_UNPAGED=kprintf.o vprintf.o assert.o stacktrace.o
15 # some object files we give a symbol prefix (or namespace) of __k_unpaged_
16 # that must live in their own unique namespace.
18 .for UNPAGED_OBJ in head.o pre_init.o direct_tty_utils.o io_outb.o \
19 io_inb.o pg_utils.o klib.o utility.o arch_reset.o \
20 $(MINLIB_OBJS_UNPAGED) $(MINC_OBJS_UNPAGED) $(SYS_OBJS_UNPAGED)
21 unpaged_${UNPAGED_OBJ}: ${UNPAGED_OBJ}
22 objcopy --prefix-symbols=__k_unpaged_ ${UNPAGED_OBJ} unpaged_${UNPAGED_OBJ}
23 UNPAGED_OBJS += unpaged_${UNPAGED_OBJ}
24 ORIG_UNPAGED_OBJS += ${UNPAGED_OBJ}
27 # we have to extract some object files from libminc.a and libminlib.a
28 $(MINLIB_OBJS_UNPAGED) $(MINC_OBJS_UNPAGED) $(SYS_OBJS_UNPAGED): $(LIBMINLIB) $(LIBMINC) $(LIBSYS)
29 ar x $(LIBMINLIB) $(MINLIB_OBJS_UNPAGED)
30 ar x $(LIBMINC) $(MINC_OBJS_UNPAGED)
31 ar x $(LIBSYS) $(SYS_OBJS_UNPAGED)
33 CLEANFILES+= $(ORIG_UNPAGED_OBJS)
35 SRCS+= mpx.S arch_clock.c arch_do_vmctl.c arch_system.c \
36 do_iopenable.c do_readbios.c do_sdevio.c exception.c i8259.c io_inb.S \
37 io_inl.S io_intr.S io_inw.S io_outb.S io_outl.S io_outw.S klib.S klib16.S memory.c \
38 oxpcie.c protect.c direct_tty_utils.c arch_reset.c \
41 OBJS.kernel+= ${UNPAGED_OBJS}
43 .if ${USE_ACPI} != "no"
48 .if ${USE_APIC} != "no"
49 SRCS+= apic.c apic_asm.S
53 .if ${USE_DEBUGREG} != "no"
54 SRCS+= breakpoints.c debugreg.S
57 .if ${USE_WATCHDOG} != "no"
58 SRCS+= arch_watchdog.c
59 CPPFLAGS+= -DUSE_WATCHDOG
62 apic_asm.d klib.d mpx.d head.d: procoffsets.h
64 # It's OK to hardcode the arch as i386 here as this and procoffsets.cf
67 INCLS=../include/arch/i386/include/
68 PROCOFFSETSCF=procoffsets.cf
70 procoffsets.h: $(PROCOFFSETSCF) kernel.h proc.h $(INCLS)/stackframe.h $(INCLS)/archtypes.h
72 cat ${HERE}/$(PROCOFFSETSCF) | \
73 ${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} >$TMP && \
77 SRCS += arch_smp.c trampoline.S