libkir.h File Reference

#include "realmode.h"

Go to the source code of this file.

Defines

#define __data16(variable)   variable
#define __data16_array(variable, array)   variable array
#define __bss16(variable)   variable
#define __bss16_array(variable, array)   variable array
#define __text16(variable)   variable
#define __text16_array(variable, array)   variable array
#define __use_data16(variable)   variable
#define __use_text16(variable)   variable
#define __from_data16(pointer)   pointer
#define __from_text16(pointer)   pointer
#define rm_cs   ( _rm_cs() )
#define rm_ds   ( _rm_ds() )
#define copy_to_real   copy_to_real_libkir
#define copy_from_real   copy_from_real_libkir
#define put_real_kir_const_off(var, seg, off)
#define put_real_kir_nonconst_off(var, seg, off)
#define put_real_kir(var, seg, off)
#define get_real_kir_const_off(var, seg, off)
#define get_real_kir_nonconst_off(var, seg, off)
#define get_real_kir(var, seg, off)
#define put_real   put_real_kir
#define get_real   get_real_kir
#define TEXT16_CODE(asm_code_str)
#define REAL_CODE(asm_code_str)

Typedefs

typedef uint32_t userptr_t
 A pointer to a user buffer.

Functions

static __attribute__ ((always_inline)) void copy_to_user(userptr_t buffer
 Copy data to user buffer.
static void copy_to_real_libkir (unsigned int dest_seg, unsigned int dest_off, const void *src, size_t n)
static void copy_from_real_libkir (void *dest, unsigned int src_seg, unsigned int src_off, size_t n)

Variables

static off_t offset
static off_t const void * src


Define Documentation

#define __data16 ( variable   )     variable

Definition at line 14 of file libkir.h.

#define __data16_array ( variable,
array   )     variable array

Definition at line 15 of file libkir.h.

#define __bss16 ( variable   )     variable

Definition at line 16 of file libkir.h.

#define __bss16_array ( variable,
array   )     variable array

Definition at line 17 of file libkir.h.

#define __text16 ( variable   )     variable

Definition at line 18 of file libkir.h.

#define __text16_array ( variable,
array   )     variable array

Definition at line 19 of file libkir.h.

#define __use_data16 ( variable   )     variable

Definition at line 20 of file libkir.h.

#define __use_text16 ( variable   )     variable

Definition at line 21 of file libkir.h.

#define __from_data16 ( pointer   )     pointer

#define __from_text16 ( pointer   )     pointer

Definition at line 23 of file libkir.h.

Referenced by int22(), pxe_start_nbp(), and undi_loader().

#define rm_cs   ( _rm_cs() )

#define rm_ds   ( _rm_ds() )

#define copy_to_real   copy_to_real_libkir

#define copy_from_real   copy_from_real_libkir

#define put_real_kir_const_off ( var,
seg,
off   ) 

Value:

__asm__ ( "movw %w1, %%es\n\t"                                       \
                  "mov %0, %%es:%c2\n\t"                                     \
                  "pushw %%ds\n\t" /* restore %es */                         \
                  "popw %%es\n\t"                                            \
                  :                                                          \
                  : "r,r" ( var ), "rm,rm" ( seg ), "i,!r" ( off )           \
                  )

Definition at line 98 of file libkir.h.

#define put_real_kir_nonconst_off ( var,
seg,
off   ) 

Value:

__asm__ ( "movw %w1, %%es\n\t"                                       \
                  "mov %0, %%es:(%2)\n\t"                                    \
                  "pushw %%ds\n\t" /* restore %es */                         \
                  "popw %%es\n\t"                                            \
                  :                                                          \
                  : "r" ( var ), "rm" ( seg ), "r" ( off )                   \
                  )

Definition at line 107 of file libkir.h.

#define put_real_kir ( var,
seg,
off   ) 

Value:

do {                                                                 \
          if ( __builtin_constant_p ( off ) )                                \
                  put_real_kir_const_off ( var, seg, off );                  \
          else                                                               \
                  put_real_kir_nonconst_off ( var, seg, off );               \
        } while ( 0 )

Definition at line 116 of file libkir.h.

#define get_real_kir_const_off ( var,
seg,
off   ) 

Value:

__asm__ ( "movw %w1, %%es\n\t"                                       \
                  "mov %%es:%c2, %0\n\t"                                     \
                  "pushw %%ds\n\t" /* restore %es */                         \
                  "popw %%es\n\t"                                            \
                  : "=r,r" ( var )                                           \
                  : "rm,rm" ( seg ), "i,!r" ( off )                          \
                  )

Definition at line 124 of file libkir.h.

#define get_real_kir_nonconst_off ( var,
seg,
off   ) 

Value:

__asm__ ( "movw %w1, %%es\n\t"                                       \
                  "mov %%es:(%2), %0\n\t"                                    \
                  "pushw %%ds\n\t" /* restore %es */                         \
                  "popw %%es\n\t"                                            \
                  : "=r" ( var )                                             \
                  : "rm" ( seg ), "r" ( off )                                \
                  )

Definition at line 133 of file libkir.h.

#define get_real_kir ( var,
seg,
off   ) 

Value:

do {                                                                 \
          if ( __builtin_constant_p ( off ) )                                \
                  get_real_kir_const_off ( var, seg, off );                  \
          else                                                               \
                  get_real_kir_nonconst_off ( var, seg, off );               \
        } while ( 0 )

