[英]building a system in Java and assembly language that runs on “bare metal”
Alright everyone, Let's say i wanted to make a system that used only assembly and java, my question would be, as long as i included all of the jvm folders, classes, jars, etc.. java should still function effectively? 好的,大家好,假设我想创建一个仅使用汇编语言和java的系统,我的问题是,只要我包括所有jvm文件夹,类,jar等。java仍应有效运行吗? i understand there are those things that are compiled platform specifically but this is why i am asking, is it possible, using assembly to replicate all of the .exe, or other executable files that java has included into a pure assembly/java system?
我知道有些东西是经过专门编译的平台,但是这就是为什么我要问的问题,有可能使用汇编将所有.exe或Java包含的其他可执行文件复制到纯汇编/ java系统中吗?
If you are asking whether it is possible to build a system in Java and assembly language that runs on "bare metal", the answer is yes. 如果您问是否可以用Java和汇编语言构建在“裸机”上运行的系统,答案是肯定的。 There are a couple of current examples:
当前有两个示例:
Be aware that building a system of this kind is a multi-year, multi-person project requiring deep understanding of virtual machine internals, compilers, garbage collectors, hardware architectures, device driver writing and so on. 请注意,构建这种系统是一个多年的,多人的项目,需要深入了解虚拟机内部,编译器,垃圾收集器,硬件体系结构,设备驱动程序编写等。
If you are asking about something else, please be more explicit. 如果您有其他疑问,请更加明确。
EDIT: responding to the OP's followup question: 编辑:回应OP的后续问题:
If I understand your question correctly, you mean something like JavaOS . 如果我正确理解您的问题,则表示类似JavaOS的意思。 Sure, its possible to implement the JVM raw on the hardware, not sure why you would, though.
当然,可以在硬件上实现JVM raw,但是不确定为什么要这样做。 And if you did, why you wouldn't use C instead of Assembly for most of the work.
而且,如果这样做了,为什么在大多数工作中不使用C而不是Assembly。
Its theoretically possible to implement the jvm in a whole other language. 从理论上说,可以用另一种语言实现jvm。 The best example I can think of is Python/Jpython where there is the original C implementation and a pure Java implementation of the language.
我能想到的最好的例子是Python / Jpython,其中有该语言的原始C实现和纯Java实现。
The main argumant against this is -- its a ton of work for not much benefit. 反对这一点的主要方法是-花费大量精力而不是很多工作。
The official Sun jvm and supporting jni libraries are written mostly in C, you would need to provide native assembler implementations for most of the C POSIX APIs at the very least. 官方的Sun jvm和支持的jni库主要是用C编写的,您至少需要为大多数C POSIX API提供本机汇编程序实现。
Also the original design goal of C was 'a portable assembly language' and to a large extent it still meets these goals. 同样,C的最初设计目标是“一种便携式汇编语言”,并且在很大程度上仍能满足这些目标。 C produces efficient machine code and most C compilers will let code machine instructions inline with the C code.
C生成高效的机器代码,大多数C编译器将使代码机器指令与C代码内联。
Another benefit of C is the number of cross compilers available, you dont need to run the development environment on tHe target architecture, you can deveop and unit test on your favourite paltform/IDE, when you are ready you can then export your executables to the target platform. C的另一个好处是可以使用交叉编译器的数量,您不需要在目标体系结构上运行开发环境,就可以在自己喜欢的paltform / IDE上进行开发和单元测试,当您准备好之后可以将可执行文件导出到目标平台。
Jikes RVM and Sun's Maxine provide a JVM implementation with little (of the order of 1 kloc) native code. Jikes RVM和Sun的Maxine提供了很少的(大约1 kloc)本机代码的JVM实现。 However, both VMs require an OS and are only research implementations.
但是,两个VM都需要一个OS,并且仅是研究实现。 The process of creating a stream of octets that form machine code, is obviously achievable in Java.
在Java中显然可以实现创建形成机器代码的八位字节流的过程。
Have a look at JNode. 看看JNode。 They have been working on this for years.
他们已经为此工作了多年。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.