1 # Makefile for arch-dependent kernel code
4 HERE=${.CURDIR}/arch/${MACHINE_ARCH}
7 # objects we want unpaged from -lc
8 MINLIB_OBJS_UNPAGED= _cpufeature.o _cpuid.o get_bp.o
9 _cpufeature.o: ${NETBSDSRCDIR}/minix/lib/libc/arch/${MACHINE_ARCH}/_cpufeature.c
10 _cpuid.o: ${NETBSDSRCDIR}/minix/lib/libc/arch/${MACHINE_ARCH}/_cpuid.S
11 get_bp.o: ${NETBSDSRCDIR}/minix/lib/libc/arch/${MACHINE_ARCH}/get_bp.S
13 # objects we want unpaged from -lsys
14 SYS_OBJS_UNPAGED=assert.o stacktrace.o
15 assert.o: ${NETBSDSRCDIR}/minix/lib/libsys/assert.c
16 stacktrace.o: ${NETBSDSRCDIR}/minix/lib/libsys/stacktrace.c
18 # objects we want unpaged from -lminc
19 MINC_OBJS_UNPAGED= atoi.o \
21 strcmp.o strcpy.o strlen.o strncmp.o \
22 memcpy.o memmove.o memset.o \
23 udivdi3.o umoddi3.o qdivrem.o
24 atoi.o: ${NETBSDSRCDIR}/minix/lib/libminc/atoi.c
25 printf.o: ${NETBSDSRCDIR}/sys/lib/libsa/printf.c
26 subr_prf.o: ${NETBSDSRCDIR}/sys/lib/libsa/subr_prf.c
27 memcpy.o: ${NETBSDSRCDIR}/common/lib/libc/arch/i386/string/memcpy.S
28 memmove.o: ${NETBSDSRCDIR}/common/lib/libc/arch/i386/string/memmove.S
29 memset.o: ${NETBSDSRCDIR}/common/lib/libc/arch/i386/string/memset.S
30 strlen.o: ${NETBSDSRCDIR}/common/lib/libc/arch/i386/string/strlen.S
31 strcpy.o: ${NETBSDSRCDIR}/common/lib/libc/arch/i386/string/strcpy.S
32 strcmp.o: ${NETBSDSRCDIR}/common/lib/libc/arch/i386/string/strcmp.S
34 # the following is required by pre_init.c
35 strncmp.o: ${NETBSDSRCDIR}/common/lib/libc/string/strncmp.c
37 # these are required by kprintn.o:
38 udivdi3.o: ${NETBSDSRCDIR}/common/lib/libc/quad/udivdi3.c
39 umoddi3.o: ${NETBSDSRCDIR}/common/lib/libc/quad/umoddi3.c
40 qdivrem.o: ${NETBSDSRCDIR}/common/lib/libc/quad/qdivrem.c
42 # LSC: putchar and kputc have the same signature. A bit hackish.
43 CPPFLAGS.subr_prf.c+= -Dputchar=kputc
45 # Activate optional support, may be deactivated.
46 CPPFLAGS.subr_prf.c+= -DLIBSA_PRINTF_LONGLONG_SUPPORT -DLIBSA_PRINTF_WIDTH_SUPPORT
48 # some object files we give a symbol prefix (or namespace) of __k_unpaged_
49 # that must live in their own unique namespace.
51 .for unpaged_obj in head.o pre_init.o direct_tty_utils.o \
52 pg_utils.o klib.o utility.o arch_reset.o \
54 ${MINLIB_OBJS_UNPAGED} ${MINC_OBJS_UNPAGED} ${SYS_OBJS_UNPAGED}
56 CLEANFILES+=${unpaged_obj}.bin
57 .if ${USE_BITCODE:Uno} == "yes"
58 unpaged_${unpaged_obj}: ${unpaged_obj}
59 if file -b ${.OBJDIR}/${unpaged_obj} | grep -q '^LLVM'; then \
60 ${LLC} -O1 -march=x86 -mcpu=i586 -filetype=obj -o ${.OBJDIR}/${unpaged_obj}.bin ${.OBJDIR}/${unpaged_obj}; \
62 cp ${.OBJDIR}/${unpaged_obj} ${.OBJDIR}/${unpaged_obj}.bin; \
64 ${OBJCOPY} --prefix-symbols=__k_unpaged_ ${.OBJDIR}/${unpaged_obj}.bin $@
66 unpaged_${unpaged_obj}: ${unpaged_obj}
67 ${OBJCOPY} --prefix-symbols=__k_unpaged_ ${.OBJDIR}/${unpaged_obj} $@
69 UNPAGED_OBJS += unpaged_${unpaged_obj}
70 ORIG_UNPAGED_OBJS += ${unpaged_obj}
73 CLEANFILES+= ${ORIG_UNPAGED_OBJS}
75 SRCS+= mpx.S arch_clock.c arch_do_vmctl.c arch_system.c \
76 klib.S memory.c protect.c direct_tty_utils.c arch_reset.c pg_utils.c
78 SRCS+= do_iopenable.c do_readbios.c do_sdevio.c exception.c i8259.c oxpcie.c \
79 usermapped_data_arch.c \
80 io_inb.S io_inl.S io_intr.S io_inw.S io_outb.S io_outl.S io_outw.S \
83 OBJS.kernel+= ${UNPAGED_OBJS}
86 SRCS += arch_smp.c trampoline.S
89 .if ${USE_ACPI} != "no"
94 .if ${USE_APIC} != "no"
95 SRCS+= apic.c apic_asm.S
99 .if ${USE_DEBUGREG} != "no"
100 SRCS+= breakpoints.c debugreg.S
103 .if ${USE_WATCHDOG} != "no"
104 SRCS+= arch_watchdog.c
105 CPPFLAGS+= -DUSE_WATCHDOG
108 klib.o mpx.o head.o: procoffsets.h
112 PROCOFFSETSCF=procoffsets.cf
114 .PATH: ${NETBSDSRCDIR}/minix/include/arch/${MACHINE_ARCH}/include
116 procoffsets.h: ${PROCOFFSETSCF} kernel.h proc.h stackframe.h archtypes.h
118 ${TOOL_CAT} ${HERE}/${PROCOFFSETSCF} | \
119 ${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} \
120 ${CPPFLAGS} ${PROF} ${${USE_BITCODE:Uno} == "yes":? -fno-lto:} \
121 ${GENASSYM_CPPFLAGS} >$@.tmp && \
124 sconst.h: procoffsets.h
125 apic_asm.o head.o klib.o mpx.o: sconst.h