Definition at line 142 of file libkir.h.

#define put_real   put_real_kir

Definition at line 150 of file libkir.h.

Referenced by bios_currticks(), int13_set_num_drives(), set_fbms(), and undi_unload().

#define get_real   get_real_kir

#define TEXT16_CODE ( asm_code_str   ) 

Value:

".section \".text16\", \"ax\", @progbits\n\t"   \
        ".code16\n\t"                                   \
        ".arch i386\n\t"                                \
        asm_code_str "\n\t"                             \
        ".code16gcc\n\t"                                \
        ".previous\n\t"

Referenced by _dump_regs(), fake_e820(), hook_comboot_interrupts(), and hook_int13().

#define REAL_CODE ( asm_code_str   ) 


Typedef Documentation

A pointer to a user buffer.

This is actually a struct segoff, but encoded as a uint32_t to ensure that gcc passes it around efficiently.

Definition at line 159 of file libkir.h.


Function Documentation

static __attribute__ ( (always_inline)   )  [inline, static]

Copy data to user buffer.

Parameters:
buffer User buffer
offset Offset within user buffer
src Source
len Length

Definition at line 26 of file libkir.h.

References __asm__().

00026                                                                              {
00027         uint16_t cs;
00028         __asm__ __volatile__ ( "movw %%cs, %w0" : "=r" ( cs ) );
00029         return cs;
00030 }

static void copy_to_real_libkir ( unsigned int  dest_seg,
unsigned int  dest_off,
const void *  src,
size_t  n 
) [inline, static]

Definition at line 43 of file libkir.h.

References __asm__().

00045                                                                      {
00046         unsigned int discard_D, discard_S, discard_c;
00047 
00048         __asm__ __volatile__ ( "pushw %%es\n\t"
00049                                "movw %3, %%es\n\t"
00050                                "rep movsb\n\t"
00051                                "popw %%es\n\t"
00052                                : "=D" ( discard_D ), "=S" ( discard_S ),
00053                                  "=c" ( discard_c )
00054                                : "r" ( dest_seg ), "D" ( dest_off ),
00055                                  "S" ( src ),
00056                                  "c" ( n )
00057                                : "memory" );
00058 }

static void copy_from_real_libkir ( void *  dest,
unsigned int  src_seg,
unsigned int  src_off,
size_t  n 
) [inline, static]

Definition at line 60 of file libkir.h.

References __asm__().

00063                                                       {
00064         unsigned int discard_D, discard_S, discard_c;
00065 
00066         __asm__ __volatile__ ( "pushw %%ds\n\t"
00067                                "movw %4, %%ds\n\t"
00068                                "rep movsb\n\t"
00069                                "popw %%ds\n\t"
00070                                : "=D" ( discard_D ), "=S" ( discard_S ),
00071                                  "=c" ( discard_c )
00072                                : "D" ( dest ),
00073                                  "r" ( src_seg ), "S" ( src_off ),
00074                                  "c" ( n )
00075                                : "memory" );
00076 }


Variable Documentation

Definition at line 170 of file libkir.h.

Referenced by aout_download(), ath5k_cal_data_offset_2413(), ath5k_eeprom_init_modes(), ath5k_eeprom_read_ctl_info(), ath5k_eeprom_read_mac(), ath5k_eeprom_read_pcal_info_2413(), ath5k_eeprom_read_pcal_info_5111(), ath5k_eeprom_read_pcal_info_5112(), ath5k_eeprom_read_target_rate_pwr_info(), ath5k_hw_rfb_op(), atl1e_setup_ring_resources(), bi_import(), bios_find_smbios(), bnx2_init_context(), bzimage_load_initrd(), check_region(), clear_b0_fpga_memories(), dbg_hex_dump_da(), dhcpopt_extensible_store(), dhcpopt_fetch(), dhcpopt_store(), dhcpopt_update_len(), digest_exec(), e1000_check_alt_mac_addr_generic(), e1000_check_downshift_generic(), e1000_check_polarity_ife(), e1000_check_polarity_igp(), e1000_clear_vfta_generic(), e1000_read_mac_addr_82540(), e1000e_check_alt_mac_addr_generic(), e1000e_check_downshift(), e1000e_check_polarity_ife(), e1000e_check_polarity_igp(), e1000e_clear_vfta_82571(), e1000e_clear_vfta_generic(), find_dhcp_option_with_encap(), find_smbios_structure(), guard_region(), igb_check_alt_mac_addr_generic(), igb_check_downshift_generic(), igb_check_polarity_ife(), igb_check_polarity_igp(), igb_clear_vfta_generic(), iscsi_rx_data_in(), iscsi_start_data_out(), iscsi_tx_data_out(), linda_post_send(), linda_verify_uc_ram(), load_cpu_fw(), md5_final(), multiboot_find_header(), multiboot_load_raw(), pci_backup(), pci_restore(), phantom_clp_fetch(), phantom_clp_store(), phantom_crb_access_128m(), phantom_crb_access_2m(), phantom_crb_access_32m(), phantom_dmesg(), phantom_get_macaddr(), phantom_readl(), phantom_writel(), ramdisk_read(), ramdisk_write(), read_smbios_string(), script_exec(), set_dhcp_option(), tftp_rx_data(), and vxge_hw_ring_replenish().

off_t const void* src

Definition at line 170 of file libkir.h.


Generated on Tue Apr 6 20:01:12 2010 for gPXE by  doxygen 1.5.7.1