OSDev.org

The Place to Start for Operating System Developers
It is currently Thu May 09, 2024 9:28 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: INT 0x18 services
PostPosted: Sat Feb 14, 2004 6:54 pm 
I'm trying to set up some basic OS services for my OS...
This code compiles fine, but crashes at boot. Any ideas?

Code:
xor bx,bx
xor ax,ax
mov ss,ax
mov ax,cs
cli
mov word [ss:(0x20*4)],Int20_handler
mov word [ss:(0x20*4+2)],ax
sti

jmp normal

Int20_handler:
cmp ah,0x00
je mep
ret

mep:
blahblahblah
IRET

normal:
...


Top
  
 
 Post subject: Re:INT 0x18 services
PostPosted: Sat Feb 14, 2004 8:01 pm 
Well, one idea is that you return from your interrupt handler with RET instead of IRET if AH != 0.


Top
  
 
 Post subject: Re:INT 0x18 services
PostPosted: Sun Feb 15, 2004 2:24 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
saving/restoring registers would also be a good idea (but i'm sure you did it, but just skip it here to save keystrokes ;) )

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:INT 0x18 services
PostPosted: Sun Feb 15, 2004 11:41 pm 
Ya, I be saveing/restoring the ax register...any others?


Top
  
 
 Post subject: Re:INT 0x18 services
PostPosted: Mon Feb 16, 2004 12:32 am 
St8ic wrote:
I'm trying to set up some basic OS services for my OS...
This code compiles fine, but crashes at boot. Any ideas?

Code:
xor bx,bx
xor ax,ax
mov ss,ax
mov ax,cs
cli
mov word [ss:(0x20*4)],Int20_handler
mov word [ss:(0x20*4+2)],ax
sti

jmp normal

Int20_handler:
cmp ah,0x00
je mep
ret

mep:
blahblahblah
IRET

normal:
...


btw which address mode the statement mov word [ss:(0x20*4)],Int20_handler belong to?


Top
  
 
 Post subject: Re:INT 0x18 services
PostPosted: Mon Feb 16, 2004 1:14 pm 
80386 Real-Address Mode ;D ...


Top
  
 
 Post subject: Re:INT 0x18 services
PostPosted: Mon Feb 16, 2004 1:52 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
what is the value for SP at that time ? zeroing the stack segment without altering the stack pointer looks like commiting suicide in real mode: as your stack grows it could destroy its interrupt handlers or the BIOS data area ...

If you need a 0-segment, rather use GS or FS or ES if DS is busy for other things, but using SS sounds really weird to me ...

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:INT 0x18 services
PostPosted: Tue Feb 17, 2004 5:46 pm 
SP is at 0x1300...that may be the problem?


Top
  
 
 Post subject: Re:INT 0x18 services
PostPosted: Wed Feb 18, 2004 2:18 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
well, if SS was different from 0 before entering the INT 20h setup function, it will definitiely cause trouble by the time you'll issue a RET instruction, as the return address will no longer be the same ...

avoid toying with the stack segment if you don't have to switch to another stack ...

_________________
Image May the source be with you.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 16 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