0

In DOSBOX XINU operating system; I want to count number of interrupts handlers that occurred in x time. Is there a global variable to be referenced to?

I think in the header IO.H,

extern  int nmaps;      /* number of active intmap entries  */

since the struct intmaps saves data about every INT in vector table

is responsible for it?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    There might not be such a variable. – fuz Dec 12 '22 at 19:44
  • @fuz guess I have to implement my own counter? – Mostfa Mostfa Dec 12 '22 at 19:58
  • Probably. You'll have to intercept all interrupts and increment the counter before passing control to the real interrupt handler. This may conflict with other programs and OS parts that try to intercept interrupt handlers so may not be possible. – fuz Dec 12 '22 at 20:00
  • After some asm code, the code calls `int_dispatch` in `system/evec.c`. You could add a counter array (e.g. `int32 int_count[MAX_EXT_IRQS];`) as a global. Then, in `int_dispatch`, do: `int_count[inum-IRQBASE] += 1;` after the `ient = &int_actions[inum-IRQBASE];` line. – Craig Estey Dec 13 '22 at 03:44
  • @CraigEstey unfortunately, I don't have the version of xinu with file evec.c I am using the version of XINU4WIN. To my knowledge, the INTs go through the asm file INTMAP.asm – Mostfa Mostfa Dec 13 '22 at 06:27
  • I pulled the galileo version. The xinu home page doesn't seem to list "XINU4WIN". What is the URL to the source for this? – Craig Estey Dec 13 '22 at 15:48
  • @CraigEstey https://drive.google.com/file/d/1pL-_w5ImdrjolhCH5RAzRZurrX-weJZP/view?usp=share_link had to upload it – Mostfa Mostfa Dec 14 '22 at 06:20
  • Find a better version of xinu. Originally, I was looking at the galileo version from the website. But, I extracted the source from xinu4win.exe from your gdrive link. The C code is so _ancient_ that it uses K&R prototypes instead of ANSI. K&R prototypes have been deprecated for 30 years. Note that galileo has modern ANSI prototypes. What is your purpose in all this? To learn about OS design? There are better ways. – Craig Estey Dec 14 '22 at 16:18
  • @CraigEstey I know its bad trust me but its educational for my university – Mostfa Mostfa Dec 14 '22 at 17:24
  • If they're giving you this version, find a better university. Find a xinu version that can run under `qemu` or consider using `xv6`. They are well supported. I do kernel work, and what you have is so crappy that you won't learn much. There are many embedded kernels, such as `FreeRTOS` that are [much] better choices. The xinu version you have appears to run under "real mode" (i.e. 8086). This is 40 years out of date. Why is your university not using something from the official xinu website: https://xinu.cs.purdue.edu/ ??? It has a version that runs under `VirtualBox`--a much better way. – Craig Estey Dec 14 '22 at 17:43
  • Many universities have you write and boot an OS from scratch and run it under `qemu`. (e.g.) See my answer: [How can I fix my VBE implementation for my OS?](https://stackoverflow.com/a/73102809/5382650) It boots in real mode, but then quickly [and easily] switches to 32 bit virtual mode in the first few instructions. – Craig Estey Dec 14 '22 at 17:48

0 Answers0