summaryrefslogtreecommitdiff
path: root/libexec/ld.so/powerpc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-24 04:17:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-24 04:17:02 +0000
commit02ba7b17f1114bc55b4a50e004451dc9942b9fc0 (patch)
tree549afb30dbb96e63d1876bada2785100ad266fc4 /libexec/ld.so/powerpc
parenta2c4c67f6bef5f075a102e449c50d7bbefa3e41b (diff)
more KNF
Diffstat (limited to 'libexec/ld.so/powerpc')
-rw-r--r--libexec/ld.so/powerpc/archdep.h14
-rw-r--r--libexec/ld.so/powerpc/ldasm.S4
-rw-r--r--libexec/ld.so/powerpc/rtld_machine.c26
-rw-r--r--libexec/ld.so/powerpc/syscall.h244
4 files changed, 149 insertions, 139 deletions
diff --git a/libexec/ld.so/powerpc/archdep.h b/libexec/ld.so/powerpc/archdep.h
index c813c70a985..15d1da02aed 100644
--- a/libexec/ld.so/powerpc/archdep.h
+++ b/libexec/ld.so/powerpc/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.6 2002/05/24 03:44:38 deraadt Exp $ */
+/* $OpenBSD: archdep.h,v 1.7 2002/05/24 04:17:01 deraadt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -60,12 +60,12 @@
static inline void
_dl_dcbf(Elf32_Addr *addr)
{
- __asm__ volatile ("dcbst 0, %0\n\t"
- "sync\n\t"
- "icbi 0, %0\n\t"
- "sync\n\t"
- "isync"
- : : "r" (addr) : "0");
+ __asm__ volatile ("dcbst 0, %0\n\t"
+ "sync\n\t"
+ "icbi 0, %0\n\t"
+ "sync\n\t"
+ "isync"
+ : : "r" (addr) : "0");
}
static inline void
diff --git a/libexec/ld.so/powerpc/ldasm.S b/libexec/ld.so/powerpc/ldasm.S
index e7e929825bd..e626587e723 100644
--- a/libexec/ld.so/powerpc/ldasm.S
+++ b/libexec/ld.so/powerpc/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.3 2002/05/24 03:44:38 deraadt Exp $ */
+/* $OpenBSD: ldasm.S,v 1.4 2002/05/24 04:17:01 deraadt Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -110,7 +110,7 @@ ENTRY(_dl_start)
/* This cheats and calculates the address of _DYNAMIC
* the same way that the GLOBAL_OFFSET_TABLE was calcuated
*/
- lwz 18, 4(5)
+ lwz 18, 4(5)
rlwinm 18,18,0,8,30 # mask off the offset portion of the instr.
add 8, 18, 5 # address of _DYNAMIC (arg6 for _dl_boot)
addi 18, 8, 4 # correction.
diff --git a/libexec/ld.so/powerpc/rtld_machine.c b/libexec/ld.so/powerpc/rtld_machine.c
index 1354b90393a..d661349eca3 100644
--- a/libexec/ld.so/powerpc/rtld_machine.c
+++ b/libexec/ld.so/powerpc/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.6 2002/05/24 03:44:38 deraadt Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.7 2002/05/24 04:17:01 deraadt Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -69,7 +69,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
Elf32_Addr *first_rela;
- loff = object->load_offs;
+ loff = object->load_offs;
numrela = object->Dyn.info[relasz] / sizeof(Elf32_Rela);
relas = (Elf32_Rela *)(object->Dyn.info[rel]);
@@ -108,7 +108,7 @@ _dl_printf("object relocation size %x, numrela %x\n",
val = ((Elf32_Addr)plttable >> 16) +
(((Elf32_Addr)plttable & 0x00008000) >> 15);
pltcall[0] = 0x3d6b0000 | val; /* addis r11,r11,.PLTtable@ha*/
- val = (Elf32_Addr)plttable & 0x0000ffff;
+ val = (Elf32_Addr)plttable & 0x0000ffff;
pltcall[1] = 0x816b0000 | val; /* lwz r11,plttable@l(r11) */
pltcall[2] = 0x7d6903a6; /* mtctr r12 */
pltcall[3] = 0x4e800420; /* bctr */
@@ -161,7 +161,7 @@ _dl_printf("object relocation size %x, numrela %x\n",
case RELOC_32:
if (ELF32_ST_BIND(sym->st_info) == STB_LOCAL &&
(ELF32_ST_TYPE(sym->st_info) == STT_SECTION ||
- ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) {
+ ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) {
*r_addr = ooff + relas->r_addend;
} else {
*r_addr = ooff + this->st_value +
@@ -172,7 +172,7 @@ _dl_printf("object relocation size %x, numrela %x\n",
case RELOC_RELATIVE:
if (ELF32_ST_BIND(sym->st_info) == STB_LOCAL &&
(ELF32_ST_TYPE(sym->st_info) == STT_SECTION ||
- ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) {
+ ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) {
*r_addr = loff + relas->r_addend;
#ifdef DL_PRINTF_DEBUG
@@ -186,7 +186,7 @@ _dl_printf("rel1 r_addr %x val %x loff %x ooff %x addend %x\n", r_addr,
}
break;
case RELOC_JMP_SLOT:
- {
+ {
Elf32_Addr val = ooff + this->st_value +
relas->r_addend - (Elf32_Addr)r_addr;
if (!(((val & 0xfe000000) == 0x00000000) ||
@@ -210,7 +210,7 @@ _dl_printf(" ooff %x, sym val %x, addend %x"
(Elf32_Addr)&r_addr[2];
r_addr[1] = 0x396b0000 | val;
val &= ~0xfc000000;
- val |= 0x48000000;
+ val |= 0x48000000;
r_addr[2] = val;
} else {
#ifdef DL_PRINTF_DEBUG
@@ -222,7 +222,7 @@ _dl_printf(" index %d, pltcall %x r_addr %x\n",
val = (Elf32_Addr)pltcall -
(Elf32_Addr)&r_addr[1];
val &= ~0xfc000000;
- val |= 0x48000000;
+ val |= 0x48000000;
r_addr[1] = val;
}
@@ -239,11 +239,11 @@ _dl_printf(" symn [%s] val 0x%x\n", symn, val);
* branch directy to the dest
*/
val &= ~0xfc000000;
- val |= 0x48000000;
+ val |= 0x48000000;
*r_addr = val;
_dl_dcbf(r_addr);
}
- }
+ }
break;
case RELOC_GLOB_DAT:
@@ -261,7 +261,7 @@ _dl_printf(" symn [%s] val 0x%x\n", symn, val);
_dl_exit(20);
}
val &= ~0xfc000003;
- val |= (*r_addr & 0xfc000003);
+ val |= (*r_addr & 0xfc000003);
*r_addr = val;
_dl_dcbf(r_addr);
@@ -317,7 +317,7 @@ _dl_dcbf(r_addr);
_dl_exit(20);
}
val &= ~0xffff0003;
- val |= (*r_addr & 0xffff0003);
+ val |= (*r_addr & 0xffff0003);
*r_addr = val;
#ifdef DL_PRINTF_DEBUG
_dl_printf("rel 14 %x val %x\n", r_addr, val);
@@ -355,7 +355,7 @@ _dl_dcbf(r_addr);
if (cpysrc == NULL) {
_dl_printf("symbol not found [%s] \n", symn);
} else {
- size = sym->st_size;
+ size = sym->st_size;
if (sym->st_size != cpysrc->st_size) {
_dl_printf("symbols size differ [%s] \n",
symn);
diff --git a/libexec/ld.so/powerpc/syscall.h b/libexec/ld.so/powerpc/syscall.h
index 6cdf53e20b5..55916a5eddf 100644
--- a/libexec/ld.so/powerpc/syscall.h
+++ b/libexec/ld.so/powerpc/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.6 2002/05/24 03:44:38 deraadt Exp $ */
+/* $OpenBSD: syscall.h,v 1.7 2002/05/24 04:17:01 deraadt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -43,8 +43,8 @@
#ifndef _dl_MAX_ERRNO
#define _dl_MAX_ERRNO 4096
#endif
-#define _dl_check_error(__res) \
- ((int) __res < 0 && (int) __res >= -_dl_MAX_ERRNO)
+#define _dl_check_error(__res) \
+ ((int) __res < 0 && (int) __res >= -_dl_MAX_ERRNO)
/*
* Inlined system call functions that can be used before
@@ -54,87 +54,93 @@
static inline int
_dl_exit (int status)
{
- register int __status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "mr 3,%2\n\t"
- "sc"
- : "=r" (__status)
- : "r" (SYS_exit), "r" (status) : "0", "3");
- while (1)
- ;
+ register int __status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "mr 3,%2\n\t"
+ "sc"
+ : "=r" (__status)
+ : "r" (SYS_exit), "r" (status) : "0", "3");
+
+ while (1)
+ ;
}
static inline int
_dl_open (const char* addr, unsigned int flags)
{
- register int status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "mr 3,%2\n\t"
- "mr 4,%3\n\t"
- "sc\n\t"
- "cmpwi 0, 0\n\t"
- "beq 1f\n\t"
- "li 3,-1\n\t"
- "1:"
- : "=r" (status)
- : "r" (SYS_open), "r" (addr), "r" (flags)
- : "0", "3", "4" );
- return status;
+ register int status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "mr 3,%2\n\t"
+ "mr 4,%3\n\t"
+ "sc\n\t"
+ "cmpwi 0, 0\n\t"
+ "beq 1f\n\t"
+ "li 3,-1\n\t"
+ "1:"
+ : "=r" (status)
+ : "r" (SYS_open), "r" (addr), "r" (flags)
+ : "0", "3", "4" );
+ return status;
}
static inline int
_dl_close (int fd)
{
- register int status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "mr 3,%2\n\t"
- "sc\n\t"
- "cmpwi 0, 0\n\t"
- "beq 1f\n\t"
- "li 3,-1\n\t"
- "1:"
- : "=r" (status)
- : "r" (SYS_close), "r" (fd)
- : "0", "3");
- return status;
+ register int status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "mr 3,%2\n\t"
+ "sc\n\t"
+ "cmpwi 0, 0\n\t"
+ "beq 1f\n\t"
+ "li 3,-1\n\t"
+ "1:"
+ : "=r" (status)
+ : "r" (SYS_close), "r" (fd)
+ : "0", "3");
+ return status;
}
static inline int
_dl_write (int fd, const char* buf, int len)
{
- register int status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "mr 3,%2\n\t"
- "mr 4,%3\n\t"
- "mr 5,%4\n\t"
- "sc\n\t"
- "cmpwi 0, 0\n\t"
- "beq 1f\n\t"
- "li 3,-1\n\t"
- "1:"
- : "=r" (status)
- : "r" (SYS_write), "r" (fd), "r" (buf), "r" (len)
- : "0", "3", "4", "5" );
- return status;
+ register int status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "mr 3,%2\n\t"
+ "mr 4,%3\n\t"
+ "mr 5,%4\n\t"
+ "sc\n\t"
+ "cmpwi 0, 0\n\t"
+ "beq 1f\n\t"
+ "li 3,-1\n\t"
+ "1:"
+ : "=r" (status)
+ : "r" (SYS_write), "r" (fd), "r" (buf), "r" (len)
+ : "0", "3", "4", "5" );
+ return status;
}
static inline int
_dl_read (int fd, const char* buf, int len)
{
- register int status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "mr 3,%2\n\t"
- "mr 4,%3\n\t"
- "mr 5,%4\n\t"
- "sc\n\t"
- "cmpwi 0, 0\n\t"
- "beq 1f\n\t"
- "li 3,-1\n\t"
- "1:"
- : "=r" (status)
- : "r" (SYS_read), "r" (fd), "r" (buf), "r" (len)
- : "0", "3", "4", "5");
- return status;
+ register int status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "mr 3,%2\n\t"
+ "mr 4,%3\n\t"
+ "mr 5,%4\n\t"
+ "sc\n\t"
+ "cmpwi 0, 0\n\t"
+ "beq 1f\n\t"
+ "li 3,-1\n\t"
+ "1:"
+ : "=r" (status)
+ : "r" (SYS_read), "r" (fd), "r" (buf), "r" (len)
+ : "0", "3", "4", "5");
+ return status;
}
#define STRINGIFY(x) #x
@@ -153,66 +159,69 @@ __asm__(".align 2\n\t"
static int
_dl_mmap (void *addr, unsigned int len, unsigned int prot,
- unsigned int flags, int fd, off_t offset)
+ unsigned int flags, int fd, off_t offset)
{
return((int)_dl__syscall((quad_t)SYS_mmap, addr, len, prot,
- flags, fd, 0, offset));
+ flags, fd, 0, offset));
}
static inline int
_dl_munmap (const void* addr, unsigned int len)
{
- register int status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "mr 3,%2\n\t"
- "mr 4,%3\n\t"
- "sc\n\t"
- "cmpwi 0, 0\n\t"
- "beq 1f\n\t"
- "li 3,-1\n\t"
- "1:"
- : "=r" (status)
- : "r" (SYS_munmap), "r" (addr), "r" (len)
- : "0", "3", "4");
- return status;
+ register int status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "mr 3,%2\n\t"
+ "mr 4,%3\n\t"
+ "sc\n\t"
+ "cmpwi 0, 0\n\t"
+ "beq 1f\n\t"
+ "li 3,-1\n\t"
+ "1:"
+ : "=r" (status)
+ : "r" (SYS_munmap), "r" (addr), "r" (len)
+ : "0", "3", "4");
+ return status;
}
static inline int
_dl_mprotect (const void *addr, int size, int prot)
{
- register int status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "mr 3,%2\n\t"
- "mr 4,%3\n\t"
- "mr 5,%4\n\t"
- "sc\n\t"
- "cmpwi 0, 0\n\t"
- "beq 1f\n\t"
- "li 3,-1\n\t"
- "1:"
- : "=r" (status)
- : "r" (SYS_mprotect), "r" (addr), "r" (size), "r" (prot)
- : "0", "3", "4", "5");
- return status;
+ register int status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "mr 3,%2\n\t"
+ "mr 4,%3\n\t"
+ "mr 5,%4\n\t"
+ "sc\n\t"
+ "cmpwi 0, 0\n\t"
+ "beq 1f\n\t"
+ "li 3,-1\n\t"
+ "1:"
+ : "=r" (status)
+ : "r" (SYS_mprotect), "r" (addr), "r" (size), "r" (prot)
+ : "0", "3", "4", "5");
+ return status;
}
#ifdef USE_CACHE
static inline int
_dl_stat (const char *addr, struct stat *sb)
{
- register int status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "mr 3,%2\n\t"
- "mr 4,%3\n\t"
- "sc\n\t"
- "cmpwi 0, 0\n\t"
- "beq 1f\n\t"
- "li 3,-1\n\t"
- "1:"
- : "=r" (status)
- : "r" (SYS_stat), "r" (addr), "r" (sb)
- : "0", "3", "4");
- return status;
+ register int status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "mr 3,%2\n\t"
+ "mr 4,%3\n\t"
+ "sc\n\t"
+ "cmpwi 0, 0\n\t"
+ "beq 1f\n\t"
+ "li 3,-1\n\t"
+ "1:"
+ : "=r" (status)
+ : "r" (SYS_stat), "r" (addr), "r" (sb)
+ : "0", "3", "4");
+ return status;
}
#endif
@@ -220,17 +229,18 @@ _dl_stat (const char *addr, struct stat *sb)
static inline int
_dl_issetugid()
{
- register int status __asm__ ("3");
- __asm__ volatile ("mr 0,%1\n\t"
- "sc\n\t"
- "cmpwi 0, 0\n\t"
- "beq 1f\n\t"
- "li 3,-1\n\t"
- "1:"
- : "=r" (status)
- : "r" (SYS_issetugid)
- : "0", "3");
- return status;
+ register int status __asm__ ("3");
+
+ __asm__ volatile ("mr 0,%1\n\t"
+ "sc\n\t"
+ "cmpwi 0, 0\n\t"
+ "beq 1f\n\t"
+ "li 3,-1\n\t"
+ "1:"
+ : "=r" (status)
+ : "r" (SYS_issetugid)
+ : "0", "3");
+ return status;
}
#include <elf_abi.h>
#endif /*__DL_SYSCALL_H__*/