我试图在Linux上使用程序集(x86)获取当前日期。我写了以下程序:
[BITS 32]
%assign SYS_GETTIMEOFDAY 78
[SECTION .text]
[GLOBAL _start]
_start:
;get the system date
mov dword eax, SYS_GETTIMEOFDAY
int byte 0x80
test eax, eax
js error
done:
convert
error:
whatever
我希望在ebx上获得tv结构地址,这样我就可以访问0(%ebx)中的secs和4(%ebx)中的microsecs,但是在调试代码后我得到$ ebx = 0x0。为什么呢?
答案 0 :(得分:3)
你已经倒退了。而不是期望内核通过ebx给你struct timeval *
,你应该给内核一个,它会修改它。