Hi.I'm newbie in assembly and i must say i'm a little confused...
What i can't really underestand is the difference between system calls and
interrupts..To be more specific...

What i know about interrupts,is that they're generated by hardware.Then
spim(i'm using mips simulator) jumps to a specific adress,somehow (I guess by looking the cause register) recognizes the type
of interrupt and jumps to the right interrupt handler routine.(ok,it does some more stuff...)
1)Has the operating system anything to do with all these things?
2)I guess that the interrupt handler routines are placed somewhere in memory...Do these routines "belong" to the
Operating system,or they're somehow related to bios?
3)Are those routines "processor dependent"?

Now, i'm giving a little example in order for you to underestand my confusion between system calls and interrupts..

As i said,What i'm using now,is spim,mip's simulator.Spim uses a memory-mapped
i/o...what i know,is that there are two differentt ways to output a character to the
screen.
1)You can either put the character directly into the transmitter (0x0ffff... adress or something like that),
or..
2)you can put the right number(system call number or interrupt number?) into v0 register and call "syscall"...

Could someone please explain to me what happens in both cases?

I'd be grateful if you answered me.
Thanks a lot.
Posted on 2004-03-23 18:49:04 by entma
System calls are defined by the operating system. How parameters are passed, and what instructions to use are all defined by the OS. The same processor may use different methods for different OS's.

System calls can be implemented as software interrupts, subroutines, or use instructions with special names (such as trap, supervisor call, etc.)

=====

Interrupt handlers can belong to anyone. It all depends on how much of the interrupt capability is managed by the OS. The OS can manage all, some, or none of the interrupts.
Posted on 2004-03-24 01:40:13 by tenkey

Hi.I'm newbie in assembly and i must say i'm a little confused...
What i can't really underestand is the difference between system calls and
interrupts..To be more specific...

a pure interrupt is the cpu responding to a signal on a pin of the cpu (like the hardware saying to the cpu hay I have something from the keyboard for you to look at )

What i know about interrupts,is that they're generated by hardware.Then
spim(i'm using mips simulator) jumps to a specific adress,somehow (I guess by looking the cause register) recognizes the type
of interrupt and jumps to the right interrupt handler routine.(ok,it does some more stuff...)

It's a call not a jump so it saves the address of where it was when the intrrupt occred things like saveingand restoring the state of the CPU are done by the interrupt handler

1)Has the operating system anything to do with all these things?

a sys call is a call to code in the O/S

2)I guess that the interrupt handler routines are placed somewhere in memory...Do these routines "belong" to the
Operating system,or they're somehow related to bios?

both BIOS calls use the INT instruction and some fallow the same format as a syscall

3)Are those routines "processor dependent"?

Very much so as the code called to carry out the call is machine code

Now, i'm giving a little example in order for you to underestand my confusion between system calls and interrupts..

As i said,What i'm using now,is spim,mip's simulator.Spim uses a memory-mapped
i/o...what i know,is that there are two differentt ways to output a character to the
screen.
1)You can either put the character directly into the transmitter (0x0ffff... adress or something like that),
or..
2)you can put the right number(system call number or interrupt number?) into v0 register and call "syscall"...

Could someone please explain to me what happens in both cases?

I'd be grateful if you answered me.
Thanks a lot.
Posted on 2004-03-24 13:11:43 by rob.rice
Thanks a lot for your answers guys.Ireally appreciate it.:)
Posted on 2004-03-24 14:29:11 by entma
I don't know anything about MIPS, but on most computers there are at least 2 types of interrupts. Hardware interrupts caused by things like I/O devices, and software interrupts normally used by applications to talk to the OS.

When you first turn on a PC, it contains a table of addresss that point to routines to handle each interrupt. Many of these just point to a RET after power on. Those that are used, like video and the keyboard, point to routines in the BIOS.

When the OS loads it changes parts of this table to point to OS routines to handle interrupts. Depending on the OS, it may or may not change some of the original BIOS pointers.

An IBM mainframe uses the SVC intruction to request a software interrupt, just like the INT on an x86. But the interrupt processing is a little different. It simply stores the current PSW at a fixed location, and loads a new PSW from another fixed location. The PSW is a 64 bit word, kinda like a combination of the x86 IP and FLAGS, plus an interrupt code and other stuff. The new PSW points to the handle interrupt routine, and when it's done it may load the old PSW to continue where it left off, or perhaps save it and do a task switch, if a higher priority program can run due to the processed interrupt... ... ...

:)
Posted on 2004-03-24 22:52:19 by S/390