memtest86+-5.01-no-C-headers.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. http://forum.canardpc.com/threads/110955-PATCH-don-t-pull-in-system-headers
  2. avoid using C library headers as it'd mean we'd need 32-bit glibc files available
  3. https://bugs.gentoo.org/592638
  4. --- a/dmi.c
  5. +++ b/dmi.c
  6. @@ -10,7 +10,7 @@
  7. #include "test.h"
  8. -#include <stdint.h>
  9. +#include "stdint.h"
  10. #define round_up(x,y) (((x) + (y) - 1) & ~((y)-1))
  11. --- a/test.c
  12. +++ b/test.c
  13. @@ -14,7 +14,28 @@
  14. #include "stdint.h"
  15. #include "cpuid.h"
  16. #include "smp.h"
  17. -#include <sys/io.h>
  18. +
  19. +static inline unsigned char
  20. +inb_p (unsigned short int __port)
  21. +{
  22. + unsigned char _v;
  23. +
  24. + __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
  25. + return _v;
  26. +}
  27. +
  28. +static inline void
  29. +outb (unsigned char __value, unsigned short int __port)
  30. +{
  31. + __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port));
  32. +}
  33. +
  34. +static inline void
  35. +outb_p (unsigned char __value, unsigned short int __port)
  36. +{
  37. + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value),
  38. + "Nd" (__port));
  39. +}
  40. extern struct cpu_ident cpu_id;
  41. extern volatile int mstr_cpu;