Page 1 of 1

Calltable or interrupt?

Posted: Sun Jun 03, 2007 11:46 am
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

Posted: Sun Jun 03, 2007 12:21 pm
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...?

Re: Calltable or interrupt?

Posted: Sun Jun 03, 2007 12:38 pm
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.

Posted: Mon Jun 04, 2007 5:28 am
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

Posted: Mon Jun 04, 2007 11:12 am
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

Posted: Mon Jun 04, 2007 11:31 am
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

Posted: Tue Jun 05, 2007 1:40 am
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.

Posted: Tue Jun 05, 2007 8:36 am
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.

Posted: Sat Jun 09, 2007 2:47 am
by inflater
Okay,
the system interrupt has won. :)

inflater