1 # $NetBSD: Makefile.rumpkern,v 1.101 2010/11/21 22:17:24 pooka Exp $ 2 # 3 4 .include "${RUMPTOP}/Makefile.rump" 5 6 LIB= rump 7 8 .PATH: ${RUMPTOP}/librump/rumpkern \ 9 ${RUMPTOP}/../kern \ 10 ${RUMPTOP}/../uvm \ 11 ${RUMPTOP}/../conf \ 12 ${RUMPTOP}/../dev \ 13 ${RUMPTOP}/../secmodel/suser 14 15 # 16 # Source modules, first the ones specifically implemented for librump. 17 # 18 SRCS= rump.c rumpcopy.c emul.c intr.c lwproc.c klock.c \ 19 kobj_rename.c ltsleep.c memalloc.c scheduler.c \ 20 signals.c sleepq.c threads.c vm.c 21 SRCS+= compat.c 22 23 # Multiprocessor or uniprocessor locking. TODO: select right 24 # locking at runtime. 25 SRCS+= locks.c 26 #SRCS+= locks_up.c 27 28 # Does the arch support multiple processors? 29 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" 30 RUMP_SMP= # defined 31 CPPFLAGS.rump.c+= -DRUMP_SMP 32 .endif 33 34 vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh ${RUMPTOP}/../sys/param.h 35 ${_MKMSG_CREATE} vers.c 36 ${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n 37 SRCS+= vers.c 38 CLEANFILES+= vers.c version 39 40 # use MI pmap for archs not conforming to kernel ABI 41 .ifndef RUMPKMOD 42 SRCS+= pmap_stub.c 43 .endif 44 45 # autogenerated 46 # 47 SRCS+= rump_syscalls.c rumpkern_if_wrappers.c 48 49 # "auto"generated 50 SRCS+= devsw.c 51 52 # 53 # std kernel sources 54 # 55 # sys/kern 56 SRCS+= init_sysctl_base.c \ 57 kern_auth.c \ 58 kern_cfglock.c \ 59 kern_descrip.c \ 60 kern_event.c \ 61 kern_hook.c \ 62 kern_ksyms.c \ 63 kern_malloc_stdtype.c \ 64 kern_module.c \ 65 kern_mutex_obj.c \ 66 kern_ntptime.c \ 67 kern_proc.c \ 68 kern_prot.c \ 69 kern_rate.c \ 70 kern_resource.c \ 71 kern_stub.c \ 72 kern_syscall.c \ 73 kern_sysctl.c \ 74 kern_tc.c \ 75 kern_timeout.c \ 76 kern_uidinfo.c \ 77 kern_xxx.c \ 78 param.c \ 79 subr_devsw.c \ 80 subr_callback.c \ 81 subr_copy.c \ 82 subr_device.c \ 83 subr_evcnt.c \ 84 subr_extent.c \ 85 subr_hash.c \ 86 subr_humanize.c \ 87 subr_iostat.c \ 88 subr_kobj.c \ 89 subr_log.c \ 90 subr_lwp_specificdata.c \ 91 subr_once.c \ 92 subr_prf.c \ 93 subr_specificdata.c \ 94 subr_time.c \ 95 subr_workqueue.c \ 96 subr_xcall.c \ 97 sys_descrip.c \ 98 sys_generic.c \ 99 sys_module.c \ 100 sys_pipe.c \ 101 sys_select.c \ 102 syscalls.c 103 104 # sys/uvm 105 SRCS+= uvm_aobj.c uvm_readahead.c 106 107 # 4.4BSD secmodel. selection is hardcoded for now 108 SRCS+= secmodel_suser.c 109 110 # the funny bit. this doesn't really belong here, but helps with the 111 # needs of kern_descrip.c. And since it's a fully dynamic interface, 112 # it doesn't pull in other gunk. 113 SRCS+= vnode_if.c 114 115 # sys/dev 116 SRCS+= clock_subr.c 117 118 # Flip the comment to the other line if you want to use malloc(3) 119 # directly instead of the kernel allocators backed by malloc(3)/mmap(2). 120 # Libc malloc is a few percent faster, but doesn't emulate all kernel 121 # corner cases as well (not to mention if you want to debug the 122 # allocators themselves). 123 #CPPFLAGS+= -DRUMP_USE_UNREAL_ALLOCATORS 124 SRCS+= subr_kmem.c subr_percpu.c subr_pool.c subr_vmem.c 125 126 # no shlib_version because this is automatically in sync with lib/librump 127 SHLIB_MAJOR= 0 128 SHLIB_MINOR= 0 129 130 CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs 131 CPPFLAGS+= -I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev 132 AFLAGS+= -D_LOCORE -Wa,-fatal-warnings 133 134 # 135 # If archdir exists, it is required to provide: 136 # 1) kobj_reloc() and kobj_machdep() 137 # 2) rump_cpu_bootstrap() 138 # 3) ...? 139 # 4) PROFIT! 140 # 141 142 # 143 # Check if we are building compat. In compat mode we need to provide 144 # the kernel of our compat target (amd64->i386 & sparc64->sparc), so 145 # take MD stuff from the right arch. 146 # 147 .ifdef MLIBDIR 148 ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR} 149 LIBKERN_ARCH= ${MLIBDIR} 150 .elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}) 151 ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU} 152 .else 153 ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH} 154 .endif 155 .if exists(${ARCHDIR}) 156 .include "${ARCHDIR}/Makefile.inc" 157 .PATH: ${ARCHDIR} 158 .else 159 SRCS+= kobj_stubs.c rumpcpu_generic.c 160 .endif 161 162 .if ${MACHINE} == "sun3" 163 CPPFLAGS+= -Dsun3 164 .endif 165 166 # include libkern source files 167 KERNDIR=${RUMPTOP}/../lib/libkern 168 .ifdef RUMPKMOD 169 KERNMISCCPPFLAGS+= -D_RUMPKERNEL 170 .endif 171 .include "${RUMPTOP}/../lib/libkern/Makefile.libkern" 172 173 # Some architectures require a little special massage with atomic 174 # compare-and-swap. This is because the kernel version is using 175 # instructions or routines unavailable to us in userspace. We 176 # use a very simple CAS routine which (correctly) assumes non-SMP 177 # and no preemption. If some of these archs later develop MP 178 # support, switch them to use atomic_cas_generic.c 179 # 180 .if ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "hppa" \ 181 || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \ 182 || ${MACHINE_CPU} == "vax" || ${MACHINE_ARCH} == "m68000" 183 CPPFLAGS+= -I${RUMPTOP}/../../common/lib/libc/atomic 184 .ifdef RUMP_SMP 185 SRCS+= atomic_cas_generic.c 186 .else 187 SRCS+= atomic_cas_up.c 188 .endif 189 .endif 190 191 .include <bsd.lib.mk> 192 .include <bsd.klinks.mk> 193