diff --git a/build/jam/images/CDBootImage b/build/jam/images/CDBootImage index 569180e1d9..67be3c651b 100644 --- a/build/jam/images/CDBootImage +++ b/build/jam/images/CDBootImage @@ -24,6 +24,8 @@ if $(TARGET_ARCH) = ppc { local chrpscript = ofboot.chrp ; # HFS creator and application type mapping for mkisofs local hfsmaps = hfs.map ; + SEARCH on $(chrpscript) = [ FDirName $(HAIKU_TOP) data boot openfirmware ] ; + SEARCH on $(hfsmaps) = [ FDirName $(HAIKU_TOP) data boot openfirmware ] ; BuildCDBootPPCImage $(HAIKU_CD_BOOT_IMAGE) : $(hfsmaps) : $(elfloader) : $(coffloader) : $(chrpscript) : $(extras) ; diff --git a/headers/private/kernel/arch/ppc/arch_atomic.h b/headers/private/kernel/arch/ppc/arch_atomic.h index 2a4241ef32..29e6db2187 100644 --- a/headers/private/kernel/arch/ppc/arch_atomic.h +++ b/headers/private/kernel/arch/ppc/arch_atomic.h @@ -43,68 +43,4 @@ memory_full_barrier_inline(void) #define memory_full_barrier memory_full_barrier_inline -static inline void -atomic_set_inline(int32* value, int32 newValue) -{ - memory_write_barrier(); - *(volatile int32*)value = newValue; -} - - -static inline int32 -atomic_get_and_set_inline(int32* value, int32 newValue) -{ - // BIG TODO: PowerPC Atomic get and set -// asm volatile("xchgl %0, (%1)" -// : "+r" (newValue) -// : "r" (value) -// : "memory"); - return newValue; -} - - -static inline int32 -atomic_test_and_set_inline(int32* value, int32 newValue, int32 testAgainst) -{ - // BIG TODO: PowerPC Atomic test and set inline -// asm volatile("lock; cmpxchgl %2, (%3)" -// : "=a" (newValue) -// : "0" (testAgainst), "r" (newValue), "r" (value) -// : "memory"); - return newValue; -} - - -static inline int32 -atomic_add_inline(int32* value, int32 newValue) -{ - // BIG TODO: PowerPC Atomic add inline -// asm volatile("lock; xaddl %0, (%1)" -// : "+r" (newValue) -// : "r" (value) -// : "memory"); - return newValue; -} - - -static inline int32 -atomic_get_inline(int32* value) -{ - int32 newValue = *(volatile int32*)value; - memory_read_barrier(); - return newValue; -} - - -#define atomic_set atomic_set_inline -#define atomic_get_and_set atomic_get_and_set_inline -#ifndef atomic_test_and_set -# define atomic_test_and_set atomic_test_and_set_inline -#endif -#ifndef atomic_add -# define atomic_add atomic_add_inline -#endif -#define atomic_get atomic_get_inline - - #endif // _KERNEL_ARCH_PPC_ATOMIC_H diff --git a/headers/private/kernel/platform/openfirmware/openfirmware.h b/headers/private/kernel/platform/openfirmware/openfirmware.h index 361cb3cea8..86bd280c2f 100644 --- a/headers/private/kernel/platform/openfirmware/openfirmware.h +++ b/headers/private/kernel/platform/openfirmware/openfirmware.h @@ -66,6 +66,8 @@ extern void of_close(intptr_t handle); extern intptr_t of_read(intptr_t handle, void *buffer, intptr_t bufferSize); extern intptr_t of_write(intptr_t handle, const void *buffer, intptr_t bufferSize); extern intptr_t of_seek(intptr_t handle, off_t pos); +extern intptr_t of_blocks(intptr_t handle); +extern intptr_t of_block_size(intptr_t handle); /* memory functions */ extern intptr_t of_release(void *virtualAddress, intptr_t size); diff --git a/src/system/kernel/platform/openfirmware/openfirmware.cpp b/src/system/kernel/platform/openfirmware/openfirmware.cpp index a803a207c3..77be90c071 100644 --- a/src/system/kernel/platform/openfirmware/openfirmware.cpp +++ b/src/system/kernel/platform/openfirmware/openfirmware.cpp @@ -493,6 +493,42 @@ of_seek(intptr_t handle, off_t pos) } +intptr_t +of_blocks(intptr_t handle) +{ + struct { + const char *name; + intptr_t num_args; + intptr_t num_returns; + intptr_t handle; + intptr_t result; + intptr_t blocks; + } args = {"#blocks", 2, 1, handle, 0, 0}; + + if (gCallOpenFirmware(&args) == OF_FAILED) + return OF_FAILED; + return args.blocks; +} + + +intptr_t +of_block_size(intptr_t handle) +{ + struct { + const char *name; + intptr_t num_args; + intptr_t num_returns; + intptr_t handle; + intptr_t result; + intptr_t size; + } args = {"block-size", 2, 1, handle, 0, 0}; + + if (gCallOpenFirmware(&args) == OF_FAILED) + return OF_FAILED; + return args.size; +} + + // memory functions