Kernel Calls, Best Design 
Author Message
 Kernel Calls, Best Design

Hi there,
  For completely academic reasons, I'm working developing an OS bottom up
in assembly.  I'm curious what the best way in protected mode is to make
kernel calls to do things like write to the screen.  I'm assuming it would
be to write an interrupt to do whatever I'm wanting to do.
  My problem is figuring out how to get interrupts installed.  It seems
as though the below code should work.  Yet when int 0x80 is called,
the system comes to an immediate halt.
  My mpush and mpop macros work perfectly, doing what would be obvious.

sample_int:
  nop
  iret
install_sample_int:
  mpush ax, dx, ds, es
  pushf
  cli
  lds   ax, [sample_int]
  xor   dx, dx
  mov   es, dx
  mov   [es:0x80*4], ax
  mov   [es:0x80*4+2], ds
  sti
  popf
  mpop  es, ds, dx, ax
  retn

--
Alex McHale
http://www.*-*-*.com/
C/C++, Haskell, Perl, PHP, Python, Ruby
ASM(x86,MIPS,HC12)



Sat, 04 Oct 2003 02:27:39 GMT  
 Kernel Calls, Best Design


:  My problem is figuring out how to get interrupts installed.  It seems
:as though the below code should work.  Yet when int 0x80 is called, the
:system comes to an immediate halt.

The   "lds   ax, [sample_int]" does not work the way you seem to think it
does. What you need is the offset address in ax, and the segment address
in ds. What you are actually getting is the first two bytes of sample_int
in ax, and the next two bytes in ds.

-- Chuck Crayne
-----------------------------------------------------------

-----------------------------------------------------------



Sat, 04 Oct 2003 20:34:37 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. FORTH Kernel Design -- Parameter Stack Size?

2. Forth Core and Kernel Design

3. Forth Core and Kernel Design

4. Linux Kernel Design and Why Python is Rad

5. help calling a win3.1 Kernel function

6. help: how to call fortran95 routine of Intel Math Kernel Library in CVF

7. A Win32Forth kernel that supports PROC and CALL from the kernel directly.

8. [Fwd: Case statements, decision trees, and good OO design]

9. ANN: Look Good Package Re-designed

10. Best analysis and design method for Smalltalk?

11. Best font for window design?

12. Best design using Alias tables

 

 
Powered by phpBB® Forum Software