/apps/rmgr/include/flux/x86/pc/debug.h

http://github.com/l4ka/hazelnut · C Header · 69 lines · 29 code · 17 blank · 23 comment · 1 complexity · 20c595b1bec854839b9d9d14893edb7c MD5 · raw file

  1. /*
  2. * Copyright (c) 1995-1994 The University of Utah and
  3. * the Computer Systems Laboratory at the University of Utah (CSL).
  4. * All rights reserved.
  5. *
  6. * Permission to use, copy, modify and distribute this software is hereby
  7. * granted provided that (1) source code retains these copyright, permission,
  8. * and disclaimer notices, and (2) redistributions including binaries
  9. * reproduce the notices in supporting documentation, and (3) all advertising
  10. * materials mentioning features or use of this software display the following
  11. * acknowledgement: ``This product includes software developed by the
  12. * Computer Systems Laboratory at the University of Utah.''
  13. *
  14. * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
  15. * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
  16. * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  17. *
  18. * CSL requests users of this software to return to csl-dist@cs.utah.edu any
  19. * improvements that they make and grant CSL redistribution rights.
  20. */
  21. #ifndef _KUKM_I386_PC_DEBUG_H_
  22. #define _KUKM_I386_PC_DEBUG_H_
  23. #ifdef ASSEMBLER
  24. #ifdef DEBUG
  25. /* Poke a character directly onto the VGA text display,
  26. as a very quick, mostly-reliable status indicator.
  27. Assumes ss is a kernel data segment register. */
  28. #define POKE_STATUS(char,scratch) \
  29. ss/*XXX gas bug */ ;\
  30. movl %ss:_phys_mem_va,scratch ;\
  31. addl $0xb8000+80*2*13+40*2,scratch ;\
  32. movb char,%ss:(scratch) ;\
  33. movb $0xf0,%ss:1(scratch)
  34. #else !DEBUG
  35. #define POKE_STATUS(char,scratch)
  36. #endif !DEBUG
  37. #else !ASSEMBLER
  38. #ifdef DEBUG
  39. #include <mach/machine/vm_types.h>
  40. #define POKE_STATUS(string) \
  41. ({ unsigned char *s = (string); \
  42. extern vm_offset_t phys_mem_va; \
  43. short *d = (short*)(phys_mem_va+0xb8000+80*2*13+40*2); \
  44. while (*s) { (*d++) = 0x3000 | (*s++); } \
  45. *d = ' '; \
  46. })
  47. #else !DEBUG
  48. #define POKE_STATUS(char)
  49. #endif !DEBUG
  50. #endif !ASSEMBLER
  51. #include_next "debug.h"
  52. #endif _KUKM_I386_PC_DEBUG_H_