Hi Marcus,

a single-line function will not work - you need a 'ret' at least to get back to your caller, i.e. your func needs to look like:

ENTRY(magic_1)
ret
sethi (1), %g0
SET_SIZE(magic_1)

(make the sethi a delay slot instruction)

If this is not what you want, then you could opt for the use of *.il files. The compiler will inline the code from these, avoiding the ret.

But since you want to trigger 'simics events', how about modifying the way the DTrace sdt provider works ? Right now, sdt works by overwriting a compile-time-generated 'call' with 'nop' before linking the object file, and at probe enable inserting a 'ta' at the place. It'd be a trivial thing to change sdt so that it inserts your 'simics-trigger' instruction instead. The advantage would be you could trigger at will.

FrankH.

On Wed, 16 Aug 2006, Marcus Spangenberg wrote:

I forgot that disp.c contained only arch independent code.

I have been trying to solve this by adding functions elsewhere and then doing 
function calls from where I want the code in idle_enter() in 
uts/common/disp/disp.c

I have added an extra subdir in uts/sun4/ with an .s-file containing the 
assembler routines and added the .o file in the Makefiles.files in uts/sun4.

Everything compiles ok but I get error messages when booting with the new 
kernel when the function is called for the first time.

I should add that the added assembly routine only contains one instruction that 
is equivalent of a nop instruction (sethi 1, %g0) and the purpose is to trigger 
events in the simulator (simics) I am running. The simulator listens to these 
instructions and triggers events.

It seems like an assertion failed an I get the following error message:

panic[cpu0]/thread=2a10001fcc0: assertion failed: npgs != 0, file: 
../../../sun4/os/mem_config_arch.c, line: 39

000002a10001f8c0 genunix:assfail+7c (109c8c8, 109c8d8, 27, 18c7800, 12b4c00, 0)
 %l0-3: 000000000d7142ed 0000000000000008 0000000000000001 0000000000000000
 %l4-7: 000000000d7142ed 0000000000000000 000000000191a000 0000000000000000
000002a10001f970 unix:arch_kphysm_del_span_ok+1c (8, 0, 0, 180c000, 1, 109c800)
 %l0-3: 00000000018ce0b8 0000000000000004 0000000000000001 0000000000000000
 %l4-7: 000000001cf27947 0000000000000c2e ffffffffffffffff 000000004dfaa9c8
000002a10001fa20 unix:idle+4 (0, 0, 180c000, 189b040, 50, 0)
 %l0-3: 000000001cf27947 0000000000000000 0000000000000000 000000000180e000
 %l4-7: 0000000000000000 00000000018c7998 0000000000000017 0000000001954800

Can anybody help? What is the best way of calling a single assembly instruction 
in an arch independant file? Why is the function call not working, is it not 
allowed to call external functions from here?

The .s file I have created looks like this:

#include <sys/asm_linkage.h
ENTRY(magic_1)
sethi   (1), %g0
SET_SIZE(magic_1)

ENTRY(magic_2)
sethi   (2), %g0
SET_SIZE(magic_2)


This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code


==========================================================================
No good can come from selling your freedom, not for all gold of the world,
for the value of this heavenly gift exceeds that of any fortune on earth.
==========================================================================
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to