summaryrefslogtreecommitdiff
path: root/gpxe/src/arch/i386/include/bits
diff options
context:
space:
mode:
Diffstat (limited to 'gpxe/src/arch/i386/include/bits')
-rw-r--r--gpxe/src/arch/i386/include/bits/byteswap.h45
-rw-r--r--gpxe/src/arch/i386/include/bits/compiler.h25
-rw-r--r--gpxe/src/arch/i386/include/bits/elf.h91
-rw-r--r--gpxe/src/arch/i386/include/bits/elf_x.h5
-rw-r--r--gpxe/src/arch/i386/include/bits/errfile.h6
-rw-r--r--gpxe/src/arch/i386/include/bits/io.h12
-rw-r--r--gpxe/src/arch/i386/include/bits/nap.h13
-rw-r--r--gpxe/src/arch/i386/include/bits/smbios.h12
-rw-r--r--gpxe/src/arch/i386/include/bits/stdint.h8
-rw-r--r--gpxe/src/arch/i386/include/bits/string.h252
-rw-r--r--gpxe/src/arch/i386/include/bits/timer.h13
-rw-r--r--gpxe/src/arch/i386/include/bits/timer2.h8
-rw-r--r--gpxe/src/arch/i386/include/bits/uaccess.h8
-rw-r--r--gpxe/src/arch/i386/include/bits/umalloc.h12
14 files changed, 106 insertions, 404 deletions
diff --git a/gpxe/src/arch/i386/include/bits/byteswap.h b/gpxe/src/arch/i386/include/bits/byteswap.h
index 54b93ab9..98418c29 100644
--- a/gpxe/src/arch/i386/include/bits/byteswap.h
+++ b/gpxe/src/arch/i386/include/bits/byteswap.h
@@ -2,7 +2,7 @@
#define ETHERBOOT_BITS_BYTESWAP_H
static inline __attribute__ ((always_inline, const)) uint16_t
-__i386_bswap_16(uint16_t x)
+__bswap_variable_16(uint16_t x)
{
__asm__("xchgb %b0,%h0\n\t"
: "=q" (x)
@@ -11,7 +11,7 @@ __i386_bswap_16(uint16_t x)
}
static inline __attribute__ ((always_inline, const)) uint32_t
-__i386_bswap_32(uint32_t x)
+__bswap_variable_32(uint32_t x)
{
__asm__("xchgb %b0,%h0\n\t"
"rorl $16,%0\n\t"
@@ -22,7 +22,7 @@ __i386_bswap_32(uint32_t x)
}
static inline __attribute__ ((always_inline, const)) uint64_t
-__i386_bswap_64(uint64_t x)
+__bswap_variable_64(uint64_t x)
{
union {
uint64_t qword;
@@ -30,47 +30,12 @@ __i386_bswap_64(uint64_t x)
} u;
u.qword = x;
- u.dword[0] = __i386_bswap_32(u.dword[0]);
- u.dword[1] = __i386_bswap_32(u.dword[1]);
+ u.dword[0] = __bswap_variable_32(u.dword[0]);
+ u.dword[1] = __bswap_variable_32(u.dword[1]);
__asm__("xchgl %0,%1"
: "=r" ( u.dword[0] ), "=r" ( u.dword[1] )
: "0" ( u.dword[0] ), "1" ( u.dword[1] ) );
return u.qword;
}
-#define __bswap_constant_16(x) \
- ((uint16_t)((((uint16_t)(x) & 0x00ff) << 8) | \
- (((uint16_t)(x) & 0xff00) >> 8)))
-
-#define __bswap_constant_32(x) \
- ((uint32_t)((((uint32_t)(x) & 0x000000ffU) << 24) | \
- (((uint32_t)(x) & 0x0000ff00U) << 8) | \
- (((uint32_t)(x) & 0x00ff0000U) >> 8) | \
- (((uint32_t)(x) & 0xff000000U) >> 24)))
-
-#define __bswap_constant_64(x) \
- ((uint64_t)((((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \
- (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
- (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
- (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
- (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
- (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
- (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
- (((uint64_t)(x) & 0xff00000000000000ULL) >> 56)))
-
-#define __bswap_16(x) \
- ((uint16_t)(__builtin_constant_p(x) ? \
- __bswap_constant_16(x) : \
- __i386_bswap_16(x)))
-
-#define __bswap_32(x) \
- ((uint32_t)(__builtin_constant_p(x) ? \
- __bswap_constant_32(x) : \
- __i386_bswap_32(x)))
-
-#define __bswap_64(x) \
- ((uint64_t)(__builtin_constant_p(x) ? \
- __bswap_constant_64(x) : \
- __i386_bswap_64(x)))
-
#endif /* ETHERBOOT_BITS_BYTESWAP_H */
diff --git a/gpxe/src/arch/i386/include/bits/compiler.h b/gpxe/src/arch/i386/include/bits/compiler.h
new file mode 100644
index 00000000..119a9a21
--- /dev/null
+++ b/gpxe/src/arch/i386/include/bits/compiler.h
@@ -0,0 +1,25 @@
+#ifndef _BITS_COMPILER_H
+#define _BITS_COMPILER_H
+
+#ifndef ASSEMBLY
+
+/** Declare a function with standard calling conventions */
+#define __asmcall __attribute__ (( cdecl, regparm(0) ))
+
+/**
+ * Declare a function with libgcc implicit linkage
+ *
+ * It seems as though gcc expects its implicit arithmetic functions to
+ * be cdecl, even if -mrtd is specified. This is somewhat
+ * inconsistent; for example, if -mregparm=3 is used then the implicit
+ * functions do become regparm(3).
+ *
+ * The implicit calls to memcpy() and memset() which gcc can generate
+ * do not seem to have this inconsistency; -mregparm and -mrtd affect
+ * them in the same way as any other function.
+ */
+#define __libgcc __attribute__ (( cdecl ))
+
+#endif /* ASSEMBLY */
+
+#endif /* _BITS_COMPILER_H */
diff --git a/gpxe/src/arch/i386/include/bits/elf.h b/gpxe/src/arch/i386/include/bits/elf.h
deleted file mode 100644
index dad9c7b8..00000000
--- a/gpxe/src/arch/i386/include/bits/elf.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef I386_BITS_ELF_H
-#define I386_BITS_ELF_H
-
-#include "cpu.h"
-
-#ifdef CONFIG_X86_64
-/* ELF Defines for the 64bit version of the current architecture */
-#define EM_CURRENT_64 EM_X86_64
-#define EM_CURRENT_64_PRESENT ( \
- CPU_FEATURE_P(cpu_info.x86_capability, LM) && \
- CPU_FEATURE_P(cpu_info.x86_capability, PAE) && \
- CPU_FEATURE_P(cpu_info.x86_capability, PSE))
-
-#define ELF_CHECK_X86_64_ARCH(x) \
- (EM_CURRENT_64_PRESENT && ((x).e_machine == EM_X86_64))
-#define __unused_i386
-#else
-#define ELF_CHECK_X86_64_ARCH(x) 0
-#define __unused_i386 __unused
-#endif
-
-
-/* ELF Defines for the current architecture */
-#define EM_CURRENT EM_386
-#define ELFDATA_CURRENT ELFDATA2LSB
-
-#define ELF_CHECK_I386_ARCH(x) \
- (((x).e_machine == EM_386) || ((x).e_machine == EM_486))
-
-#define ELF_CHECK_ARCH(x) \
- ((ELF_CHECK_I386_ARCH(x) || ELF_CHECK_X86_64_ARCH(x)) && \
- ((x).e_entry <= 0xffffffffUL))
-
-#ifdef IMAGE_FREEBSD
-/*
- * FreeBSD has this rather strange "feature" of its design.
- * At some point in its evolution, FreeBSD started to rely
- * externally on private/static/debug internal symbol information.
- * That is, some of the interfaces that software uses to access
- * and work with the FreeBSD kernel are made available not
- * via the shared library symbol information (the .DYNAMIC section)
- * but rather the debug symbols. This means that any symbol, not
- * just publicly defined symbols can be (and are) used by system
- * tools to make the system work. (such as top, swapinfo, swapon,
- * etc)
- *
- * Even worse, however, is the fact that standard ELF loaders do
- * not know how to load the symbols since they are not within
- * an ELF PT_LOAD section. The kernel needs these symbols to
- * operate so the following changes/additions to the boot
- * loading of EtherBoot have been made to get the kernel to load.
- * All of the changes are within IMAGE_FREEBSD such that the
- * extra/changed code only compiles when FREEBSD support is
- * enabled.
- */
-
-/*
- * Section header for FreeBSD (debug symbol kludge!) support
- */
-typedef struct {
- Elf32_Word sh_name; /* Section name (index into the
- section header string table). */
- Elf32_Word sh_type; /* Section type. */
- Elf32_Word sh_flags; /* Section flags. */
- Elf32_Addr sh_addr; /* Address in memory image. */
- Elf32_Off sh_offset; /* Offset in file. */
- Elf32_Size sh_size; /* Size in bytes. */
- Elf32_Word sh_link; /* Index of a related section. */
- Elf32_Word sh_info; /* Depends on section type. */
- Elf32_Size sh_addralign; /* Alignment in bytes. */
- Elf32_Size sh_entsize; /* Size of each entry in section. */
-} Elf32_Shdr;
-
-/* sh_type */
-#define SHT_SYMTAB 2 /* symbol table section */
-#define SHT_STRTAB 3 /* string table section */
-
-/*
- * Module information subtypes (for the metadata that we need to build)
- */
-#define MODINFO_END 0x0000 /* End of list */
-#define MODINFO_NAME 0x0001 /* Name of module (string) */
-#define MODINFO_TYPE 0x0002 /* Type of module (string) */
-#define MODINFO_METADATA 0x8000 /* Module-specfic */
-
-#define MODINFOMD_SSYM 0x0003 /* start of symbols */
-#define MODINFOMD_ESYM 0x0004 /* end of symbols */
-
-#endif /* IMAGE_FREEBSD */
-
-#endif /* I386_BITS_ELF_H */
diff --git a/gpxe/src/arch/i386/include/bits/elf_x.h b/gpxe/src/arch/i386/include/bits/elf_x.h
deleted file mode 100644
index 86c67250..00000000
--- a/gpxe/src/arch/i386/include/bits/elf_x.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#define ARCH_ELF_CLASS ELFCLASS32
-#define ARCH_ELF_DATA ELFDATA2LSB
-#define ARCH_ELF_MACHINE_OK(x) ((x)==EM_386 || (x)==EM_486)
-typedef Elf32_Ehdr Elf_ehdr;
-typedef Elf32_Phdr Elf_phdr;
diff --git a/gpxe/src/arch/i386/include/bits/errfile.h b/gpxe/src/arch/i386/include/bits/errfile.h
index 99927c28..5ea8a318 100644
--- a/gpxe/src/arch/i386/include/bits/errfile.h
+++ b/gpxe/src/arch/i386/include/bits/errfile.h
@@ -6,13 +6,12 @@
* @{
*/
-#define ERRFILE_umalloc ( ERRFILE_ARCH | ERRFILE_CORE | 0x00000000 )
+#define ERRFILE_memtop_umalloc ( ERRFILE_ARCH | ERRFILE_CORE | 0x00000000 )
#define ERRFILE_memmap ( ERRFILE_ARCH | ERRFILE_CORE | 0x00010000 )
#define ERRFILE_pnpbios ( ERRFILE_ARCH | ERRFILE_CORE | 0x00020000 )
-#define ERRFILE_smbios ( ERRFILE_ARCH | ERRFILE_CORE | 0x00030000 )
+#define ERRFILE_bios_smbios ( ERRFILE_ARCH | ERRFILE_CORE | 0x00030000 )
#define ERRFILE_biosint ( ERRFILE_ARCH | ERRFILE_CORE | 0x00040000 )
#define ERRFILE_int13 ( ERRFILE_ARCH | ERRFILE_CORE | 0x00050000 )
-#define ERRFILE_smbios_settings ( ERRFILE_ARCH | ERRFILE_CORE | 0x00060000 )
#define ERRFILE_bootsector ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00000000 )
#define ERRFILE_bzimage ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00010000 )
@@ -24,6 +23,7 @@
#define ERRFILE_comboot ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00070000 )
#define ERRFILE_com32 ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00080000 )
#define ERRFILE_comboot_resolv ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00090000 )
+#define ERRFILE_comboot_call ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000a0000 )
#define ERRFILE_undi ( ERRFILE_ARCH | ERRFILE_NET | 0x00000000 )
#define ERRFILE_undiload ( ERRFILE_ARCH | ERRFILE_NET | 0x00010000 )
diff --git a/gpxe/src/arch/i386/include/bits/io.h b/gpxe/src/arch/i386/include/bits/io.h
new file mode 100644
index 00000000..dd0ee444
--- /dev/null
+++ b/gpxe/src/arch/i386/include/bits/io.h
@@ -0,0 +1,12 @@
+#ifndef _BITS_IO_H
+#define _BITS_IO_H
+
+/** @file
+ *
+ * i386-specific I/O API implementations
+ *
+ */
+
+#include <gpxe/x86_io.h>
+
+#endif /* _BITS_IO_H */
diff --git a/gpxe/src/arch/i386/include/bits/nap.h b/gpxe/src/arch/i386/include/bits/nap.h
new file mode 100644
index 00000000..f8ba7a7c
--- /dev/null
+++ b/gpxe/src/arch/i386/include/bits/nap.h
@@ -0,0 +1,13 @@
+#ifndef _BITS_NAP_H
+#define _BITS_NAP_H
+
+/** @file
+ *
+ * i386-specific CPU sleeping API implementations
+ *
+ */
+
+#include <gpxe/bios_nap.h>
+#include <gpxe/efi/efix86_nap.h>
+
+#endif /* _BITS_MAP_H */
diff --git a/gpxe/src/arch/i386/include/bits/smbios.h b/gpxe/src/arch/i386/include/bits/smbios.h
new file mode 100644
index 00000000..647ea19e
--- /dev/null
+++ b/gpxe/src/arch/i386/include/bits/smbios.h
@@ -0,0 +1,12 @@
+#ifndef _BITS_SMBIOS_H
+#define _BITS_SMBIOS_H
+
+/** @file
+ *
+ * i386-specific SMBIOS API implementations
+ *
+ */
+
+#include <gpxe/bios_smbios.h>
+
+#endif /* _BITS_SMBIOS_H */
diff --git a/gpxe/src/arch/i386/include/bits/stdint.h b/gpxe/src/arch/i386/include/bits/stdint.h
index a2947cda..6ccf0971 100644
--- a/gpxe/src/arch/i386/include/bits/stdint.h
+++ b/gpxe/src/arch/i386/include/bits/stdint.h
@@ -1,18 +1,18 @@
#ifndef _BITS_STDINT_H
#define _BITS_STDINT_H
-typedef typeof(sizeof(int)) size_t;
-typedef signed long ssize_t;
+typedef unsigned int size_t;
+typedef signed int ssize_t;
typedef signed long off_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
-typedef unsigned long uint32_t;
+typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef signed char int8_t;
typedef signed short int16_t;
-typedef signed long int32_t;
+typedef signed int int32_t;
typedef signed long long int64_t;
typedef unsigned long physaddr_t;
diff --git a/gpxe/src/arch/i386/include/bits/string.h b/gpxe/src/arch/i386/include/bits/string.h
deleted file mode 100644
index c05a7df8..00000000
--- a/gpxe/src/arch/i386/include/bits/string.h
+++ /dev/null
@@ -1,252 +0,0 @@
-#ifndef ETHERBOOT_BITS_STRING_H
-#define ETHERBOOT_BITS_STRING_H
-/*
- * Taken from Linux /usr/include/asm/string.h
- * All except memcpy, memmove, memset and memcmp removed.
- *
- * Non-standard memswap() function added because it saves quite a bit
- * of code (mbrown@fensystems.co.uk).
- */
-
-/*
- * This string-include defines all string functions as inline
- * functions. Use gcc. It also assumes ds=es=data space, this should be
- * normal. Most of the string-functions are rather heavily hand-optimized,
- * see especially strtok,strstr,str[c]spn. They should work, but are not
- * very easy to understand. Everything is done entirely within the register
- * set, making the functions fast and clean. String instructions have been
- * used through-out, making for "slightly" unclear code :-)
- *
- * NO Copyright (C) 1991, 1992 Linus Torvalds,
- * consider these trivial functions to be PD.
- */
-
-#define __HAVE_ARCH_MEMCPY
-
-extern __attribute__ (( regparm ( 3 ) )) void * __memcpy ( void *dest,
- const void *src,
- size_t len );
-
-#if 0
-static inline __attribute__ (( always_inline )) void *
-__memcpy ( void *dest, const void *src, size_t len ) {
- int d0, d1, d2;
- __asm__ __volatile__ ( "rep ; movsb"
- : "=&c" ( d0 ), "=&S" ( d1 ), "=&D" ( d2 )
- : "0" ( len ), "1" ( src ), "2" ( dest )
- : "memory" );
- return dest;
-}
-#endif
-
-static inline __attribute__ (( always_inline )) void *
-__constant_memcpy ( void *dest, const void *src, size_t len ) {
- union {
- uint32_t u32[2];
- uint16_t u16[4];
- uint8_t u8[8];
- } __attribute__ (( __may_alias__ )) *dest_u = dest;
- const union {
- uint32_t u32[2];
- uint16_t u16[4];
- uint8_t u8[8];
- } __attribute__ (( __may_alias__ )) *src_u = src;
- const void *esi;
- void *edi;
-
- switch ( len ) {
- case 0 : /* 0 bytes */
- return dest;
- /*
- * Single-register moves; these are always better than a
- * string operation. We can clobber an arbitrary two
- * registers (data, source, dest can re-use source register)
- * instead of being restricted to esi and edi. There's also a
- * much greater potential for optimising with nearby code.
- *
- */
- case 1 : /* 4 bytes */
- dest_u->u8[0] = src_u->u8[0];
- return dest;
- case 2 : /* 6 bytes */
- dest_u->u16[0] = src_u->u16[0];
- return dest;
- case 4 : /* 4 bytes */
- dest_u->u32[0] = src_u->u32[0];
- return dest;
- /*
- * Double-register moves; these are probably still a win.
- *
- */
- case 3 : /* 12 bytes */
- dest_u->u16[0] = src_u->u16[0];
- dest_u->u8[2] = src_u->u8[2];
- return dest;
- case 5 : /* 10 bytes */
- dest_u->u32[0] = src_u->u32[0];
- dest_u->u8[4] = src_u->u8[4];
- return dest;
- case 6 : /* 12 bytes */
- dest_u->u32[0] = src_u->u32[0];
- dest_u->u16[2] = src_u->u16[2];
- return dest;
- case 8 : /* 10 bytes */
- dest_u->u32[0] = src_u->u32[0];
- dest_u->u32[1] = src_u->u32[1];
- return dest;
- }
-
- /* Even if we have to load up esi and edi ready for a string
- * operation, we can sometimes save space by using multiple
- * single-byte "movs" operations instead of loading up ecx and
- * using "rep movsb".
- *
- * "load ecx, rep movsb" is 7 bytes, plus an average of 1 byte
- * to allow for saving/restoring ecx 50% of the time.
- *
- * "movsl" and "movsb" are 1 byte each, "movsw" is two bytes.
- * (In 16-bit mode, "movsl" is 2 bytes and "movsw" is 1 byte,
- * but "movsl" moves twice as much data, so it balances out).
- *
- * The cutoff point therefore occurs around 26 bytes; the byte
- * requirements for each method are:
- *
- * len 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
- * #bytes (ecx) 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
- * #bytes (no ecx) 4 5 6 7 5 6 7 8 6 7 8 9 7 8 9 10
- */
-
- esi = src;
- edi = dest;
-
- if ( len >= 26 )
- return __memcpy ( dest, src, len );
-
- if ( len >= 6*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 5*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 4*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 3*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 2*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 1*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( ( len % 4 ) >= 2 )
- __asm__ __volatile__ ( "movsw" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( ( len % 2 ) >= 1 )
- __asm__ __volatile__ ( "movsb" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
-
- return dest;
-}
-
-#define memcpy( dest, src, len ) \
- ( __builtin_constant_p ( (len) ) ? \
- __constant_memcpy ( (dest), (src), (len) ) : \
- __memcpy ( (dest), (src), (len) ) )
-
-#define __HAVE_ARCH_MEMMOVE
-static inline void * memmove(void * dest,const void * src, size_t n)
-{
-int d0, d1, d2;
-if (dest<src)
-__asm__ __volatile__(
- "cld\n\t"
- "rep\n\t"
- "movsb"
- : "=&c" (d0), "=&S" (d1), "=&D" (d2)
- :"0" (n),"1" (src),"2" (dest)
- : "memory");
-else
-__asm__ __volatile__(
- "std\n\t"
- "rep\n\t"
- "movsb\n\t"
- "cld"
- : "=&c" (d0), "=&S" (d1), "=&D" (d2)
- :"0" (n),
- "1" (n-1+(const char *)src),
- "2" (n-1+(char *)dest)
- :"memory");
-return dest;
-}
-
-#define __HAVE_ARCH_MEMSET
-static inline void * memset(void *s, int c,size_t count)
-{
-int d0, d1;
-__asm__ __volatile__(
- "cld\n\t"
- "rep\n\t"
- "stosb"
- : "=&c" (d0), "=&D" (d1)
- :"a" (c),"1" (s),"0" (count)
- :"memory");
-return s;
-}
-
-#define __HAVE_ARCH_MEMSWAP
-static inline void * memswap(void *dest, void *src, size_t n)
-{
-int d0, d1, d2, d3;
-__asm__ __volatile__(
- "\n1:\t"
- "movb (%%edi),%%al\n\t"
- "xchgb (%%esi),%%al\n\t"
- "incl %%esi\n\t"
- "stosb\n\t"
- "loop 1b"
- : "=&c" (d0), "=&S" (d1), "=&D" (d2), "=&a" (d3)
- : "0" (n), "1" (src), "2" (dest)
- : "memory" );
-return dest;
-}
-
-#define __HAVE_ARCH_STRNCMP
-static inline int strncmp(const char * cs,const char * ct,size_t count)
-{
-register int __res;
-int d0, d1, d2;
-__asm__ __volatile__(
- "1:\tdecl %3\n\t"
- "js 2f\n\t"
- "lodsb\n\t"
- "scasb\n\t"
- "jne 3f\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b\n"
- "2:\txorl %%eax,%%eax\n\t"
- "jmp 4f\n"
- "3:\tsbbl %%eax,%%eax\n\t"
- "orb $1,%%al\n"
- "4:"
- :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
- :"1" (cs),"2" (ct),"3" (count));
-return __res;
-}
-
-#define __HAVE_ARCH_STRLEN
-static inline size_t strlen(const char * s)
-{
-int d0;
-register int __res;
-__asm__ __volatile__(
- "repne\n\t"
- "scasb\n\t"
- "notl %0\n\t"
- "decl %0"
- :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffff));
-return __res;
-}
-
-#endif /* ETHERBOOT_BITS_STRING_H */
diff --git a/gpxe/src/arch/i386/include/bits/timer.h b/gpxe/src/arch/i386/include/bits/timer.h
new file mode 100644
index 00000000..99666d84
--- /dev/null
+++ b/gpxe/src/arch/i386/include/bits/timer.h
@@ -0,0 +1,13 @@
+#ifndef _BITS_TIMER_H
+#define _BITS_TIMER_H
+
+/** @file
+ *
+ * i386-specific timer API implementations
+ *
+ */
+
+#include <gpxe/bios_timer.h>
+#include <gpxe/rdtsc_timer.h>
+
+#endif /* _BITS_TIMER_H */
diff --git a/gpxe/src/arch/i386/include/bits/timer2.h b/gpxe/src/arch/i386/include/bits/timer2.h
deleted file mode 100644
index 83923b29..00000000
--- a/gpxe/src/arch/i386/include/bits/timer2.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef BITS_TIMER2_H
-#define BITS_TIMER2_H
-
-#include <stddef.h>
-
-void i386_timer2_udelay(unsigned int usecs);
-
-#endif
diff --git a/gpxe/src/arch/i386/include/bits/uaccess.h b/gpxe/src/arch/i386/include/bits/uaccess.h
index 9c6d0c21..0ecc5028 100644
--- a/gpxe/src/arch/i386/include/bits/uaccess.h
+++ b/gpxe/src/arch/i386/include/bits/uaccess.h
@@ -1,6 +1,12 @@
#ifndef _BITS_UACCESS_H
#define _BITS_UACCESS_H
-#include <realmode.h>
+/** @file
+ *
+ * i386-specific user access API implementations
+ *
+ */
+
+#include <librm.h>
#endif /* _BITS_UACCESS_H */
diff --git a/gpxe/src/arch/i386/include/bits/umalloc.h b/gpxe/src/arch/i386/include/bits/umalloc.h
new file mode 100644
index 00000000..dcbd0a6b
--- /dev/null
+++ b/gpxe/src/arch/i386/include/bits/umalloc.h
@@ -0,0 +1,12 @@
+#ifndef _BITS_UMALLOC_H
+#define _BITS_UMALLOC_H
+
+/** @file
+ *
+ * i386-specific user memory allocation API implementations
+ *
+ */
+
+#include <gpxe/memtop_umalloc.h>
+
+#endif /* _BITS_UMALLOC_H */