i've a problem with the stack.
my code works fine if the interrupt() function returns the esp it takes as a parameter, but i got [CPU ] can_push(): expand-down: esp-N < limit when i return my own stack.
i can't figure what's wrong, can any body help me ?
here is my code
Code: Select all
isr20h:
irq0:
pusha
push gs
push fs
push es
push ds
mov ax, 10h
mov gs, ax
mov fs, ax
mov es, ax
mov ds, ax
push dword 00h
push dword 20h
push dword esp
call interrupt
mov esp, eax
mov al, 20h
out 20h, al
add esp, 08h
pop ds
pop es
pop fs
pop gs
popa
iret
Code: Select all
int stack[87];
main()
{
stack[70]=0x28;
stack[71]=0xfffffffe;
stack[72]=0x0202;
stack[73]=0x18;
stack[74]=(int)test;
stack[75]=0;
stack[76]=0;
stack[77]=0;
stack[78]=0;
stack[79]=0;
stack[80]=0;
stack[81]=0;
stack[82]=0xfe;
stack[83]=0x20;
stack[84]=0x20;
stack[85]=0x20;
stack[86]=0x20;
for(;;);
Code: Select all
int interrupt(int esp, int num, int err)
{
int *p;
p=&stack;
p+=87;
return (int)p;
}
Code: Select all
void test()
{
kprint('T');
}