Commit dd3587f38e5c0745896da6b7b058d0f88fff86a0
1 parent
7d83131c
iret and popl (%esp) tests
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@264 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
35 additions
and
0 deletions
tests/test-i386-code16.S
| ... | ... | @@ -77,4 +77,21 @@ myfunc2: |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | code16_end: |
| 80 | + | |
| 81 | + | |
| 82 | +/* other 32 bits tests */ | |
| 83 | + .code32 | |
| 84 | + | |
| 85 | + .globl func_lret32 | |
| 86 | +func_lret32: | |
| 87 | + movl $0x87654321, %eax | |
| 88 | + lret | |
| 89 | + | |
| 90 | + .globl func_iret32 | |
| 91 | +func_iret32: | |
| 92 | + movl $0xabcd4321, %eax | |
| 93 | + iret | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 80 | 97 | |
| 81 | 98 | \ No newline at end of file | ... | ... |
tests/test-i386.c
| ... | ... | @@ -937,6 +937,9 @@ void test_code16(void) |
| 937 | 937 | printf("func3() = 0x%08x\n", res); |
| 938 | 938 | } |
| 939 | 939 | |
| 940 | +extern char func_lret32; | |
| 941 | +extern char func_iret32; | |
| 942 | + | |
| 940 | 943 | void test_misc(void) |
| 941 | 944 | { |
| 942 | 945 | char table[256]; |
| ... | ... | @@ -946,6 +949,21 @@ void test_misc(void) |
| 946 | 949 | res = 0x12345678; |
| 947 | 950 | asm ("xlat" : "=a" (res) : "b" (table), "0" (res)); |
| 948 | 951 | printf("xlat: EAX=%08x\n", res); |
| 952 | + | |
| 953 | + asm volatile ("pushl %%cs ; call %1" | |
| 954 | + : "=a" (res) | |
| 955 | + : "m" (func_lret32): "memory", "cc"); | |
| 956 | + printf("func_lret32=%x\n", res); | |
| 957 | + | |
| 958 | + asm volatile ("pushfl ; pushl %%cs ; call %1" | |
| 959 | + : "=a" (res) | |
| 960 | + : "m" (func_iret32): "memory", "cc"); | |
| 961 | + printf("func_iret32=%x\n", res); | |
| 962 | + | |
| 963 | + /* specific popl test */ | |
| 964 | + asm volatile ("pushl $12345432 ; pushl $0x9abcdef ; popl (%%esp) ; popl %0" | |
| 965 | + : "=g" (res)); | |
| 966 | + printf("popl esp=%x\n", res); | |
| 949 | 967 | } |
| 950 | 968 | |
| 951 | 969 | uint8_t str_buffer[4096]; | ... | ... |