mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-09-03 20:21:27 +00:00
Move CPU emulation code to cpu.c
The kvm.c file is getting bigger so move CPU emulation code to a separate file. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
committed by
Will Deacon
parent
1f9cff2305
commit
b6e5a081c5
@@ -1,14 +1,17 @@
|
||||
PROGRAM = kvm
|
||||
|
||||
OBJS += kvm.o
|
||||
OBJS += cpu.o
|
||||
|
||||
CFLAGS += -Iinclude
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
$(PRORAM): $(OBJS)
|
||||
$(PROGRAM): $(OBJS)
|
||||
$(CC) $(OBJS) -o $@
|
||||
|
||||
$(OBJS):
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(PROGRAM)
|
||||
.PHONY: clean
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "kvm/cpu.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct cpu *cpu__new(void)
|
||||
{
|
||||
return calloc(1, sizeof(struct cpu));
|
||||
}
|
||||
|
||||
void cpu__reset(struct cpu *self)
|
||||
{
|
||||
self->regs.eip = 0x000fff0UL;
|
||||
self->regs.eflags = 0x0000002UL;
|
||||
}
|
||||
@@ -39,4 +39,7 @@ struct cpu {
|
||||
struct cpu_registers regs;
|
||||
};
|
||||
|
||||
struct cpu *cpu__new(void);
|
||||
void cpu__reset(struct cpu *self);
|
||||
|
||||
#endif /* KVM__CPU_H */
|
||||
|
||||
@@ -28,17 +28,6 @@ static void die(const char *s)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void cpu__reset(struct cpu *self)
|
||||
{
|
||||
self->regs.eip = 0x000fff0UL;
|
||||
self->regs.eflags = 0x0000002UL;
|
||||
}
|
||||
|
||||
static struct cpu *cpu__new(void)
|
||||
{
|
||||
return calloc(1, sizeof(struct cpu));
|
||||
}
|
||||
|
||||
static inline bool kvm__supports_extension(struct kvm *self, unsigned int extension)
|
||||
{
|
||||
int ret;
|
||||
|
||||
Reference in New Issue
Block a user