It is my first time to see that when I push a value on the stack, the stack is still empty.
I have thought maybe it is the kernel panic, so that i have added cli ; cld
before calling the function but nothing.
The example is when I want to call function, there the function is called memset :
eflags 0x6 [ IOPL=0 PF ]
│ 0xf0100d6a <mem_init+172> cli │
│ 0xf0100d6b <mem_init+173> cld │
│ 0xf0100d6c <mem_init+174> sub esp,0x4 │
│ 0xf0100d6f <mem_init+177> mov eax,DWORD PTR [edi+0x1fb8] │
│ 0xf0100d75 <mem_init+183> shl eax,0x3 │
│ 0xf0100d78 <mem_init+186> push eax │
│ 0xf0100d79 <mem_init+187> push 0x0 │
│ 0xf0100d7b <mem_init+189> push DWORD PTR [edi+0x1fb0] │
│ >0xf0100d81 <mem_init+195> call 0xf010234b <memset>
(gdb) p $esp
$1 = (void *) 0xf00d1f8c
(gdb) stepi
=> 0xf0100d78 <mem_init+186>: push eax
=> 0xf0100d79 <mem_init+187>: push 0x0
=> 0xf0100d7b <mem_init+189>: push DWORD PTR [edi+0x1fb0]
=> 0xf0100d81 <mem_init+195>: call 0xf010234b <memset>
(gdb) p $esp
$2 = (void *) 0xf00d1f80
(gdb) x/4w $esp
0xf00d1f80: 0x00000000 0x00000000 0x00000000 0x00000000
(gdb)
there is the C code :
asm("cli ; cld") ;
memset((void*) pages , 0 , (size_t)(sizeof(*pages)*npages) );
Can you tell me where I have made mistake ?? Is it Stack-Segment Fault that occurs??