Sponsored Content
Top Forums Programming Solaris - BUS error with optimize mode Post 302943451 by revolta25 on Friday 8th of May 2015 01:33:36 PM
Old 05-08-2015
Solaris - BUS error with optimize mode

Hi,

I'm facing BUS (invalid address alignment) issue.

Application works correctly with binaries compiled without optimization.
When "-O3" (or -O2, O1) is in use, application abort with - BUS (invalid address alignment).

The problem appears in following situation:

Code:
struct _a
{
	int _a1;
	uint64_t _a2;
}

int f2(uint64_t *obj)
{
	printf("%llu", *obj); <--- BUS ERROR
	
	return 0;
}

void f1()
{
	...
	_a* obj_a = malloc();
	
	printf("%llu", obj_a->_a2); <--- OK
	f2(&obj_a->_a2);
}

Solaris Sparc
GCC 4.2.1

Thanks
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Bus Error

This may belong in the C Programming forum, but here goes anyway... What would cause a bus error? I searched google for a cause, but came up with some conflicting reports... Could it be caused by disk space? A lot of the pages I found mentioned linking with the incorrect versions of the... (4 Replies)
Discussion started by: LivinFree
4 Replies

2. UNIX for Dummies Questions & Answers

bus error on solaris

Hi there I am running soalris 9 on a sun fire 480r and all of a sudden (today) whenever the users run the command `top` we get the following message `bus error` does anybody have any information on what this is all about and whether there is a routine i can perform to gather more... (3 Replies)
Discussion started by: hcclnoodles
3 Replies

3. Programming

BUS error

Hi! I've got a program which runs fine under Linux, but I have compiled it to run under SunOS 5.8 in a Sparc computer, and now it sometimes fails with "bus error". Ussing gdb I surfed to the error line, which is *pointer = some_vector; where some_vector is a 16 byte struct (4 integers)... (1 Reply)
Discussion started by: shesatmine
1 Replies

4. Solaris

split bus mode

Hi there, I have two SunBlade 2000s that I want to connect to a single D1000. I am told that I need to do a split bus mode. I don't really understand what that means. Does that mean that half of the storage disks will be assigned to one host and the others to the other host? How do I get... (18 Replies)
Discussion started by: Arkayev
18 Replies

5. UNIX for Dummies Questions & Answers

bus error (coredump)

Hi all, I am getting bus error problem in SunOS. Can you please help me out in this regard. Actually, my entire code till the last line has been executed. But after tht i am getting a bus error. Please help me. Thanks in advance. Charu. (4 Replies)
Discussion started by: charu
4 Replies

6. HP-UX

Bus Error

I am getting bus error when i include "#!/bin/ksh". If i remove interpreter then script is working. Can anyone explain this and how can i avoid this error? Operating System is HP-UX B.11.23 U 9000/800 1091834454 (2 Replies)
Discussion started by: anbu23
2 Replies

7. Programming

Bus error

Hi everyone, I have a GUI project and when I run it and left in idle state for a long time(there is nothing done, just opened GUI, no more actions),I get bus error after trying to do anything with it. I've tried to build it in debug mode and use gdb, but I don't get any error in debug mode.It... (3 Replies)
Discussion started by: sisi
3 Replies

8. Programming

Bus Error: 10...Help please!

Hi all, I am writing a phonebook program to store names and number using a list. Here is the code for the function which allows the user to enter the name and number (where the error occurs). //THIS FUNCTION ADDS A NEW ENTRY TO THE phonebook_list void insert(void){ //variables int... (5 Replies)
Discussion started by: kdejan
5 Replies

9. Solaris

Howto solve this disk error in Solaris in single user mode

Hi all, OS is Solaros 10 Sparc While doing Netbackup upgradation to 7.5 , the server was asked to reboot. But then it came up in single user mode, and after I typed format command it showed some disk error. bash-3.00# format Searching for disks...WARNING:... (2 Replies)
Discussion started by: manalisharmabe
2 Replies
ddi_dma_attr(9S)					    Data Structures for Drivers 					  ddi_dma_attr(9S)

NAME
ddi_dma_attr - DMA attributes structure SYNOPSIS
#include <sys/ddidmareq.h> INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). DESCRIPTION
A ddi_dma_attr_t structure describes device- and DMA engine-specific attributes necessary to allocate DMA resources for a device. The driver might have to extend the attributes with bus-specific information, depending on the bus to which the device is connected. STRUCTURE MEMBERS
uint_t dma_attr_version; /* version number */ uint64_t dma_attr_addr_lo; /* low DMA address range */ uint64_t dma_attr_addr_hi; /* high DMA address range */ uint64_t dma_attr_count_max; /* DMA counter register */ uint64_t dma_attr_align; /* DMA address alignment */ uint_t dma_attr_burstsizes; /* DMA burstsizes */ uint32_t dma_attr_minxfer; /* min effective DMA size */ uint64_t dma_attr_maxxfer; /* max DMA xfer size */ uint64_t dma_attr_seg; /* segment boundary */ int dma_attr_sgllen; /* s/g list length */ uint32_t dma_attr_granular; /* granularity of device */ uint_t dma_attr_flags; /* DMA transfer flags */ dma_attr_version stores the version number of this DMA attribute structure. It should be set to DMA_ATTR_V0. The dma_attr_addr_lo and dma_attr_addr_hi fields specify the address range the device's DMA engine can access. The dma_attr_addr_lo field describes the inclusive lower 64-bit boundary. The dma_attr_addr_hi describes the inclusive upper 64-bit boundary. The system ensures that allocated DMA resources are within the range specified. See ddi_dma_cookie(9S). The dma_attr_count_max describes an inclusive upper bound for the device's DMA counter register. For example, 0xFFFFFF would describe a DMA engine with a 24-bit counter register. DMA resource allocation functions have to break up a DMA object into multiple DMA cookies if the size of the object exceeds the size of the DMA counter register. The dma_attr_align specifies alignment requirements for allocated DMA resources. This field can be used to force more restrictive alignment than imposed by dma_attr_burstsizes or dma_attr_minxfer, such as alignment at a page boundary. Most drivers set this field to 1, indicating byte alignment. Note that dma_attr_align only specifies alignment requirements for allocated DMA resources. The buffer passed to ddi_dma_addr_bind_han- dle(9F) or ddi_dma_buf_bind_handle(9F) must have an equally restrictive alignment (see ddi_dma_mem_alloc(9F)). The dma_attr_burstsizes field describes the possible burst sizes the device's DMA engine can accept. The format of the data sizes is binary encoded in terms of powers of two. When DMA resources are allocated, the system can modify the burstsizes value to reflect the sys- tem limits. The driver must use the allowable burstsizes to program the DMA engine. See ddi_dma_burstsizes(9F). The dma_attr_minxfer field describes the minimum effective DMA access size in units of bytes. DMA resources can be modified, depending on the presence and use of I/O caches and write buffers between the DMA engine and the memory object. This field is used to determine align- ment and padding requirements for ddi_dma_mem_alloc(9F). The dma_attr_maxxfer field describes the maximum effective DMA access size in units of bytes. The dma_attr_seg field specifies segment boundary restrictions for allocated DMA resources. The system allocates DMA resources for the device so that the object does not span the segment boundary specified by dma_attr_seg. For example, a value of 0xFFFF means DMA resources must not cross a 64 Kbyte boundary. DMA resource allocation functions might have to break up a DMA object into multiple DMA cookies to enforce segment boundary restrictions. In this case, the transfer must be performed using scatter-gather I/O or multiple DMA windows. The dma_attr_sgllen field describes the length of the device's DMA scatter/gather list. Possible values are as follows: < 0 Device DMA engine is not constrained by the size, for example, withDMA chaining. = 0 Reserved. = 1 Device DMA engine does not support scatter/gather such as third party DMA. > 1 Device DMA engine uses scatter/gather. dma_attr_sgllen is the maximum number of entries in the list. The dma_attr_granular field describes the granularity of the device transfer size, in units of bytes. When the system allocates DMA resources, a single segment's size is a multiple of the device granularity. Or if dma_attr_sgllen is larger than 1 within a window, the sum of the sizes for a subgroup of segments is a multiple of the device granularity. Note that all driver requests for DMA resources must be a multiple of the granularity of the device transfer size. The dma_attr_flags field can be set to: DDI_DMA_FORCE_PHYSICAL Some platforms, such as SPARC systems, support what is called Direct Virtual Memory Access (DVMA). On these platforms, the device is provided with a virtual address by the system in order to perform the transfer. In this case, the underlying platform provides an IOMMU, which translates accesses to these virtual addresses into the proper physical addresses. Some of these platforms also support DMA. DDI_DMA_FORCE_PHYSICAL indicates that the system should return physical rather than virtual I/O addresses if the system supports both. If the system does not support physical DMA, the return value from ddi_dma_alloc_handle(9F) will be DDI_DMA_BADATTR. In this case, the driver has to clear DDI_DMA_FORCE_PHYSICAL and retry the operation. EXAMPLES
Example 1: Initializing the ddi_dma_attr_t Structure Assume a device has the following DMA characteristics: o Full 32-bit range addressable o 24-bit DMA counter register o Byte alignment o 4- and 8-byte burst sizes support o Minimum effective transfer size of 1 bytes o 64 Mbyte maximum transfer size limit o Maximum segment size of 32 Kbyte o 17 scatter/gather list elements o 512-byte device transfer size granularity The corresponding ddi_dma_attr_t structure is initialized as follows: static ddi_dma_attr_t dma_attrs = { DMA_ATTR_V0 /* version number */ (uint64_t)0x0, /* low address */ (uint64_t)0xffffffff, /* high address */ (uint64_t)0xffffff, /* DMA counter max */ (uint64_t)0x1 /* alignment */ 0x0c, /* burst sizes */ 0x1, /* minimum transfer size */ (uint64_t)0x3ffffff, /* maximum transfer size */ (uint64_t)0x7fff, /* maximum segment size */ 17, /* scatter/gather list lgth */ 512 /* granularity */ 0 /* DMA flags */ }; SEE ALSO
ddi_dma_addr_bind_handle(9F), ddi_dma_alloc_handle(9F), ddi_dma_buf_bind_handle(9F), ddi_dma_burstsizes(9F), ddi_dma_mem_alloc(9F), ddi_dma_nextcookie(9F), ddi_dma_cookie(9S) Writing Device Drivers SunOS 5.10 26 Sep 1996 ddi_dma_attr(9S)
All times are GMT -4. The time now is 10:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy