[OT?] Can linux be compiled/used as a library?
From: venetis
Date: Wed Jul 30 2008 - 13:30:58 EST
Hello everyone,
I assume that the first thing that comes to ones mind is "Why would
someone like to use an OS kernel as a library?". So let me explain my
situation.
I am using a simulator which runs on a x86 Linux system, which simulates
an Alpha processor. I have a cross-compiler for it to compile my programs.
There is, however, a disadvantage currently. System calls are not fully
simulated. How it works is as follows. The program sets up all required
simulated registers and executes the specific instruction that initiates
the system call. At this point the simulator takes over and uses the
necessary values from the simulated registers to execute the system call
NATIVELY, i.e., on the x86 Linux system. Finally, it writes the resulting
values returned from the system call back to the simulated registers and
execution continues. (Of course, some more book-keeping is required, but
this is the basic mechanism.)
Although this works, the problem is that system calls are not timed in the
simulator (execution time is thought of as zero). I have quite a few
programs where system call execution time is a considerable percentage of
the total execution time, which means that the reported execution time is
far from the "real" time required.
My thought was to completely remove the current system call simulation and
instead link the simulator with a real kernel (linux), which has been
compiled as a library for the simulated processor. This way, even system
calls would be timed and the reported time would be a much closer
estimation of the real time.
Any pointers and/or thoughts on this are appreciated.
Ioannis E. Venetis
P.S: Please CC any answers to me, as I am not subscribed to the list.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/