# 2) Generate kvm-asm-offsets.h
#

# offsets-file := ../../../../include/generated/kvm-asm-offsets.h

# always  += $(offsets-file)
# targets += $(offsets-file)
# targets += arch/$(SRCARCH)/kvm/guest/kvm-asm-offsets.s

# Custom string to workaround LCC limitations
define sed-y
  "/@@@/x; s:^->::p; /\.uadword/{s:.*\.uadword[^0-f]*\([x0-f]*\).*:\1:;x;G;s:->\([^ ]*\) @@@ \(.*\)\n\([^ ]*\):#define \1 \3 /* \2 */:p;}"
endef

quiet_cmd_kvm_asm_offsets = GEN     $@
define cmd_kvm_asm_offsets
	(set -e; \
	 echo "#ifndef __KVM_ASM_OFFSETS_H__"; \
	 echo "#define __KVM_ASM_OFFSETS_H__"; \
	 echo "/*"; \
	 echo " * DO NOT MODIFY."; \
	 echo " *"; \
	 echo " * This file was generated by Kbuild"; \
	 echo " *"; \
	 echo " */"; \
	 echo ""; \
	 sed -ne $(sed-y) $<; \
	 echo ""; \
	 echo "#endif" ) > $@
endef

# patched CPU registers access now is not used, but can be need in future
# We use internal kbuild rules to avoid the "is up to date" message from make
#arch/$(SRCARCH)/kvm/guest/kvm-asm-offsets.s: \
#			arch/$(SRCARCH)/kvm/guest/kvm-asm-offsets.c
#	$(Q)mkdir -p $(dir $@)
#	$(call if_changed_dep,cc_s_c)

# patched CPU registers access now is not used, but can be need in future
#include/generated/kvm-asm-offsets.h: \
#			arch/$(SRCARCH)/kvm/guest/kvm-asm-offsets.s
#	$(Q)mkdir -p $(dir $@)
#	$(call cmd,kvm_asm_offsets)

#$(obj)/$(offsets-file): arch/$(SRCARCH)/kvm/guest/kvm-asm-offsets.s
#	$(call cmd,kvm_asm_offsets)

# patched CPU registers access now is not used, but can be need in future
#FORCE : include/generated/kvm-asm-offsets.h

CFLAGS_ttable.o += -Wframe-larger-than=4096
CFLAGS_irq.o += -Wframe-larger-than=8192

obj-$(CONFIG_KVM_GUEST_MODE) += ttable.o traps.o fast_syscalls.o boot.o \
				process.o mmu.o mman.o ioremap.o \
				e2k_virt.o time.o io.o string.o \
				spinlock.o host_printk.o irq.o lapic.o

CFLAGS_smp.o += -Wframe-larger-than=4096
obj-$(CONFIG_KVM_GUEST_SMP) += smp.o

obj-$(CONFIG_PARAVIRT_GUEST) += paravirt.o

# patched CPU registers access now is not used, but can be need in future
#obj-$(CONFIG_PARAVIRT_GUEST) += patched_cpu_regs_access.o

