gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > Adding your own SWI functions?

#59930 - paladine - Sat Nov 05, 2005 6:50 pm

Is there any way to add SWI functions? From what I've read the SWI function array is stored in the BIOS and therefore you can't change them. I want to achieve a system call, a call made from user mode that ends up in the IRQ handler.

I was thinking of maybe setting up a short DMA transfer and have it fire an IRQ when finished. That would achieve the same effect in my mind.

#59931 - Miked0801 - Sat Nov 05, 2005 7:26 pm

Why? What are you trying to accomplish that a jump table wouldn't do for you?

#59935 - pepsiman - Sat Nov 05, 2005 7:40 pm

paladine wrote:
Is there any way to add SWI functions?

On the GBA, swi 0xd4 goes to 0x02002040 (arm). This is how gbalinux works.

On the DS, the vectors on the ARM9 can be relocated to 0x0 (they are normally at 0xffff0000), and you can use them for anything you want. This is how dslinux works.

#59936 - paladine - Sat Nov 05, 2005 7:46 pm

SWI 0xd4 sounds like what I need. Now I just need to figure out how to force the linker to put something at 0x02002040 ;-)