Execute-In-Place
   HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includi ...
, execute in place (XIP) is a method of executing programs directly from long-term storage rather than copying it into
RAM Ram, ram, or RAM may refer to: Animals * A male sheep * Ram cichlid, a freshwater tropical fish People * Ram (given name) * Ram (surname) * Ram (director) (Ramsubramaniam), an Indian Tamil film director * RAM (musician) (born 1974), Dutch * ...
. It is an extension of using
shared memory In computer science, shared memory is memory that may be simultaneously accessed by multiple programs with an intent to provide communication among them or avoid redundant copies. Shared memory is an efficient means of passing data between progr ...
to reduce the total amount of memory required. Its general effect is that the program text consumes no writable memory, saving it for dynamic data, and that all instances of the program are run from a single copy. For this to work, several criteria have to be met: * The storage must provide a similar interface to the CPU as regular memory (or an adaptive layer must be present). * This interface must provide sufficiently fast read operations with a random access pattern. * The file system, if one is used, needs to expose appropriate mapping functions. * The program must either be linked to be aware of the address the storage appears at in the system or be position-independent. * The program must not modify data within the loaded image. The storage requirements are usually met by using NOR flash memory or EEPROM, which can be addressed as individual words for read operations, although it is a bit slower than normal system RAM in most setups.


XIP during boot load

Typically, the First Stage Boot Loader is an XIP program that is linked to run at the address at which the flash chip(s) are mapped at power-up and contains a minimal program to set up the system RAM (which depends on the components used on the individual boards and cannot be generalized enough so that the proper sequence could be embedded into the processor hardware) and then loads the second stage bootloader or the OS
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learn ...
into RAM. During this initialization, writable memory may not be available, so all computations have to be performed within the processor registers. For this reason, first stage boot loaders tend to be written in assembly language and only do the minimum to provide a normal execution environment for the next program. Some processors either embed a small amount of SRAM in the chip itself, or allow using the onboard cache memory as RAM, to make this first stage boot loader easier to write using high-level language. For a kernel or bootloader, address space generally is assigned internally, so in order to use XIP for them, it is sufficient to instruct the linker to place unmodifiable and modifiable data in different address ranges and provide a mechanism for the modifiable data to be copied to writable memory before any code is run that assumes that data can be accessed normally. This can be done as part of the previous stage, or within a small code segment at the beginning of the program. If address space is assigned externally, such as in an application program that is run on a system that does not provide
virtual memory In computing, virtual memory, or virtual storage is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a very ...
, the compiler needs to access all modifiable data by adding an offset to a pointer to a private copy of the data area. In this case, the external loader is responsible for setting up the instance specific memory areas. BIOS and
UEFI UEFI (Unified Extensible Firmware Interface) is a set of specifications written by the UEFI Forum. They define the architecture of the platform firmware used for booting and its interface for interaction with the operating system. Examples of ...
use XIP to initialize the main memory.


XIP as file system

XIP places requirements on file systems that are often difficult to meet. In systems without a
page table A page table is the data structure used by a virtual memory system in a computer operating system to store the mapping between virtual addresses and physical addresses. Virtual addresses are used by the program executed by the accessing proces ...
, the entire file must be stored within consecutive bytes and must not be fragmented, while flash based file systems often aim to distribute data into sectors of the flash chip that have the least erase cycles and even out the wear on the chip, prolonging its lifetime. All these complications and the speed tradeoff mean that XIP is generally only used for first stage bootloaders or when RAM is in extremely short supply. In particular, second through fourth generation video game consoles connect the ROM cartridge's address and data bus to that of the console, which lets (for example) the
Atari 2600 The Atari 2600, initially branded as the Atari Video Computer System (Atari VCS) from its release until November 1982, is a home video game console developed and produced by Atari, Inc. Released in September 1977, it popularized microprocesso ...
work with only the 128 bytes of RAM in its joystick interface IC. A relatively new file system for Linux, called AXFS (''Advanced XIP File System''), aims to overcome some of the shortcomings associated with XIP, especially in regard to the in-place execution of user-space applications. It makes for instance possible to split up an executable binary file into "XIP regions", thus avoiding the restriction of fragmentation that was mentioned above. A NetBSD implementation is also under development.


See also

*
Comparison of file systems The following tables compare general and technical information for a number of file systems. General information Limits Metadata Features File capabilities Block capabilities Note that in addition to the below table, blo ...
* ROM cartridge * Firmware * AXFS


References


External links

* * * * * * * * {{Firmware and booting Computer file systems Firmware