Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 96 lines (84 sloc) 5.043 kb
53bf454 @joshwilsdon Inital version based on the 'dummy' driver in the 'Device Driver Tuto…
joshwilsdon authored
1 #
2 # Copyright (c) 2010 Joyent Inc., All Rights Reserved.
3 #
4
00233f5 Creates and initializes VM and vcpu
max authored
5 # Use the gcc compiler and Sun linker.
35bceb6 @joshwilsdon [HVM-2] Work to make this buildable in the general case.
joshwilsdon authored
6 KERNEL_SOURCE=$(PWD)/../../illumos
00233f5 Creates and initializes VM and vcpu
max authored
7 CC=gcc -m64 -mcmodel=kernel
53bf454 @joshwilsdon Inital version based on the 'dummy' driver in the 'Device Driver Tuto…
joshwilsdon authored
8 LD=/usr/bin/ld
04c526f @rmustacc HVM-397 ctfconvert should be run out of the proto area
rmustacc authored
9 CTFBINDIR=$(KERNEL_SOURCE)/usr/src/tools/proto/*/opt/onbld/bin/i386
10 CTFCONVERT=$(CTFBINDIR)/ctfconvert
11 CTFMERGE=$(CTFBINDIR)/ctfmerge
35bceb6 @joshwilsdon [HVM-2] Work to make this buildable in the general case.
joshwilsdon authored
12 DESTDIR=
293086b @rmustacc HVM-366 Don't lie about requiring GNU C
rmustacc authored
13 CFLAGS += -D_KERNEL -D_MACHDEP -Dx86 -DDEBUG -c -g -DCONFIG_SOLARIS -O2 -fident -fno-inline -fno-inline-functions -fno-builtin -fno-asm -nodefaultlibs -D__sun -O -D_ASM_INLINES -ffreestanding -Wall -Wno-unknown-pragmas -Wpointer-arith -Wno-unused -gdwarf-2 -std=gnu99 -fno-dwarf2-indirect-strings -Werror -DDIS_MEM -D_KERNEL -ffreestanding -D_SYSCALL32 -D_DDI_STRICT -Di86pc -D_MACHDEP -DOPTERON_ERRATUM_88 -DOPTERON_ERRATUM_91 -DOPTERON_ERRATUM_93 -DOPTERON_ERRATUM_95 -DOPTERON_ERRATUM_99 -DOPTERON_ERRATUM_100 -DOPTERON_ERRATUM_101 -DOPTERON_ERRATUM_108 -DOPTERON_ERRATUM_109 -DOPTERON_ERRATUM_121 -DOPTERON_ERRATUM_122 -DOPTERON_ERRATUM_123 -DOPTERON_ERRATUM_131 -DOPTERON_WORKAROUND_6336786 -DOPTERON_WORKAROUND_6323525 -DOPTERON_ERRATUM_172 -DOPTERON_ERRATUM_298 -I$(KERNEL_SOURCE)/usr/src/uts/common -nostdinc -c -DUTS_RELEASE="5.11" -DUTS_VERSION="joyent.147" -DUTS_PLATFORM="i86pc" -mno-red-zone
53bf454 @joshwilsdon Inital version based on the 'dummy' driver in the 'Device Driver Tuto…
joshwilsdon authored
14
aaf4078 Lots of new code, and lots of code turned on. Doesn't compile...
max authored
15 INCLUDEDIR= -I $(KERNEL_SOURCE)/usr/src/uts/intel -I $(KERNEL_SOURCE)/usr/src/uts/i86pc -I $(KERNEL_SOURCE)/usr/src/uts/common
99a4ea3 @bcantrill HVM-43 add ::kvm_gpa2qva to translate guest physical to QEMU virtual
bcantrill authored
16 CSTYLE=$(KERNEL_SOURCE)/usr/src/tools/scripts/cstyle
aaf4078 Lots of new code, and lots of code turned on. Doesn't compile...
max authored
17
99a4ea3 @bcantrill HVM-43 add ::kvm_gpa2qva to translate guest physical to QEMU virtual
bcantrill authored
18 all: kvm kvm.so
19
a1319aa @rmustacc HVM-427 kvm_emulate.h should be cstyle-clean
rmustacc authored
20 HEADERS= \
21 kvm.h \
22 kvm_bitops.h \
23 kvm_cache_regs.h \
24 kvm_coalesced_mmio.h \
25 kvm_cpuid.h \
26 kvm_emulate.h \
e1e6bcb @rmustacc HVM-428 kvm_host.h should be cstyle clean
rmustacc authored
27 kvm_host.h \
df5d185 @rmustacc HVM-433 kvm_i8254.h should be c-style clean
rmustacc authored
28 kvm_i8254.h \
fbab7df @rmustacc HVM-433 kvm_i8254.h should be c-style clean
rmustacc authored
29 kvm_impl.h \
6ece5a4 @rmustacc HVM-421 kvm_x86.h should be cstyle clean
rmustacc authored
30 kvm_x86.h
4de52af @bcantrill HVM-322 kvm.h should be cstyle-clean
bcantrill authored
31
fbab7df @rmustacc HVM-433 kvm_i8254.h should be c-style clean
rmustacc authored
32 kvm: kvm.c kvm_x86.c kvm_emulate.c kvm.h kvm_x86host.h msr.h kvm_bitops.h kvm_irq.c kvm_i8254.c kvm_lapic.c kvm_mmu.c kvm_iodev.c kvm_ioapic.c kvm_vmx.c kvm_i8259.c kvm_coalesced_mmio.c kvm_irq_comm.c kvm_cache_regs.c kvm_bitops.c $(HEADERS)
ebb1b1a Pre-alpha version. Driver loads and attaches.
max authored
33 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm.c
34 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_x86.c
98bf1f0 @rmustacc HVM-143 kvm C files should all have the kvm_ prefix on them
rmustacc authored
35 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_emulate.c
36 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_irq.c
37 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_i8254.c
38 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_lapic.c
52cddb5 @rmustacc HVM-137 Need to be able to unload kvm driver and load a new one and u…
rmustacc authored
39 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_mmu.c
38a8ccf @rmustacc HVM-153 iodev.h should be a header file
rmustacc authored
40 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_iodev.c
2388059 @rmustacc HVM-260 Separate out ioapic code into separate file
rmustacc authored
41 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_ioapic.c
6db183d @rmustacc HVM-264 vmx code should live in its own file
rmustacc authored
42 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_vmx.c
2fe433c @rmustacc HVM-273 pic code should reside in kvm_i8259.c
rmustacc authored
43 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_i8259.c
ef66b35 @rmustacc HVM-275 coalesced mmio code should be in separate file
rmustacc authored
44 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_coalesced_mmio.c
f22c1e1 @rmustacc HVM-276 Common irq code should be in irq_comm.c
rmustacc authored
45 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_irq_comm.c
0e20210 @rmustacc HVM-286 Move code into kvm_cache_regs.[ch]
rmustacc authored
46 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_cache_regs.c
77ec8d5 @rmustacc HVM-296 bitops.h shouldn't have code in it
rmustacc authored
47 $(CC) $(CFLAGS) $(INCLUDEDIR) kvm_bitops.c
00233f5 Creates and initializes VM and vcpu
max authored
48 $(CTFCONVERT) -i -L VERSION kvm.o
49 $(CTFCONVERT) -i -L VERSION kvm_x86.o
98bf1f0 @rmustacc HVM-143 kvm C files should all have the kvm_ prefix on them
rmustacc authored
50 $(CTFCONVERT) -i -L VERSION kvm_emulate.o
51 $(CTFCONVERT) -i -L VERSION kvm_irq.o
52 $(CTFCONVERT) -i -L VERSION kvm_i8254.o
53 $(CTFCONVERT) -i -L VERSION kvm_lapic.o
52cddb5 @rmustacc HVM-137 Need to be able to unload kvm driver and load a new one and u…
rmustacc authored
54 $(CTFCONVERT) -i -L VERSION kvm_mmu.o
38a8ccf @rmustacc HVM-153 iodev.h should be a header file
rmustacc authored
55 $(CTFCONVERT) -i -L VERSION kvm_iodev.o
2388059 @rmustacc HVM-260 Separate out ioapic code into separate file
rmustacc authored
56 $(CTFCONVERT) -i -L VERSION kvm_ioapic.o
6db183d @rmustacc HVM-264 vmx code should live in its own file
rmustacc authored
57 $(CTFCONVERT) -i -L VERSION kvm_vmx.o
2fe433c @rmustacc HVM-273 pic code should reside in kvm_i8259.c
rmustacc authored
58 $(CTFCONVERT) -i -L VERSION kvm_i8259.o
f22c1e1 @rmustacc HVM-276 Common irq code should be in irq_comm.c
rmustacc authored
59 $(CTFCONVERT) -i -L VERSION kvm_coalesced_mmio.o
60 $(CTFCONVERT) -i -L VERSION kvm_irq_comm.o
0e20210 @rmustacc HVM-286 Move code into kvm_cache_regs.[ch]
rmustacc authored
61 $(CTFCONVERT) -i -L VERSION kvm_cache_regs.o
77ec8d5 @rmustacc HVM-296 bitops.h shouldn't have code in it
rmustacc authored
62 $(CTFCONVERT) -i -L VERSION kvm_bitops.o
27b148d @rmustacc HVM-335 kvm_subr.c has reached the end of the line
rmustacc authored
63 $(LD) -r -o kvm kvm.o kvm_x86.o kvm_emulate.o kvm_irq.o kvm_i8254.o kvm_lapic.o kvm_mmu.o kvm_iodev.o kvm_ioapic.o kvm_vmx.o kvm_i8259.o kvm_coalesced_mmio.o kvm_irq_comm.o kvm_cache_regs.o kvm_bitops.o
64 $(CTFMERGE) -L VERSION -o kvm kvm.o kvm_x86.o kvm_emulate.o kvm_irq.o kvm_i8254.o kvm_lapic.o kvm_mmu.o kvm_iodev.o kvm_ioapic.o kvm_vmx.o kvm_i8259.o kvm_coalesced_mmio.o kvm_irq_comm.o kvm_cache_regs.o kvm_bitops.o
99a4ea3 @bcantrill HVM-43 add ::kvm_gpa2qva to translate guest physical to QEMU virtual
bcantrill authored
65
66 kvm.so: kvm_mdb.c
67 gcc -m64 -shared \
68 -fPIC $(CFLAGS) $(INCLUDEDIR) -I/usr/include -o $@ kvm_mdb.c
53bf454 @joshwilsdon Inital version based on the 'dummy' driver in the 'Device Driver Tuto…
joshwilsdon authored
69
70 install: kvm
71 @echo "==> Installing kvm module"
72 @pfexec cp kvm /tmp
73 @pfexec ln -sf /tmp/kvm /usr/kernel/drv/amd64/kvm
74 @pfexec cp kvm.conf /usr/kernel/drv
75
0ec69c2 @bcantrill #else clauses of XXX's should have DTrace SDT probes
bcantrill authored
76 check:
27b148d @rmustacc HVM-335 kvm_subr.c has reached the end of the line
rmustacc authored
77 @$(CSTYLE) kvm.c kvm_mdb.c kvm_emulate.c kvm_x86.c kvm_irq.c kvm_lapic.c kvm_i8254.c kvm_mmu.c kvm_iodev.c kvm_ioapic.c kvm_vmx.c kvm_i8259.c kvm_coalesced_mmio.c kvm_irq_comm.c kvm_cache_regs.c kvm_bitops.c $(HEADERS)
77ec8d5 @rmustacc HVM-296 bitops.h shouldn't have code in it
rmustacc authored
78 @./tools/xxxcheck kvm_x86.c kvm.c kvm_irq.c kvm_lapic.c kvm_i8254.c kvm_mmu.c kvm_iodev.c kvm_ioapic.c kvm_vmx.c kvm_i8259.c kvm_coalesced_mmio.c kvm_irq_comm.c kvm_cache_regs.c kvm_bitops.c
0ec69c2 @bcantrill #else clauses of XXX's should have DTrace SDT probes
bcantrill authored
79
53bf454 @joshwilsdon Inital version based on the 'dummy' driver in the 'Device Driver Tuto…
joshwilsdon authored
80 load: install
81 @echo "==> Loading kvm module"
82 @pfexec rem_drv kvm || /bin/true
83 @pfexec add_drv -v -i 'kvm' -m '* 0660 root sys' -c kvm kvm
84 @grep "^type=ddi_pseudo;name=kvm" /etc/devlink.tab >/dev/null \
85 || printf "type=ddi_pseudo;name=kvm\t\\D\n" | pfexec tee -a /etc/devlink.tab >/dev/null
86 @pfexec devfsadm -v -u
87
88 clean:
f0c9797 @rmustacc HVM-54 makefile clean target doesn't work
rmustacc authored
89 @pfexec rm -f *.o kvm
53bf454 @joshwilsdon Inital version based on the 'dummy' driver in the 'Device Driver Tuto…
joshwilsdon authored
90
91 uninstall:
92 @pfexec rem_drv kvm || /bin/true
f0c9797 @rmustacc HVM-54 makefile clean target doesn't work
rmustacc authored
93 @pfexec rm -f /usr/kernel/drv/kvm* /usr/kernel/drv/amd64/kvm*
00233f5 Creates and initializes VM and vcpu
max authored
94 # gcc -m64 -mcmodel=kernel -D_KERNEL -D_MACHDEP -Dx86 -DCONFIG_X86_64 -DDEBUG -c -O -g -I /wd320/max/onnv.121/usr/src/uts/intel -I /wd320/max/onnv.121/usr/src/uts/i86pc kvm.c
95 # gcc -m64 -mcmodel=kernel -D_KERNEL -D_MACHDEP -Dx86 -DCONFIG_X86_64 -DDEBUG -c -O -g -I /wd320/max/onnv.121/usr/src/uts/intel -I /wd320/max/onnv.121/usr/src/uts/i86pc kvm_x86.c
Something went wrong with that request. Please try again.