amiga.org
     
iconAll times are GMT -6. The time now is 01:36 PM. | Welcome to Forum, please register to access all of our features.

» Amiga.org » Operating System Specific Discussions » Amiga OS » Amiga OS -- Development » Exec exception handling and a time interval implementation...

Amiga OS -- Development This particular forum deals with issues regarding development for all versions of AmigaOS.

Reply
 
Thread Tools Display Modes
Old 06-09-2006, 03:41 AM   #16
RWO
Beginner
Points: 4,635, Level: 43 Points: 4,635, Level: 43 Points: 4,635, Level: 43
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2003
Posts: 30
Send a message via ICQ to RWO
Default Re: Exec exception handling and a time interval implementation...

@Piru

Whouldent you get in trouble if a 68k application used that tick and ended up is a PPC code function.

I can imagine that the Emulator jumping from a 68k function to another 68k function, but crossing over whould lead into trouble.

RWO
__________________
Debugging is a state of mind
RWO is offline   Reply With Quote
Old 06-09-2006, 04:05 AM   #17
Piru
' union select name,pwd--
Points: 30,457, Level: 100 Points: 30,457, Level: 100 Points: 30,457, Level: 100
Activity: 69% Activity: 69% Activity: 69%
 
Piru's Avatar
 
Join Date: Aug 2002
Location: Helsinki, Finland
Posts: 6,946
Default Re: Exec exception handling and a time interval implementation...

@RWO
Quote:
Whouldent you get in trouble if a 68k application used that tick and ended up is a PPC code function.
No.

Quote:
I can imagine that the Emulator jumping from a 68k function to another 68k function, but crossing over whould lead into trouble.
It does not. The code is always executed as 68k. If a PPC function is to be called, there needs to be a gate:
Code:
#include <emul/emulregs.h>
#include <emul/emulinterface.h>
#include <exec/ports.h>
#include <exec/libraries.h>
#include <clib/debug_protos.h>

void func(void)
{
  struct MsgPort *port    = (APTR) REG_A1;
  struct Library *SysBase = (APTR) REG_A6;
  kprintf("SysBase 0x%lx port 0x%lx\n", SysBase, port);
}

static const struct EmulLibEntry GATEfunc =
{
  TRAP_LIBNR, 0, func
};

...

mp->mp_Node.ln_Type = NT_MSGPORT;
mp->mp_Flags = 3;
mp->mp_SigTask = (APTR) &GATEfunc;
NEWLIST(&mp->mp_MsgList);
And no, it doesn't go thru m68k emulation there. MorphOS is smart enough to spot PPC->m68k->PPC call and skip over the emulation completely. So it's a direct PPC->PPC call in the end, with no performance penalty. This is the whole point of MOS: Have the old API while giving full PPC performance benefits for both old and new apps. Old m68k apps automagically benefit from native libraries, while new PPC apps can continue to use the same API, without performance losses. Naturally you can also create fully PPC native APIs if you wish.
Piru is offline   Reply With Quote
Old 06-09-2006, 05:06 AM   #18
RWO
Beginner
Points: 4,635, Level: 43 Points: 4,635, Level: 43 Points: 4,635, Level: 43
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2003
Posts: 30
Send a message via ICQ to RWO
Default Re: Exec exception handling and a time interval implementation...

@Piru

Yes I can understad that adding a Trap function in the mp_SigTask will work but I were thinking more in the lines like we have an old program 68k and an old system 68k.. now as time go by the system get upgraded to PPC, then the old program still has a direct address and not a Trap.. in that case I se it fail.

RWO
__________________
Debugging is a state of mind
RWO is offline   Reply With Quote
Old 06-09-2006, 05:15 AM   #19
Piru
' union select name,pwd--
Points: 30,457, Level: 100 Points: 30,457, Level: 100 Points: 30,457, Level: 100
Activity: 69% Activity: 69% Activity: 69%
 
Piru's Avatar
 
Join Date: Aug 2002
Location: Helsinki, Finland
Posts: 6,946
Default Re: Exec exception handling and a time interval implementation...

@RWO
Quote:
we have an old program 68k and an old system 68k.. now as time go by the system get upgraded to PPC, then the old program still has a direct address and not a Trap.. in that case I se it fail.
Err, no. It won't. Naturally the OS still calls the routine as m68k one.

If there is any OS that will fail in that case, then the OS in question is broken beyond repair. You just can't change the way these things work.
Piru is offline   Reply With Quote
Old 06-09-2006, 07:01 AM   #20
itix
Defender of the Faith
Points: 11,740, Level: 71 Points: 11,740, Level: 71 Points: 11,740, Level: 71
Activity: 5% Activity: 5% Activity: 5%
 
itix's Avatar
 
Join Date: Oct 2002
Posts: 1,874
Default Re: Exec exception handling and a time interval implementation...

Quote:
Yes I can understad that adding a Trap function in the mp_SigTask will work but I were thinking more in the lines like we have an old program 68k and an old system 68k.. now as time go by the system get upgraded to PPC, then the old program still has a direct address and not a Trap.. in that case I se it fail.
Trap instruction (0xff00 family instructions) is not needed for 68k code. It just only indicates start of PPC code and when there is not trap the stuff is executed in 68k emulation mode.

68k function pointer in the mp_SigTask is not different than 68k function pointer in the h_Entry of struct Hook for example.
__________________
Only MorphOS makes it possible \o_
itix is offline   Reply With Quote
Reply

Bookmarks

Tags
time , interval , implementation , handling , exec , exception

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception troubles! Karlos Amiga OS -- Development 25 12-05-2010 07:58 AM
Excessive gcc/C++ exception handling bloat Karlos Amiga OS -- Development 0 04-08-2007 09:26 AM
From low level exception handling to high level... Karlos Amiga OS -- Development 34 11-14-2006 06:28 AM
Interrupt handling under WarpOS... Karlos Amiga OS -- Development 12 06-17-2005 11:05 AM
File handling under AmigaOS 3.x mikeymike Amiga Software Issues and Discussion 5 09-26-2003 03:57 AM