/[qemu]/qemu/tests/test-i386.c
ViewVC logotype

Diff of /qemu/tests/test-i386.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39 by bellard, Sun Aug 15 14:47:30 2004 UTC revision 1.40 by bellard, Sun Nov 14 15:39:16 2004 UTC
# Line 1625  void test_self_modifying_code(void) Line 1625  void test_self_modifying_code(void)
1625          printf("smc_code2(%d) = %d\n", i, smc_code2(i));          printf("smc_code2(%d) = %d\n", i, smc_code2(i));
1626      }      }
1627  }  }
1628        
1629    int enter_stack[4096];
1630    
1631    #define TEST_ENTER(size, stack_type, level)\
1632    {\
1633        int esp_save, esp_val, ebp_val, ebp_save, i;\
1634        stack_type *ptr, *stack_end, *stack_ptr;\
1635        memset(enter_stack, 0, sizeof(enter_stack));\
1636        stack_end = stack_ptr = (stack_type *)(enter_stack + 4096);\
1637        ebp_val = (long)stack_ptr;\
1638        for(i=1;i<=32;i++)\
1639           *--stack_ptr = i;\
1640        esp_val = (long)stack_ptr;\
1641        asm("movl %%esp, %[esp_save]\n"\
1642            "movl %%ebp, %[ebp_save]\n"\
1643            "movl %[esp_val], %%esp\n"\
1644            "movl %[ebp_val], %%ebp\n"\
1645            "enter" size " $12, $" #level "\n"\
1646            "movl %%esp, %[esp_val]\n"\
1647            "movl %%ebp, %[ebp_val]\n"\
1648            "movl %[esp_save], %%esp\n"\
1649            "movl %[ebp_save], %%ebp\n"\
1650            : [esp_save] "=r" (esp_save),\
1651            [ebp_save] "=r" (ebp_save),\
1652            [esp_val] "=r" (esp_val),\
1653            [ebp_val] "=r" (ebp_val)\
1654            :  "[esp_val]" (esp_val),\
1655            "[ebp_val]" (ebp_val));\
1656        printf("level=%d:\n", level);\
1657        printf("esp_val=0x%08lx\n", esp_val - (long)stack_end);\
1658        printf("ebp_val=0x%08lx\n", ebp_val - (long)stack_end);\
1659        for(ptr = (stack_type *)esp_val; ptr < stack_end; ptr++)\
1660            printf("%08x\n", ptr[0]);\
1661    }
1662    
1663    static void test_enter(void)
1664    {
1665        TEST_ENTER("l", uint32_t, 0);
1666        TEST_ENTER("l", uint32_t, 1);
1667        TEST_ENTER("l", uint32_t, 2);
1668        TEST_ENTER("l", uint32_t, 31);
1669    
1670        TEST_ENTER("w", uint16_t, 0);
1671        TEST_ENTER("w", uint16_t, 1);
1672        TEST_ENTER("w", uint16_t, 2);
1673        TEST_ENTER("w", uint16_t, 31);
1674    }
1675    
1676    
1677  static void *call_end __init_call = NULL;  static void *call_end __init_call = NULL;
1678    
1679  int main(int argc, char **argv)  int main(int argc, char **argv)
# Line 1653  int main(int argc, char **argv) Line 1701  int main(int argc, char **argv)
1701      test_exceptions();      test_exceptions();
1702      test_self_modifying_code();      test_self_modifying_code();
1703      test_single_step();      test_single_step();
1704        test_enter();
1705      return 0;      return 0;
1706  }  }

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26