⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 call-rt-st.c

📁 这个是LINUX下的GDB调度工具的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
#include <stdio.h>#include <stdlib.h>#include <string.h>/************************************************************************** * TESTS : * function returning large structures, which go on the stack * functions returning varied sized structs which go on in the registers. ***************************************************************************//* A large structure (> 64 bits) used to test passing large structures as * parameters */struct array_rep_info_t {   int   next_index[10];    int   values[10];   int   head;};/***************************************************************************** * Small structures ( <= 64 bits). These are used to test passing small  * structures as parameters and test argument size promotion. *****************************************************************************/ /* 64 bits  */struct small_rep_info_t {   int   value;   int   head;};/* 6 bits : really fits in 8 bits and is promoted to 8 bits */struct bit_flags_char_t {       unsigned char alpha   :1;       unsigned char beta    :1;       unsigned char gamma   :1;       unsigned char delta   :1;       unsigned char epsilon :1;       unsigned char omega   :1;};/* 6 bits : really fits in 8 bits and is promoted to 16 bits */struct bit_flags_short_t {       unsigned short alpha   :1;       unsigned short beta    :1;       unsigned short gamma   :1;       unsigned short delta   :1;       unsigned short epsilon :1;       unsigned short omega   :1;};/* 6 bits : really fits in 8 bits and is promoted to 32 bits */struct bit_flags_t {       unsigned alpha   :1;       unsigned beta    :1;       unsigned gamma   :1;       unsigned delta   :1;       unsigned epsilon :1;       unsigned omega   :1;};/* 22 bits : really fits in 40 bits and is promoted to 64 bits */struct bit_flags_combo_t {       unsigned alpha   :1;       unsigned beta    :1;       char     ch1;       unsigned gamma   :1;       unsigned delta   :1;       char     ch2;       unsigned epsilon :1;       unsigned omega   :1;};/* 64 bits */struct one_double_t {       double double1;};/* 64 bits */struct two_floats_t {       float float1;       float float2;};/* 24 bits : promoted to 32 bits */struct three_char_t {       char ch1;       char ch2;       char ch3;};/* 40 bits : promoted to 64 bits */struct five_char_t {       char ch1;       char ch2;       char ch3;       char ch4;       char ch5;};/* 40 bits : promoted to 64 bits */struct int_char_combo_t {       int  int1;       char ch1;};/***************************************************************** * LOOP_COUNT :  * A do nothing function. Used to provide a point at which calls can be made.   *****************************************************************/void loop_count () {     int index;     for (index=0; index<4; index++);}/***************************************************************** * INIT_BIT_FLAGS_CHAR : * Initializes a bit_flags_char_t structure. Can call this function see * the call command behavior when integer arguments do not fit into * registers and must be placed on the stack. * OUT struct bit_flags_char_t *bit_flags -- structure to be filled * IN  unsigned a  -- 0 or 1  * IN  unsigned b  -- 0 or 1  * IN  unsigned g  -- 0 or 1  * IN  unsigned d  -- 0 or 1  * IN  unsigned e  -- 0 or 1  * IN  unsigned o  -- 0 or 1  *****************************************************************/#ifdef PROTOTYPESvoid init_bit_flags_char (struct bit_flags_char_t *bit_flags,unsigned a,unsigned b,unsigned g,unsigned d,unsigned e,unsigned o)#elsevoid init_bit_flags_char (bit_flags,a,b,g,d,e,o) struct bit_flags_char_t *bit_flags;unsigned a;unsigned b;unsigned g;unsigned d;unsigned e;unsigned o; #endif{   bit_flags->alpha = a;   bit_flags->beta = b;   bit_flags->gamma = g;   bit_flags->delta = d;   bit_flags->epsilon = e;   bit_flags->omega = o;}/***************************************************************** * INIT_BIT_FLAGS_SHORT : * Initializes a bit_flags_short_t structure. Can call this function see * the call command behavior when integer arguments do not fit into * registers and must be placed on the stack. * OUT struct bit_flags_short_t *bit_flags -- structure to be filled * IN  unsigned a  -- 0 or 1  * IN  unsigned b  -- 0 or 1  * IN  unsigned g  -- 0 or 1  * IN  unsigned d  -- 0 or 1  * IN  unsigned e  -- 0 or 1  * IN  unsigned o  -- 0 or 1  *****************************************************************/#ifdef PROTOTYPESvoid init_bit_flags_short (struct bit_flags_short_t *bit_flags,unsigned a,unsigned b,unsigned g,unsigned d,unsigned e,unsigned o)#elsevoid init_bit_flags_short (bit_flags,a,b,g,d,e,o) struct bit_flags_short_t *bit_flags;unsigned a;unsigned b;unsigned g;unsigned d;unsigned e;unsigned o; #endif{   bit_flags->alpha = a;   bit_flags->beta = b;   bit_flags->gamma = g;   bit_flags->delta = d;   bit_flags->epsilon = e;   bit_flags->omega = o;}/***************************************************************** * INIT_BIT_FLAGS : * Initializes a bit_flags_t structure. Can call this function see * the call command behavior when integer arguments do not fit into * registers and must be placed on the stack. * OUT struct bit_flags_t *bit_flags -- structure to be filled * IN  unsigned a  -- 0 or 1  * IN  unsigned b  -- 0 or 1  * IN  unsigned g  -- 0 or 1  * IN  unsigned d  -- 0 or 1  * IN  unsigned e  -- 0 or 1  * IN  unsigned o  -- 0 or 1  *****************************************************************/#ifdef PROTOTYPESvoid init_bit_flags (struct bit_flags_t *bit_flags,unsigned a,unsigned b,unsigned g,unsigned d,unsigned e,unsigned o)#elsevoid init_bit_flags (bit_flags,a,b,g,d,e,o) struct bit_flags_t *bit_flags;unsigned a;unsigned b;unsigned g;unsigned d;unsigned e;unsigned o; #endif{   bit_flags->alpha = a;   bit_flags->beta = b;   bit_flags->gamma = g;   bit_flags->delta = d;   bit_flags->epsilon = e;   bit_flags->omega = o;}/***************************************************************** * INIT_BIT_FLAGS_COMBO : * Initializes a bit_flags_combo_t structure. Can call this function * to see the call command behavior when integer and character arguments * do not fit into registers and must be placed on the stack. * OUT struct bit_flags_combo_t *bit_flags_combo -- structure to fill * IN  unsigned a  -- 0 or 1  * IN  unsigned b  -- 0 or 1  * IN  char     ch1 * IN  unsigned g  -- 0 or 1  * IN  unsigned d  -- 0 or 1  * IN  char     ch2 * IN  unsigned e  -- 0 or 1  * IN  unsigned o  -- 0 or 1  *****************************************************************/#ifdef PROTOTYPESvoid init_bit_flags_combo (struct bit_flags_combo_t *bit_flags_combo,unsigned a,unsigned b,char ch1,unsigned g,unsigned d,char ch2,unsigned e,unsigned o)#elsevoid init_bit_flags_combo (bit_flags_combo, a, b, ch1, g, d, ch2, e, o)struct bit_flags_combo_t *bit_flags_combo;unsigned a;unsigned b;char ch1;unsigned g;unsigned d;char ch2;unsigned e;unsigned o;#endif{   bit_flags_combo->alpha = a;   bit_flags_combo->beta = b;   bit_flags_combo->ch1 = ch1;   bit_flags_combo->gamma = g;   bit_flags_combo->delta = d;   bit_flags_combo->ch2 = ch2;   bit_flags_combo->epsilon = e;   bit_flags_combo->omega = o;}/***************************************************************** * INIT_ONE_DOUBLE :  * OUT  struct one_double_t *one_double  -- structure to fill  * IN   double init_val *****************************************************************/#ifdef PROTOTYPESvoid init_one_double ( struct one_double_t *one_double, double init_val)#elsevoid init_one_double (one_double, init_val)struct one_double_t *one_double; double init_val;#endif{     one_double->double1  = init_val;}/***************************************************************** * INIT_TWO_FLOATS :  * OUT struct two_floats_t *two_floats -- structure to be filled * IN  float init_val1  * IN  float init_val2  *****************************************************************/#ifdef PROTOTYPESvoid init_two_floats (     struct two_floats_t *two_floats,     float init_val1,     float init_val2)#elsevoid init_two_floats (two_floats, init_val1, init_val2)struct two_floats_t *two_floats;float init_val1;float init_val2;#endif{     two_floats->float1 = init_val1;     two_floats->float2 = init_val2;}/***************************************************************** * INIT_THREE_CHARS :  * OUT struct three_char_t *three_char -- structure to be filled * IN  char init_val1  * IN  char init_val2  * IN  char init_val3  *****************************************************************/#ifdef PROTOTYPESvoid init_three_chars (struct three_char_t *three_char,char init_val1,char init_val2,char init_val3)#elsevoid init_three_chars ( three_char, init_val1, init_val2, init_val3)struct three_char_t *three_char;char init_val1;char init_val2;char init_val3;#endif{     three_char->ch1 = init_val1;     three_char->ch2 = init_val2;     three_char->ch3 = init_val3;}/***************************************************************** * INIT_FIVE_CHARS :  * OUT struct five_char_t *five_char -- structure to be filled * IN  char init_val1  * IN  char init_val2  * IN  char init_val3  * IN  char init_val4  * IN  char init_val5  *****************************************************************/#ifdef PROTOTYPESvoid init_five_chars (struct five_char_t *five_char,char init_val1,char init_val2,char init_val3,char init_val4,char init_val5)#elsevoid init_five_chars ( five_char, init_val1, init_val2, init_val3, init_val4, init_val5)struct five_char_t *five_char;char init_val1;char init_val2;char init_val3;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -