Illegal instructions in console interrupt.

55 views
Skip to first unread message

faraz khan

unread,
Nov 13, 2020, 10:05:14 AM11/13/20
to XOS Users
Dear sir,
In stage 16 my console interrupt always encounter an illegal instruction after execution of 10 instructions(always same), irrespective of the previous instructions. The illegal instruction seen while debugging as next instruction looks like some junk value and not from original code.  
 I even tried to jump to an instruction after the 10th instruction but all the instruction after that are changed too. 



debug.pngdebug2.png

faraz khan

unread,
Nov 13, 2020, 10:08:10 AM11/13/20
to XOS Users
Code for interrupt
'conint.xsm' is the console interrupt. The assignment instructions repeated in the beginning were put to verify if it happened for any instructions.
'gcd.txt' is the program that requires the console input (PID 3). 
conint.txt
gcd.txt

ishan ghosh

unread,
Nov 16, 2020, 7:45:00 AM11/16/20
to XOS Users
There seems to be an empty line in conint.txt can you try removing the space. I think you might have a label there and it's removing the label but not the newline.

Asif Nassar

unread,
Nov 20, 2020, 2:18:21 AM11/20/20
to xos-...@googlegroups.com
Hi,

Hope you have found and corrected the bug. If not, I think you will find this helpful. I am listing one reason for such a bug to occur. I'm not sure if there are more. As per my understanding, this can be caused when the XSM machine uses the page allocated for console interrupt (page 8) as the kernel stack. Thus, overwriting its contents when doing a "PUSH". This can happen in 2 cases (I experienced these 2, there could be more):

1. When you don't change the stack from user stack to kernel stack upon entering any interrupt. This means that SP is still pointing to some address between 4096 and 9*512-1, which in kernel mode, is the address within the console interrupt.

2. When you have cleared the page table initialisation and process table initialisation of a process and accidentally forgot to set its STATE to TERMINATED (PID=2 in my case). The explanation to this is something which I don't understand now but this was a cause.

You could check these 2, although I'm not sure whether these could be the only reasons for that bug to occur.
Reply all
Reply to author
Forward
0 new messages