X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Futil.h;h=ce43bbe125eb537bd56522c9f44588b36ee07f12;hb=7cffbf057545fb303ad8f53e432ef42f7708e16d;hp=6d200b7824f14dbcff470db501150d193d6b7920;hpb=8c475e1fd504f46cbb8a882e760714925c012890;p=dosdemo diff --git a/src/util.h b/src/util.h index 6d200b7..ce43bbe 100644 --- a/src/util.h +++ b/src/util.h @@ -5,12 +5,15 @@ #ifdef __GNUC__ #define INLINE __inline +#define PACKED __attribute__((packed)) #elif defined(__WATCOMC__) #define INLINE __inline +#define PACKED #else #define INLINE +#define PACKED #endif /* fast conversion of double -> 32bit int @@ -43,6 +46,12 @@ void perf_end(void); "sub eax, [perf_start_count]" \ "mov [perf_interval_count], eax" \ modify [eax ebx ecx edx]; + +void debug_break(void); +#pragma aux debug_break = "int 3"; + +void halt(void); +#pragma aux halt = "hlt"; #endif #ifdef __GNUC__ @@ -63,6 +72,12 @@ void perf_end(void); : "=m"(perf_interval_count) \ : "m"(perf_start_count) \ : "%eax", "%ebx", "%ecx", "%edx") + +#define debug_break() \ + asm volatile ("int $3") + +#define halt() \ + asm volatile("hlt") #endif #ifdef _MSC_VER @@ -86,6 +101,11 @@ void perf_end(void); mov [perf_interval_count], eax \ } \ } while(0) + +#define debug_break() \ + do { \ + __asm { int 3 } \ + } while(0) #endif #endif /* UTIL_H_ */