public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* int 0x40
@ 2002-01-18 16:26 Raman S
  2002-01-18 17:02 ` Richard B. Johnson
  2002-01-18 17:47 ` Brian Gerst
  0 siblings, 2 replies; 5+ messages in thread
From: Raman S @ 2002-01-18 16:26 UTC (permalink / raw)
  To: linux-kernel

Hi,
  I relatively new to the kernel and am trying to understand how the linux 
kernel handles interrupts. For this I attempted to
create an int 0x40 by adding a set_system_gate(64, &system_call) in traps.c. 
I verfied by giving out print statements within set_system_gate that 64 is 
being set during initialization (though it isnt a surprise that it is being 
set).  But when i give an int 0x40 in a user level assembly program I get 
segmentation fault, (a SIGSEGV signal is sent to the process).  I have tried 
adding another function in entry.S called my_system_call and reproducing the 
code in system_call with a jmp ret_from_sys_call  at the end. Also tried 
giving an empty C function for my_system_call all with the same result.

My assembly prints out hello world, from the linux assembly how to, 
reproduced here
If i replace int 0x80 with my int 0x40 I end up with a segmentation fault. 
Is there any thing other than set_system_gate and writing the my_system_call 
handler, that i need to do to have a successful int 0x40? I had tried
   a) commenting out just the deference of the system handler function 
within system_call (call *sys_call_table(0, %eax, 4) )
   b) using &system_call itself in set_system_gate
  but still the same situation.

Any suggestions will be appreciated.

Thanks
Raman


.data					# section declaration

msg:
	.string	"Hello, world!\n"	# our dear string
	len = . - msg			# length of our dear string

.text					# section declaration

			# we must export the entry point to the ELF linker or
    .global _start	# loader. They conventionally recognize _start as their
			# entry point. Use ld -e foo to override the default.

_start:

# write our string to stdout

	movl	$len,%edx	# third argument: message length
	movl	$msg,%ecx	# second argument: pointer to message to write
	movl	$1,%ebx		# first argument: file handle (stdout)
	movl	$4,%eax		# system call number (sys_write)
	int	$0x80		# call kernel

# and exit

	movl	$0,%ebx		# first argument: exit code
	movl	$1,%eax		# system call number (sys_exit)
	int	$0x80		# call kernel




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: int 0x40
@ 2002-01-18 19:47 Raman S
  0 siblings, 0 replies; 5+ messages in thread
From: Raman S @ 2002-01-18 19:47 UTC (permalink / raw)
  To: bgerst; +Cc: linux-kernel

Yes, That was it, Thanks so much.....
Raman S
>The IRQ setup code is probably overwriting it.  You'll need to make the
>code in i8259.c skip over vector 0x40 as well as SYSCALL_VECTOR (0x80).
>
>--
>
>				Brian Gerst




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-01-18 19:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-18 16:26 int 0x40 Raman S
2002-01-18 17:02 ` Richard B. Johnson
2002-01-18 17:47 ` Brian Gerst
2002-01-18 18:15   ` Richard B. Johnson
  -- strict thread matches above, loose matches on Subject: below --
2002-01-18 19:47 Raman S

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox