mirror of https://github.com/ipxe/ipxe.git
Doxygenation
parent
eff1cd867b
commit
d0c9183903
|
@ -1,9 +1,16 @@
|
||||||
#ifndef BOCHS_H
|
#ifndef BOCHS_H
|
||||||
#define BOCHS_H
|
#define BOCHS_H
|
||||||
|
|
||||||
/*
|
/** @file
|
||||||
* This file defines "bochsbp", the magic breakpoint instruction that
|
*
|
||||||
* is incredibly useful when debugging under bochs.
|
* bochs breakpoints
|
||||||
|
*
|
||||||
|
* This file defines @c bochsbp, the magic breakpoint instruction that
|
||||||
|
* is incredibly useful when debugging under bochs. This file should
|
||||||
|
* never be included in production code.
|
||||||
|
*
|
||||||
|
* Use the pseudo-instruction @c bochsbp in assembly code, or the
|
||||||
|
* bochsbp() function in C code.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -15,7 +22,7 @@
|
||||||
|
|
||||||
#else /* ASSEMBLY */
|
#else /* ASSEMBLY */
|
||||||
|
|
||||||
/* Breakpoint for when debugging under bochs */
|
/** Breakpoint for when debugging under bochs */
|
||||||
static inline void bochsbp ( void ) {
|
static inline void bochsbp ( void ) {
|
||||||
__asm__ __volatile__ ( "xchgw %bx, %bx" );
|
__asm__ __volatile__ ( "xchgw %bx, %bx" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,27 +10,57 @@
|
||||||
#define SHRT_SHIFT ((int)((sizeof(unsigned short)*CHAR_BIT) - 4))
|
#define SHRT_SHIFT ((int)((sizeof(unsigned short)*CHAR_BIT) - 4))
|
||||||
#define CHAR_SHIFT ((int)((sizeof(unsigned char)*CHAR_BIT) - 4))
|
#define CHAR_SHIFT ((int)((sizeof(unsigned char)*CHAR_BIT) - 4))
|
||||||
|
|
||||||
/**************************************************************************
|
/** @file
|
||||||
PRINTF and friends
|
*
|
||||||
|
* printf and friends.
|
||||||
|
*
|
||||||
|
* Etherboot's printf() functions understand the following format
|
||||||
|
* specifiers:
|
||||||
|
*
|
||||||
|
* - Hexadecimal integers
|
||||||
|
* - @c %[#]x - 4 bytes int (8 hex digits, lower case)
|
||||||
|
* - @c %[#]X - 4 bytes int (8 hex digits, upper case)
|
||||||
|
* - @c %[#]lx - 8 bytes long (16 hex digits, lower case)
|
||||||
|
* - @c %[#]lX - 8 bytes long (16 hex digits, upper case)
|
||||||
|
* - @c %[#]hx - 2 bytes int (4 hex digits, lower case)
|
||||||
|
* - @c %[#]hX - 2 bytes int (4 hex digits, upper case)
|
||||||
|
* - @c %[#]hhx - 1 byte int (2 hex digits, lower case)
|
||||||
|
* - @c %[#]hhX - 1 byte int (2 hex digits, upper case)
|
||||||
|
* .
|
||||||
|
* If the optional # prefix is specified, the output will
|
||||||
|
* be prefixed with 0x (or 0X).
|
||||||
|
*
|
||||||
|
* - Other integers
|
||||||
|
* - @c %d - decimal int
|
||||||
|
* .
|
||||||
|
* Note that any width specification (e.g. the @c 02 in @c %02x)
|
||||||
|
* will be accepted but ignored.
|
||||||
|
*
|
||||||
|
* - Strings and characters
|
||||||
|
* - @c %c - char
|
||||||
|
* - @c %s - string
|
||||||
|
* - @c %m - error message text (i.e. strerror(errno))
|
||||||
|
*
|
||||||
|
* - Etherboot-specific specifiers
|
||||||
|
* - @c %@ - IP in ddd.ddd.ddd.ddd notation
|
||||||
|
* - @c %! - MAC address in xx:xx:xx:xx:xx:xx notation
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
Formats:
|
/**
|
||||||
%[#]x - 4 bytes int (8 hex digits, lower case)
|
* Write a formatted string to a buffer.
|
||||||
%[#]X - 4 bytes int (8 hex digits, upper case)
|
*
|
||||||
%[#]lx - 8 bytes long (16 hex digits, lower case)
|
* @v buf Buffer into which to write the string, or NULL
|
||||||
%[#]lX - 8 bytes long (16 hex digits, upper case)
|
* @v fmt Format string
|
||||||
%[#]hx - 2 bytes int (4 hex digits, lower case)
|
* @v args Arguments corresponding to the format string
|
||||||
%[#]hX - 2 bytes int (4 hex digits, upper case)
|
* @ret len Length of string written to buffer (if buf != NULL)
|
||||||
%[#]hhx - 1 byte int (2 hex digits, lower case)
|
* @ret 0 (if buf == NULL)
|
||||||
%[#]hhX - 1 byte int (2 hex digits, upper case)
|
* @err None
|
||||||
- optional # prefixes 0x or 0X
|
*
|
||||||
%d - decimal int
|
* If @c buf==NULL, then the string will be written to the console
|
||||||
%c - char
|
* directly using putchar().
|
||||||
%s - string
|
*
|
||||||
%m - string representation of the most recent error
|
*/
|
||||||
%@ - Internet address in ddd.ddd.ddd.ddd notation
|
|
||||||
%! - Ethernet address in xx:xx:xx:xx:xx:xx notation
|
|
||||||
Note: width specification ignored
|
|
||||||
**************************************************************************/
|
|
||||||
static int vsprintf(char *buf, const char *fmt, va_list args)
|
static int vsprintf(char *buf, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
|
@ -154,6 +184,20 @@ static int vsprintf(char *buf, const char *fmt, va_list args)
|
||||||
return (s - buf);
|
return (s - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a formatted string to a buffer.
|
||||||
|
*
|
||||||
|
* @v buf Buffer into which to write the string, or NULL
|
||||||
|
* @v fmt Format string
|
||||||
|
* @v ... Arguments corresponding to the format string
|
||||||
|
* @ret len Length of string written to buffer (if buf != NULL)
|
||||||
|
* @ret 0 (if buf == NULL)
|
||||||
|
* @err None
|
||||||
|
*
|
||||||
|
* If @c buf==NULL, then the string will be written to the console
|
||||||
|
* directly using putchar().
|
||||||
|
*
|
||||||
|
*/
|
||||||
int sprintf(char *buf, const char *fmt, ...)
|
int sprintf(char *buf, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -164,6 +208,15 @@ int sprintf(char *buf, const char *fmt, ...)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a formatted string to the console.
|
||||||
|
*
|
||||||
|
* @v fmt Format string
|
||||||
|
* @v ... Arguments corresponding to the format string
|
||||||
|
* @ret None
|
||||||
|
* @err None
|
||||||
|
*
|
||||||
|
*/
|
||||||
void printf(const char *fmt, ...)
|
void printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
Loading…
Reference in New Issue