Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ una_ld(3) — NEWS-os 4.2.1R

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dbx(1)

sysnews(2)

sigset(2)

UNALIGNED(3)  —  NEWS-OS Programmer’s Manual

NAME

una_lw, unaligned_load_word, una_lh, unaligned_load_half, una_lhu, unaligned_load_uhalf, una_lf, unaligned_load_float, una_ld, unaligned_load_double, una_sw, unaligned_store_word, una_sh, unaligned_store_half, una_sf, unaligned_store_float, una_sd, unaligned_store_double − handle unaligned data

SYNOPSIS

long una_lw(addr)
long unaligned_load_word(addr)
char ∗addr;

long una_lh(addr)
long unaligned_load_half(addr)
char ∗addr;

long una_lhu(addr)
long unaligned_load_uhalf(addr)
char ∗addr;

float una_lf(addr)
float unaligned_load_float(addr)
char ∗addr;

double una_ld(addr)
double unaligned_load_double(addr)
char ∗addr;

void una_sw(addr, value)
void unaligned_store_word(addr, value)
char ∗addr;
long value;

void una_sh(addr, value)
void unaligned_store_half(addr, value)
char ∗addr;
long value;

void una_sf(addr, value)
void unaligned_store_float(addr, value)
char ∗addr;
float value;

void una_sd(addr, value)
void unaligned_store_double(addr, value)
char ∗addr;
double value;

DESCRIPTION

The RISC NEWS hardware can only handle aligned data for loading and storing operations. That is, the address of the data must be a multiple of the number of bytes loaded or stored.  It causes a trap when a program refers to unaligned data.  By default, the kernel sends a SIGBUS signal to the process and causes a core dump for debugging when this trap occurs. 

Programs developed on systems without alignment constraints like MC68000 families may make misaligned references during operations.  In order to port such programs to RISC NEWS hardware, it is necessary to rewrite these programs by aligning the data. 
 

But, if not all of the data can be aligned, or not all of the program locations that refers to unaligned data can be changed, the sysnews(2) [NEWS_FIXADE] system call may be useful.  In this case, since a trap is occured whenever a program refers to unaligned data, use these routines above to improve its performance. 

These routines load or store indicated data type at the specified address.  The address need not to be aligned normally.  For example:

n = ∗(long ∗)addr;

in case of the expression above, if the address addr is unaligned alter it as follows:

n = una_lw(addr);

The routine unaligned_load_word(addr) is the same as una_lw(addr). 

There exist fortran entry points for these routines, they can be called directly from FORTRAN program with the names mentioned here. 

DIAGNOSTICS

A SIGSEGV signal will be generated, when these routines try to load or store to outside of program’s address space.  A SIGBUS signal would be generated, if the program did not use these routines and the address was unaligned.  This is because the check for alignment preceeds the check for address that is in the program’s address space. 

SEE ALSO

dbx(1), sysnews(2) [NEWS_FIXADE], signal(2), sigset(2)

NEWS-OSRelease 4.2.1R

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026