iPXE
Macros | Functions
realmode.h File Reference
#include <stdint.h>
#include <registers.h>
#include <ipxe/uaccess.h>

Go to the source code of this file.

Macros

#define put_real(var, dest_seg, dest_off)   copy_to_real ( (dest_seg), (dest_off), &(var), sizeof (var) )
 Write a single variable to base memory. More...
 
#define get_real(var, src_seg, src_off)   copy_from_real ( &(var), (src_seg), (src_off), sizeof (var) )
 Read a single variable from base memory. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static __always_inline userptr_t real_to_user (unsigned int segment, unsigned int offset)
 Convert segment:offset address to user buffer. More...
 
static __always_inline void copy_to_real (unsigned int dest_seg, unsigned int dest_off, void *src, size_t n)
 Copy data to base memory. More...
 
static __always_inline void copy_from_real (void *dest, unsigned int src_seg, unsigned int src_off, size_t n)
 Copy data to base memory. More...
 

Macro Definition Documentation

◆ put_real

#define put_real (   var,
  dest_seg,
  dest_off 
)    copy_to_real ( (dest_seg), (dest_off), &(var), sizeof (var) )

Write a single variable to base memory.

Parameters
varVariable to write
dest_segDestination segment
dest_offDestination offset

Definition at line 114 of file realmode.h.

◆ get_real

#define get_real (   var,
  src_seg,
  src_off 
)    copy_from_real ( &(var), (src_seg), (src_off), sizeof (var) )

Read a single variable from base memory.

Parameters
varVariable to read
src_segSource segment
src_offSource offset

Definition at line 124 of file realmode.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ real_to_user()

static __always_inline userptr_t real_to_user ( unsigned int  segment,
unsigned int  offset 
)
inlinestatic

Convert segment:offset address to user buffer.

Parameters
segmentReal-mode segment
offsetReal-mode offset
Return values
bufferUser buffer

Definition at line 75 of file realmode.h.

75  {
76  return ( phys_to_user ( ( segment << 4 ) + offset ) );
77 }
uint16_t segment
Code segment.
Definition: librm.h:252
userptr_t phys_to_user(unsigned long phys_addr)
Convert physical address to user pointer.
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259

References offset, phys_to_user(), and segment.

Referenced by bios_find_smbios2(), bios_find_smbios3(), bzimage_parse_header(), com32_prepare_bounce_buffer(), comboot_exec_loop(), comboot_prepare_segment(), copy_from_real(), copy_to_real(), copy_user_to_rm_stack(), int13_extended_rw(), int13_rw_sectors(), int22(), nbi_process_segments(), print_user_string(), pxe_api_call(), pxe_exec(), pxe_loader_call(), pxenv_file_cmdline(), pxenv_file_exec(), pxenv_file_open(), pxenv_file_read(), pxenv_get_cached_info(), pxenv_tftp_read(), pxenv_udp_read(), pxenv_udp_write(), remove_user_from_rm_stack(), rsdp_find_rsdt(), sdi_exec(), shuffle(), and vesafb_mode_list().

◆ copy_to_real()

static __always_inline void copy_to_real ( unsigned int  dest_seg,
unsigned int  dest_off,
void *  src,
size_t  n 
)
inlinestatic

Copy data to base memory.

Parameters
dest_segDestination segment
dest_offDestination offset
srcSource
lenLength

Definition at line 88 of file realmode.h.

89  {
90  copy_to_user ( real_to_user ( dest_seg, dest_off ), 0, src, n );
91 }
static void const void * src
Definition: crypto.h:244
static __always_inline void off_t dest_off
Definition: efi_uaccess.h:66
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
Definition: uaccess.h:324
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
Definition: realmode.h:75

References copy_to_user(), dest_off, real_to_user(), and src.

◆ copy_from_real()

static __always_inline void copy_from_real ( void *  dest,
unsigned int  src_seg,
unsigned int  src_off,
size_t  n 
)
inlinestatic

Copy data to base memory.

Parameters
destDestination
src_segSource segment
src_offSource offset
lenLength

Definition at line 102 of file realmode.h.

103  {
104  copy_from_user ( dest, real_to_user ( src_seg, src_off ), 0, n );
105 }
static __always_inline void off_t userptr_t off_t src_off
Definition: efi_uaccess.h:66
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
Definition: uaccess.h:337
static void * dest
Definition: strings.h:176
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
Definition: realmode.h:75

References copy_from_user(), dest, real_to_user(), and src_off.