mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 08:06:32 +00:00
1
user/apps/test_kvm/.gitignore
vendored
Normal file
1
user/apps/test_kvm/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
test_kvm
|
@ -1,9 +1,20 @@
|
||||
OLD_LIBC_INSTALL_PATH=$(ROOT_PATH)/bin/sysroot/usr/old_libc
|
||||
ifeq ($(ARCH), x86_64)
|
||||
CROSS_COMPILE=x86_64-linux-musl-
|
||||
else ifeq ($(ARCH), riscv64)
|
||||
CROSS_COMPILE=riscv64-linux-musl-
|
||||
endif
|
||||
|
||||
all: main.o
|
||||
CC=$(CROSS_COMPILE)gcc
|
||||
|
||||
$(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/test_kvm $(shell find . -name "*.o") $(OLD_LIBC_INSTALL_PATH)/lib/libc.a -T link.lds
|
||||
.PHONY: all
|
||||
all: main.c
|
||||
$(CC) -static -o test_kvm main.c
|
||||
|
||||
$(OBJCOPY) -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/test_kvm $(output_dir)/test_kvm.elf
|
||||
main.o: main.c
|
||||
$(CC) $(CFLAGS) -c main.c -o main.o
|
||||
.PHONY: install clean
|
||||
install: all
|
||||
mv test_kvm $(DADK_CURRENT_BUILD_DIR)/test_kvm
|
||||
|
||||
clean:
|
||||
rm test_kvm *.o
|
||||
|
||||
fmt:
|
||||
|
@ -1,3 +0,0 @@
|
||||
boot.bin: boot.s
|
||||
nasm boot.s -o boot.bin
|
||||
xxd boot.bin > boot.hex
|
Binary file not shown.
@ -1,32 +0,0 @@
|
||||
00000000: 8cc8 8ed8 8ec0 e802 00eb feb8 1e00 89c5 ................
|
||||
00000010: b910 00b8 0113 bb0c 00b2 00cd 10c3 4865 ..............He
|
||||
00000020: 6c6c 6f2c 204f 5320 776f 726c 6421 0000 llo, OS world!..
|
||||
00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000100: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000110: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000120: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000130: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000140: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000150: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000160: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000170: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000180: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000190: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000001a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000001b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000001c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000001d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000001e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000001f0: 0000 0000 0000 0000 0000 0000 0000 55aa ..............U.
|
@ -1,54 +0,0 @@
|
||||
|
||||
OUTPUT_FORMAT("elf64-x86-64","elf64-x86-64","elf64-x86-64")
|
||||
OUTPUT_ARCH(i386:x86-64)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
. = 0x800000;
|
||||
|
||||
|
||||
.text :
|
||||
{
|
||||
_text = .;
|
||||
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
|
||||
_etext = .;
|
||||
}
|
||||
. = ALIGN(8);
|
||||
|
||||
.data :
|
||||
{
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
|
||||
_edata = .;
|
||||
}
|
||||
|
||||
|
||||
rodata_start_pa = .;
|
||||
.rodata :
|
||||
{
|
||||
_rodata = .;
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
_erodata = .;
|
||||
}
|
||||
|
||||
|
||||
.bss :
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
_ebss = .;
|
||||
}
|
||||
|
||||
_end = .;
|
||||
|
||||
|
||||
}
|
@ -14,10 +14,11 @@
|
||||
* 1.在DragonOS的控制台输入 exec bin/test_kvm.elf
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define KVM_CREATE_VCPU 0x00
|
||||
#define KVM_SET_USER_MEMORY_REGION 0x01
|
||||
|
Reference in New Issue
Block a user