1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#
# Makefile
#
# Leendert van Doorn, leendert@watson.ibm.com
# Copyright (c) 2005, International Business Machines Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place - Suite 330, Boston, MA 02111-1307 USA.
#
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/Rules.mk
# The emulator code lives in ROM space
TEXTADDR=0x000D0000
DEFINES=-DDEBUG -DTEXTADDR=${TEXTADDR}
XENINC=-I$(XEN_ROOT)/xen/include
#DEFINES=-DDEBUG -DTEST -DTEXTADDR=${TEXTADDR}
#XENINC=-I/home/leendert/xen/xeno-unstable.bk/xen/include
LD=ld
CC=gcc
CPP=cpp -P
OBJCOPY=objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0
CFLAGS=${DEFINES} -I. $(XENINC) -Wall -fno-builtin -O2 -msoft-float
ifeq ($(XEN_COMPILE_ARCH),x86_64)
CFLAGS += -m32 -march=i686
LDFLAGS += -m elf_i386
endif
OBJECTS = head.o trap.o vm86.o setup.o util.o
all: vmxloader
vmxloader: roms.h vmxloader.c
${CC} ${CFLAGS} ${DEFINES} -c vmxloader.c
$(CC) -o vmxloader.tmp -m32 -nostdlib -Wl,-N -Wl,-Ttext -Wl,0x100000 vmxloader.o
objcopy --change-addresses=0xC0000000 vmxloader.tmp vmxloader
rm -f vmxloader.tmp
vmxassist.bin: vmxassist.ld ${OBJECTS}
${CPP} ${DEFINES} vmxassist.ld > vmxassist.tmp
${LD} -o vmxassist ${LDFLAGS} -nostdlib --fatal-warnings -N -T vmxassist.tmp ${OBJECTS}
nm -n vmxassist > vmxassist.sym
${OBJCOPY} vmxassist vmxassist.tmp
dd if=vmxassist.tmp of=vmxassist.bin ibs=512 conv=sync
rm -f vmxassist.tmp
head.o: machine.h head.S
${CC} ${CFLAGS} -D__ASSEMBLY__ ${DEFINES} -c head.S
trap.o: machine.h offsets.h trap.S
${CC} ${CFLAGS} -D__ASSEMBLY__ ${DEFINES} -c trap.S
vm86.o: machine.h vm86.c
${CC} ${CFLAGS} -c vm86.c
setup.o: machine.h setup.c
${CC} ${CFLAGS} -c setup.c
util.o: machine.h util.c
${CC} ${CFLAGS} -c util.c
roms.h: ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin ../vgabios/VGABIOS-lgpl-latest.cirrus.bin vmxassist.bin
./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin >> roms.h
./mkhex vmxassist vmxassist.bin >> roms.h
offsets.h: gen
./gen > offsets.h
gen: gen.c
${CC} ${CFLAGS} -o gen gen.c
clean:
rm -f vmxassist vmxassist.tmp vmxassist.bin vmxassist.run vmxassist.sym head.s roms.h
rm -f vmxloader vmxloader.tmp vmxloader.o ${OBJECTS}
rm -f gen gen.o offsets.h
|