Calltable or interrupt?
Calltable or interrupt?
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
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 )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
How would you do system calls with a call table in protected mode? Would you run everything in ring 0? Or are you talking about call gates or something...?
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
Re: Calltable or interrupt?
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.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
Hi,Colonel Kernel wrote:How would you do system calls with a call table in protected mode? Would you run everything in ring 0? Or are you talking about call gates or something...?
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
...
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 )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
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
hmm..I think I just swayed myself away from interrupts..lol
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
}
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:
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
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]
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
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.Colonel Kernel wrote:How would you do system calls with a call table in protected mode? Would you run everything in ring 0? Or are you talking about call gates or something...?
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
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.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.
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
Okay,
the system interrupt has won.
inflater
the system interrupt has won.
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )