Calltable or interrupt?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply

What is better to have as a function list in a pmode OS?

Call-table as a include file
8
42%
System interrupt, like from real mode (INT)
11
58%
 
Total votes: 19

User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Calltable or interrupt?

Post by inflater »

Greetings,
I am converting PortixOS to 32-bit protected mode. It will be programmed in pure ASM. As of I abandoned RSFS and put back FAT12/FAT16, I got an idea about self hosting. This reminded me of good ol' real mode and TextLiner OS. So, when my OS (in protected mode now!) will have self-hosting, what would you prefer for creating programs? A include file with call table, or a documentation about system interrupt, INT 30h? What is better? I am gonna ask professionals - YOU. :)

inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post by Colonel Kernel »

How would you do system calls with a call table in protected mode? Would you run everything in ring 0? :shock: Or are you talking about call gates or something...?
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: Calltable or interrupt?

Post by Candy »

inflater wrote:Greetings,
I am converting PortixOS to 32-bit protected mode. It will be programmed in pure ASM. As of I abandoned RSFS and put back FAT12/FAT16, I got an idea about self hosting. This reminded me of good ol' real mode and TextLiner OS. So, when my OS (in protected mode now!) will have self-hosting, what would you prefer for creating programs? A include file with call table, or a documentation about system interrupt, INT 30h? What is better? I am gonna ask professionals - YOU. :)

inflater
In creating the call functions, they in turn call INT30 for you. It's by definition a wrapper, something that performs the same function but with less of a hassle about things you don't care about, and easier modification and setting of things you do care about.
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Colonel Kernel wrote:How would you do system calls with a call table in protected mode? Would you run everything in ring 0? :shock: Or are you talking about call gates or something...?
Hi,
i don't know how to say it right,but I mean this as a call table in ASM:

Code: Select all

;PortixOS.INC

PrintStr resd 1 
WaitKey resd 1
Keypressed resd 1 
Shutdown resd 1
...
This calltable is included in every FASM PortixOS program and loaded run-time.
Or you just prefer PDF or wiki or HTML or ...,documentation about the system INT? Like

AH=04h - print string in ES:ESI
AH=05h - reboot

?:-) What do you prefer more? :)
@Colonel: My system is singletasking at present...

Regards,
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

My vote is with interrupts..there no nearly as easy to use from a highlevel enviroment though..

for calltables, there pretty easy to do in C natively like

Code: Select all

typedef struct{
  void (*print_func)(char *);
  char (*getc)(void);
}OS_calltable
__attribute__((packed));

OS_calltable calltable=CALLTABLE_BASE_ADDRESS;

void main(){
  calltable.print_func("Hi there!!\n");
  char=calltable.getc(); //get a char
}

hmm..I think I just swayed myself away from interrupts..lol
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

I wrote that post using a mobile phone, small keyboard and GPRS connection. So I will explain it more to be understandable:

If you want to use "PortixOS API" (when programming in 32-bit ASM now!), you must insert following line:

include PortixOS.inc

into the code, and load the calltable to memory by using preddefined basic OS interrupt INT 40h, AH=(lets say) 0Ah. And then you can use something like this:

Code: Select all

mov esi,HelloWorldStr
call [PrintString]
mov eax,1
call [Shutdown]
We will see the results of the vote. I am now working on the "PortixOS programming reference" in PDF that explains the INT 30h, the main sys interrupt. If the vote for interrupts will win in the next 5 days, i will cancel the call table. :)

inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
crackers
Member
Member
Posts: 27
Joined: Wed Nov 15, 2006 6:31 am

Post by crackers »

Colonel Kernel wrote:How would you do system calls with a call table in protected mode? Would you run everything in ring 0? :shock: Or are you talking about call gates or something...?
Well I think it can be done by creating system task with many threads responsible for doing what was 'ordered' by user program. So program is calling system function which is telling system task to do something (for example read data from COM port). This way it's quite easy to do blocking and non blocking calls and there is no situation in which one task is taking all system time by constantly calling system functions.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post by Colonel Kernel »

crackers wrote:Well I think it can be done by creating system task with many threads responsible for doing what was 'ordered' by user program. So program is calling system function which is telling system task to do something (for example read data from COM port). This way it's quite easy to do blocking and non blocking calls and there is no situation in which one task is taking all system time by constantly calling system functions.
My question was based on the assumption that inflater was planning to use ring 3 for programs and ring 0 for the kernel. In that situation direct function calls between rings wouldn't be allowed (this is what I assumed "call table" meant). But since that's not the case, I guess just about any mechanism will do.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Okay,
the system interrupt has won. :)

inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
Post Reply