Xen上的miniOS
来源:互联网 发布:拉杆箱 知乎 编辑:程序博客网 时间:2024/05/05 16:41
原文:
http://qyrekcah.spaces.live.com/blog/cns!D691A70904EDECB0!228.entry?wa=wsignin1.0&sa=674975121
在Xen上可以运行的最小OS,该miniOS直接用汇编程序编写,实现了Xen的hypercall的调用。下面是它的实现代码:
# helloworld.s
.section __xen_guest
.ascii "GUEST_OS=MyOS"
.ascii ",XEN_VER=xen-3.0"
.ascii ",HYPERCALL_PAGE=0x2"
.ascii ",LOADER=generic"
.ascii ",PT_MODE_WRITABLE"
.byte 0
.text # text section为可执行的程序代码(executable program code)
.globl _start # Guest OS的入口为_start
_start:
cld #cld(Clear Decimal Flag) 设置ALU为二进制模式
#设置hypercall 参数
movl $18, %eax # __Hypervisor_console_io
movl $0, %ebx # CONSOLEIO_write
movl $hello_message_len, %ecx # buffer length
movl $hello_message, %edx # buffer virtual address
int $0x82 #使用int $0x82执行hypercall
.ascii "GUEST_OS=MyOS"
.ascii ",XEN_VER=xen-3.0"
.ascii ",HYPERCALL_PAGE=0x2"
.ascii ",LOADER=generic"
.ascii ",PT_MODE_WRITABLE"
.byte 0
.text # text section为可执行的程序代码(executable program code)
.globl _start # Guest OS的入口为_start
_start:
cld #cld(Clear Decimal Flag) 设置ALU为二进制模式
#设置hypercall 参数
movl $18, %eax # __Hypervisor_console_io
movl $0, %ebx # CONSOLEIO_write
movl $hello_message_len, %ecx # buffer length
movl $hello_message, %edx # buffer virtual address
int $0x82 #使用int $0x82执行hypercall
#调用关机和关闭电源hypercall
movl $6, %eax # __Hypervisor_sched_op_compat
movl $2, %ebx # SCHEDOP_shutdown
movl $0, %ecx # SHUTDOWN_poweroff
int $0x82
hang:
jmp hang # shouldn't get here
.data # 数据段(data section)
hello_message: .ascii "This is the hello world program./n"
hello_message_len = . -hello_message #hello消息的长度,.表示当前offset
movl $6, %eax # __Hypervisor_sched_op_compat
movl $2, %ebx # SCHEDOP_shutdown
movl $0, %ecx # SHUTDOWN_poweroff
int $0x82
hang:
jmp hang # shouldn't get here
.data # 数据段(data section)
hello_message: .ascii "This is the hello world program./n"
hello_message_len = . -hello_message #hello消息的长度,.表示当前offset
编译时使用的Makefile为
helloworld: helloworld.s
as -o helloworld.o -a=helloworld.l helloworld.s
ld -Ttext 0x100000 -o helloworld.elf helloworld.o
as -o helloworld.o -a=helloworld.l helloworld.s
ld -Ttext 0x100000 -o helloworld.elf helloworld.o
该虚拟机的配置文件为
kernel = "helloworld.elf"
memory = 32
name = "HelloWorld"
on_crash = 'destroy' #当domain crash时指定guest的行动(behaviour)
- Xen上的miniOS
- xen-4.1.2 编译minios
- xen上的vlan配置
- 小型多任务操作系统miniOS的实现
- xen在debain上的安装
- Xen平台上的安全威胁总结
- ubuntu11.10上xen的安装
- 2014-12-1 xen上的vuart
- Fedora20上Xen的安装与部署
- 【XEN学习笔记】XEN-3.4.2在Ubuntu 8.04上的编译安装
- Ubuntu上安装Xen
- xen上安装虚拟机:
- suse enterprise 10 上的XEN 很VM的感觉
- Linux上的虚拟化技术 Xen 初学者指南
- debian 6.0 squeeze 上的 xen 网桥问题
- 在ubuntu上配置openstack的xen环境
- 君正4750开发板使用日记6-uCOS(minios)的开发配置试验
- Fedora8上Xen源码安装
- 技术总监谈好的程序员如何写代码 另附:招聘程序员应考察的
- GFDL中文版
- java通过缓冲区提高I/O性能
- GPL中文版
- 动态符号链接的细节
- Xen上的miniOS
- MMAPI workarounds in different mobile devices : part 1
- 浅谈.NET下的多线程和并行计算(一)前言 (转)
- Basic Planning Steps
- javascript 技巧
- MMAPI workarounds in different mobile devices: part 2
- how to setup mysql
- vim 的使用方法
- CentOS开启samba服务(附smb.conf手册)