summaryrefslogtreecommitdiff
path: root/gpxe/src/arch/i386/include/libkir.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-02-09 18:08:47 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-02-09 18:08:47 -0800
commitf2f897a1762fab84d2905f32b1c15dd7b42abb56 (patch)
treea38f51d3f1fcbf44afddb4736d549c12eaf491be /gpxe/src/arch/i386/include/libkir.h
parent72d2959272b4616f17a97667e6dfa9d06bf109a3 (diff)
downloadsyslinux-f2f897a1762fab84d2905f32b1c15dd7b42abb56.tar.gz
gpxe: delete long since obsolete snapshot of gPXE
gPXE has been deprecated in favor of iPXE for many, many years now. It is much better than users get it directly from the iPXE project, since we should no longer need any special modifications for Syslinux use. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'gpxe/src/arch/i386/include/libkir.h')
-rw-r--r--gpxe/src/arch/i386/include/libkir.h233
1 files changed, 0 insertions, 233 deletions
diff --git a/gpxe/src/arch/i386/include/libkir.h b/gpxe/src/arch/i386/include/libkir.h
deleted file mode 100644
index 1f5b1350..00000000
--- a/gpxe/src/arch/i386/include/libkir.h
+++ /dev/null
@@ -1,233 +0,0 @@
-#ifndef LIBKIR_H
-#define LIBKIR_H
-
-#include "realmode.h"
-
-#ifndef ASSEMBLY
-
-/*
- * Full API documentation for these functions is in realmode.h.
- *
- */
-
-/* Access to variables in .data16 and .text16 in a way compatible with librm */
-#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
-
-/* Real-mode data and code segments */
-static inline __attribute__ (( always_inline )) unsigned int _rm_cs ( void ) {
- uint16_t cs;
- __asm__ __volatile__ ( "movw %%cs, %w0" : "=r" ( cs ) );
- return cs;
-}
-
-static inline __attribute__ (( always_inline )) unsigned int _rm_ds ( void ) {
- uint16_t ds;
- __asm__ __volatile__ ( "movw %%ds, %w0" : "=r" ( ds ) );
- return ds;
-}
-
-#define rm_cs ( _rm_cs() )
-#define rm_ds ( _rm_ds() )
-
-/* Copy to/from base memory */
-
-static inline void copy_to_real_libkir ( unsigned int dest_seg,
- unsigned int dest_off,
- const void *src, size_t n ) {
- unsigned int discard_D, discard_S, discard_c;
-
- __asm__ __volatile__ ( "pushw %%es\n\t"
- "movw %3, %%es\n\t"
- "rep movsb\n\t"
- "popw %%es\n\t"
- : "=D" ( discard_D ), "=S" ( discard_S ),
- "=c" ( discard_c )
- : "r" ( dest_seg ), "D" ( dest_off ),
- "S" ( src ),
- "c" ( n )
- : "memory" );
-}
-
-static inline void copy_from_real_libkir ( void *dest,
- unsigned int src_seg,
- unsigned int src_off,
- size_t n ) {
- unsigned int discard_D, discard_S, discard_c;
-
- __asm__ __volatile__ ( "pushw %%ds\n\t"
- "movw %4, %%ds\n\t"
- "rep movsb\n\t"
- "popw %%ds\n\t"
- : "=D" ( discard_D ), "=S" ( discard_S ),
- "=c" ( discard_c )
- : "D" ( dest ),
- "r" ( src_seg ), "S" ( src_off ),
- "c" ( n )
- : "memory" );
-}
-
-#define copy_to_real copy_to_real_libkir
-#define copy_from_real copy_from_real_libkir
-
-/*
- * Transfer individual values to/from base memory. There may well be
- * a neater way to do this. We have two versions: one for constant
- * offsets (where the mov instruction must be of the form "mov
- * %es:123, %xx") and one for non-constant offsets (where the mov
- * instruction must be of the form "mov %es:(%xx), %yx". If it's
- * possible to incorporate both forms into one __asm__ instruction, I
- * don't know how to do it.
- *
- * Ideally, the mov instruction should be "mov%z0"; the "%z0" is meant
- * to expand to either "b", "w" or "l" depending on the size of
- * operand 0. This would remove the (minor) ambiguity in the mov
- * instruction. However, gcc on at least my system barfs with an
- * "internal compiler error" when confronted with %z0.
- *
- */
-
-#define put_real_kir_const_off( var, seg, off ) \
- __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 ) \
- )
-
-#define put_real_kir_nonconst_off( var, seg, off ) \
- __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 ) \
- )
-
-#define put_real_kir( var, seg, off ) \
- 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 )
-
-#define get_real_kir_const_off( var, seg, off ) \
- __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 ) \
- )
-
-#define get_real_kir_nonconst_off( var, seg, off ) \
- __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 ) \
- )
-
-#define get_real_kir( var, seg, off ) \
- 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 )
-
-#define put_real put_real_kir
-#define get_real get_real_kir
-
-/**
- * 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.
- */
-typedef uint32_t userptr_t;
-
-/**
- * Copy data to user buffer
- *
- * @v buffer User buffer
- * @v offset Offset within user buffer
- * @v src Source
- * @v len Length
- */
-static inline __attribute__ (( always_inline )) void
-copy_to_user ( userptr_t buffer, off_t offset, const void *src, size_t len ) {
- copy_to_real ( ( buffer >> 16 ), ( ( buffer & 0xffff ) + offset ),
- src, len );
-}
-
-/**
- * Copy data from user buffer
- *
- * @v dest Destination
- * @v buffer User buffer
- * @v offset Offset within user buffer
- * @v len Length
- */
-static inline __attribute__ (( always_inline )) void
-copy_from_user ( void *dest, userptr_t buffer, off_t offset, size_t len ) {
- copy_from_real ( dest, ( buffer >> 16 ),
- ( ( buffer & 0xffff ) + offset ), len );
-}
-
-/**
- * Convert segment:offset address to user buffer
- *
- * @v segment Real-mode segment
- * @v offset Real-mode offset
- * @ret buffer User buffer
- */
-static inline __attribute__ (( always_inline )) userptr_t
-real_to_user ( unsigned int segment, unsigned int offset ) {
- return ( ( segment << 16 ) | offset );
-}
-
-/**
- * Convert virtual address to user buffer
- *
- * @v virtual Virtual address
- * @ret buffer User buffer
- *
- * This constructs a user buffer from an ordinary pointer. Use it
- * when you need to pass a pointer to an internal buffer to a function
- * that expects a @c userptr_t.
- */
-static inline __attribute__ (( always_inline )) userptr_t
-virt_to_user ( void * virtual ) {
- return real_to_user ( rm_ds, ( intptr_t ) virtual );
-}
-
-/* TEXT16_CODE: declare a fragment of code that resides in .text16 */
-#define TEXT16_CODE( asm_code_str ) \
- ".section \".text16\", \"ax\", @progbits\n\t" \
- ".code16\n\t" \
- ".arch i386\n\t" \
- asm_code_str "\n\t" \
- ".code16gcc\n\t" \
- ".previous\n\t"
-
-/* REAL_CODE: declare a fragment of code that executes in real mode */
-#define REAL_CODE( asm_code_str ) \
- ".code16\n\t" \
- asm_code_str "\n\t" \
- ".code16gcc\n\t"
-
-#endif /* ASSEMBLY */
-
-#endif /* LIBKIR_H */