OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 7:18 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Added article on ARM System Calls.
PostPosted: Sat May 29, 2010 4:10 am 
Offline
Member
Member

Joined: Sat Mar 21, 2009 1:29 pm
Posts: 51
Location: Ireland
I've added a fairly basic article on ARM System Calls, like the ARM Bare Bones, it's still a work in progress.
So far it features a basic introduction to making system calls on ARM. It also shows how to create system calls.

ARM System Calls


Top
 Profile  
 
 Post subject: Re: Added article on ARM System Calls.
PostPosted: Sat May 29, 2010 6:31 am 
Offline
Member
Member

Joined: Sat Nov 21, 2009 5:11 pm
Posts: 852
With SWI, LR points to the next instruction, so it should end with MOVS PC, LR, not SUBS PC, LR, #4.

To have SWI work in both ARM and Thumb mode, one can place the system call number in bits 16-23 and fetch it with LDRB R0, [LR,#-2].


Top
 Profile  
 
 Post subject: Re: Added article on ARM System Calls.
PostPosted: Sat May 29, 2010 7:16 am 
Offline
Member
Member

Joined: Sat Mar 21, 2009 1:29 pm
Posts: 51
Location: Ireland
Gigasoft wrote:
With SWI, LR points to the next instruction, so it should end with MOVS PC, LR, not SUBS PC, LR, #4.

To have SWI work in both ARM and Thumb mode, one can place the system call number in bits 16-23 and fetch it with LDRB R0, [LR,#-2].


Thanks, I've changed it.


Top
 Profile  
 
 Post subject: Re: Added article on ARM System Calls.
PostPosted: Tue Jun 01, 2010 5:55 am 
Offline
Member
Member
User avatar

Joined: Tue Jul 10, 2007 5:27 am
Posts: 2935
Location: York, United Kingdom
The last section about shifting left 16-bits is unclear. It is unclear as to whether this shift MUST be done in inline assembly or if it can be done in C.

_________________
Horizon - a framework and language for SAS-OS development
Project 'Pedigree'
Practical x86 OSDev tutorials


Top
 Profile  
 
 Post subject: Re: Added article on ARM System Calls.
PostPosted: Tue Jun 01, 2010 10:03 am 
Offline
Member
Member

Joined: Sat Nov 21, 2009 5:11 pm
Posts: 852
You can't get at the return address from C anyway, so you have to use assembly. But then again, there is no guarrantee that LR will contain the return address once it gets to that statement, so preferably the entire SWI handler should be written in assembly.

Note that fetching the entire word and shifting it manually will not work because the address could be unaligned.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group