ppc: Minor tweaks to get the arch compile again (WIP)

- Factor in types changes (introduction of intptr_t)
- Align JamFiles syntax with in progress architectures (arm/sparc)
- Xorriso doesn't support much of the mkisofs options (anymore ?)
- (After a correct bootstrap) one should be able to build @minimum-raw and haiku-boot-cd again
Change-Id: I4f779ad8f2210389fa9b7f7c0a98c3652a64c257
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1983
Reviewed-by: François Revol <[email protected]>
This commit is contained in:
Ynoga
2019-12-04 18:34:31 +00:00
committed by Adrien Destugues
parent 4236826da6
commit 09b40d1634
15 changed files with 92 additions and 106 deletions
+4 -3
View File
@@ -1618,9 +1618,10 @@ actions BuildCDBootPPCImage1 bind MAPS
# Extras (readme files, etc) # Extras (readme files, etc)
cp $(>[4]) $(HAIKU_OUTPUT_DIR)/cd/ cp $(>[4]) $(HAIKU_OUTPUT_DIR)/cd/
xorriso -as mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg \ xorriso -as mkisofs -v -hfsplus \
-V $(VOLID) -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/boot -prep-boot \ -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/boot \
boot/haikuloader.xcf -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd -prep-boot-part $(HAIKU_OUTPUT_DIR)/cd/boot/haikuloader.xcf \
-r -J -o $(<) $(HAIKU_OUTPUT_DIR)/cd
$(RM) -r $(HAIKU_OUTPUT_DIR)/cd $(RM) -r $(HAIKU_OUTPUT_DIR)/cd
} }
+1 -1
View File
@@ -16,7 +16,7 @@ local extras = README.html ;
if $(TARGET_ARCH) = ppc { if $(TARGET_ARCH) = ppc {
local elfloader = boot_loader_openfirmware ; local elfloader = boot_loader_openfirmware ;
local coffloader = boot_loader_openfirmware_coff ; local coffloader = haiku_loader.openfirmware ;
# OpenFirmware / Mac boot support files: # OpenFirmware / Mac boot support files:
# CHRP script # CHRP script
+7 -60
View File
@@ -3,16 +3,16 @@ RemotePackageRepository HaikuPorts
: https://eu.hpkg.haiku-os.org/haikuports/master/build-packages : https://eu.hpkg.haiku-os.org/haikuports/master/build-packages
: :
# architecture "any" packages # architecture "any" packages
be_book-2008_10_26-2 be_book-2008_10_26-3
ca_root_certificates-2018_01_17-2 ca_root_certificates-2019_01_23-1
gnu_efi_kernel-3.0.8-1 gnu_efi_kernel-3.0.10-1
timgmsoundfont-fixed-5 timgmsoundfont-fixed-5
noto-20170920-3 noto-20170920-3
wqy_microhei-0.2.0~beta-4 wqy_microhei-0.2.0~beta-4
: :
# repository architecture packages # repository architecture packages
# primary architecture (ppc) # primary architecture (ppc)
bash-4.4.012-1 bash-4.4.023-1
coreutils-8.22-1 coreutils-8.22-1
curl-7.40.0-1 curl-7.40.0-1
curl_devel-7.40.0-1 curl_devel-7.40.0-1
@@ -23,8 +23,8 @@ RemotePackageRepository HaikuPorts
mawk-1.3.4-1 mawk-1.3.4-1
ncurses6-6.0-1 ncurses6-6.0-1
ncurses6_devel-6.0-1 ncurses6_devel-6.0-1
gcc_syslibs-5.4.0_2016_06_04-1 gcc_syslibs_devel-8.3.0_2019_05_24-1
gcc_syslibs_devel-5.4.0_2016_06_04-1 gcc_syslibs-8.3.0_2019_05_24-1
icu-57.1-2 icu-57.1-2
icu_devel-57.1-2 icu_devel-57.1-2
libsolv-0.3.0_haiku_2014_12_22-1 libsolv-0.3.0_haiku_2014_12_22-1
@@ -32,78 +32,25 @@ RemotePackageRepository HaikuPorts
zlib-1.2.11-1 zlib-1.2.11-1
zlib_devel-1.2.11-1 zlib_devel-1.2.11-1
: :
# source packages # source package
autoconf
automake
bash bash
# bepdf
binutils binutils
bison bison
bzip2
cdrtools
cmake
coreutils coreutils
ctags
curl curl
cvs
doxygen
expat expat
# ffmpeg
flex flex
freetype freetype
gcc gcc
gettext
git
glu
gperf
grep grep
groff
haikuwebkit
htmldoc
icu icu
jam
jpeg
keymapswitcher
libedit
libiconv
# libogg
libpcre
libpng
libsolv libsolv
# libtheora
libtool
# libvorbis
# libvpx
libxml2
m4 m4
make make
man
mercurial
mesa
mkdepend
nano
ncurses6 ncurses6
neon
openssh
openssl
p7zip
pe
perl
pkgconfig
python python
readline
scons
sed sed
# speex
sqlite
subversion
tar
texi2html
texinfo texinfo
vision
wpa_supplicant
yasm
xz_utils
zlib zlib
: :
# debuginfo packages # debuginfo packages
+4 -3
View File
@@ -3,6 +3,7 @@ BootstrapPackageRepository HaikuPortsCross
: :
# architecture "any" packages # architecture "any" packages
haikuporter-0-1 haikuporter-0-1
noto-20170202-7
: :
# repository architecture packages (stage 0) # repository architecture packages (stage 0)
gcc_bootstrap-8.3.0_2019_05_24-1 gcc_bootstrap-8.3.0_2019_05_24-1
@@ -10,9 +11,9 @@ BootstrapPackageRepository HaikuPortsCross
gcc_bootstrap_syslibs_devel-8.3.0_2019_05_24-1 gcc_bootstrap_syslibs_devel-8.3.0_2019_05_24-1
: :
# repository architecture packages (stage 1) # repository architecture packages (stage 1)
bash_bootstrap-4.4.012-1 bash_bootstrap-4.4.023-1
binutils_bootstrap-2.26.1_2016_02_29-1 binutils_bootstrap-2.28.1_2017_08_05-1
bison_bootstrap-3.0.4-5 bison_bootstrap-3.0.5-1
coreutils_bootstrap-8.22-1 coreutils_bootstrap-8.22-1
curl_bootstrap-7.40.0-1 curl_bootstrap-7.40.0-1
curl_bootstrap_devel-7.40.0-1 curl_bootstrap_devel-7.40.0-1
+3 -3
View File
@@ -2,8 +2,8 @@
* Copyright 2008, Ingo Weinhold, [email protected]. * Copyright 2008, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef SYSTEM_ARCH_X86_ASM_DEFS_H #ifndef SYSTEM_ARCH_PPC_ASM_DEFS_H
#define SYSTEM_ARCH_X86_ASM_DEFS_H #define SYSTEM_ARCH_PPC_ASM_DEFS_H
#define SYMBOL(name) .global name; name #define SYMBOL(name) .global name; name
@@ -13,5 +13,5 @@
#define FUNCTION_END(name) 1: .size name, 1b - name #define FUNCTION_END(name) 1: .size name, 1b - name
#endif /* SYSTEM_ARCH_X86_ASM_DEFS_H */ #endif /* SYSTEM_ARCH_PPC_ASM_DEFS_H */
@@ -30,7 +30,7 @@ status_t
ppc_openfirmware_pci_controller_init(void) ppc_openfirmware_pci_controller_init(void)
{ {
char path[256]; char path[256];
int cookie = 0; intptr_t cookie = 0;
while (of_get_next_device(&cookie, 0, "pci", path, sizeof(path)) while (of_get_next_device(&cookie, 0, "pci", path, sizeof(path))
== B_OK) { == B_OK) {
dprintf("ppc_openfirmware_pci_controller_init(): pci device node: %s\n", path); dprintf("ppc_openfirmware_pci_controller_init(): pci device node: %s\n", path);
@@ -65,6 +65,8 @@
|| defined(__sparc__) || defined(__riscv64__) \ || defined(__sparc__) || defined(__riscv64__) \
|| defined(__aarch64__) || defined(__arm64__) || defined(__aarch64__) || defined(__arm64__)
#define CACHE_LINE_SIZE 64 #define CACHE_LINE_SIZE 64
#elif defined(__powerpc__)
#define CACHE_LINE_SIZE 128
#else #else
#error Need definition of CACHE_LINE_SIZE for this arch! #error Need definition of CACHE_LINE_SIZE for this arch!
#endif #endif
+19 -22
View File
@@ -1,33 +1,30 @@
SubDir HAIKU_TOP src system boot arch ppc ; SubDir HAIKU_TOP src system boot arch ppc ;
{
local defines = _BOOT_MODE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;
}
local kernelLibArchObjects = local kernelLibArchObjects =
<src!system!kernel!lib!arch!$(TARGET_ARCH)>byteorder.o <src!system!kernel!lib!arch!$(TARGET_ARCH)>byteorder.o
<src!system!kernel!lib!arch!$(TARGET_ARCH)>memcpy.o <src!system!kernel!lib!arch!$(TARGET_ARCH)>memcpy.o
<src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o <src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
; ;
BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o : local platform ;
debug_uart_8250.cpp for platform in [ MultiBootSubDirSetup openfirmware ] {
arch_uart_8250.cpp on $(platform) {
arch_elf.cpp DEFINES += _BOOT_MODE ;
: # additional flags
:
$(kernelArchObjects)
$(kernelLibArchObjects)
;
SEARCH on [ FGristFiles arch_elf.cpp arch_uart_8250.cpp ] BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] :
= [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_KERNEL_ARCH) ] ; debug_uart_8250.cpp
#arch_uart_8250.cpp
arch_elf.cpp
: # additional flags
:
$(kernelArchObjects)
$(kernelLibArchObjects)
;
SEARCH on [ FGristFiles debug_uart_8250.cpp ] SEARCH on [ FGristFiles arch_elf.cpp arch_uart_8250.cpp ]
= [ FDirName $(HAIKU_TOP) src system kernel arch generic ] ; = [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_KERNEL_ARCH) ] ;
SEARCH on [ FGristFiles debug_uart_8250.cpp ]
= [ FDirName $(HAIKU_TOP) src system kernel arch generic ] ;
}
}
+1
View File
@@ -36,6 +36,7 @@ for platform in [ MultiBootSubDirSetup ] {
case "ppc" : case "ppc" :
{ {
DEFINES += DEFINES +=
BOOT_SUPPORT_ELF32 #How to deal with PPC970 ?
BOOT_SUPPORT_PARTITION_AMIGA BOOT_SUPPORT_PARTITION_AMIGA
BOOT_SUPPORT_PARTITION_APPLE BOOT_SUPPORT_PARTITION_APPLE
@@ -1,6 +1,6 @@
SubDir HAIKU_TOP src system boot platform openfirmware arch ppc ; SubDir HAIKU_TOP src system boot platform openfirmware arch ppc ;
SubDirHdrs $(HAIKU_TOP) src system boot platform $(TARGET_BOOT_PLATFORM) ; SubDirHdrs $(HAIKU_TOP) src system boot platform openfirmware ;
UsePrivateSystemHeaders ; UsePrivateSystemHeaders ;
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ]
[ FDirName kernel boot platform $(HAIKU_KERNEL_PLATFORM) ] [ FDirName kernel boot platform $(HAIKU_KERNEL_PLATFORM) ]
@@ -45,7 +45,7 @@ boot_arch_cpu_init(void)
} }
char cpuPath[256]; char cpuPath[256];
int cookie = 0; intptr_t cookie = 0;
int cpuCount = 0; int cpuCount = 0;
while (of_get_next_device(&cookie, cpus, "cpu", cpuPath, while (of_get_next_device(&cookie, cpus, "cpu", cpuPath,
sizeof(cpuPath)) == B_OK) { sizeof(cpuPath)) == B_OK) {
@@ -88,9 +88,9 @@ boot_arch_cpu_init(void)
gKernelArgs.arch_args.bus_frequency = busFrequency; gKernelArgs.arch_args.bus_frequency = busFrequency;
gKernelArgs.arch_args.time_base_frequency = timeBaseFrequency; gKernelArgs.arch_args.time_base_frequency = timeBaseFrequency;
TRACE((" CPU clock frequency: %ld\n", clockFrequency)); TRACE((" CPU clock frequency: %" B_PRId32 "\n", clockFrequency));
TRACE((" bus clock frequency: %ld\n", busFrequency)); TRACE((" bus clock frequency: %" B_PRId32 "\n", busFrequency));
TRACE((" time base frequency: %ld\n", timeBaseFrequency)); TRACE((" time base frequency: %" B_PRId32 "\n", timeBaseFrequency));
} }
cpuCount++; cpuCount++;
@@ -574,7 +574,7 @@ map_callback(struct of_arguments *args)
void *virtualAddress = (void *)args->Argument(1); void *virtualAddress = (void *)args->Argument(1);
int length = args->Argument(2); int length = args->Argument(2);
int mode = args->Argument(3); int mode = args->Argument(3);
int &error = args->ReturnValue(0); intptr_t &error = args->ReturnValue(0);
// insert range in physical allocated if needed // insert range in physical allocated if needed
@@ -618,9 +618,9 @@ static int
translate_callback(struct of_arguments *args) translate_callback(struct of_arguments *args)
{ {
addr_t virtualAddress = (addr_t)args->Argument(0); addr_t virtualAddress = (addr_t)args->Argument(0);
int &error = args->ReturnValue(0); intptr_t &error = args->ReturnValue(0);
int &physicalAddress = args->ReturnValue(1); intptr_t &physicalAddress = args->ReturnValue(1);
int &mode = args->ReturnValue(2); intptr_t &mode = args->ReturnValue(2);
// Find page table entry for this address // Find page table entry for this address
@@ -5,11 +5,13 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include "start.h" #include "start.h"
#include "machine.h" #include <string.h>
#include <OS.h>
#include <platform/openfirmware/openfirmware.h>
#include "machine.h"
extern "C" void _start(uint32 _unused1, uint32 _unused2, extern "C" void _start(uint32 _unused1, uint32 _unused2,
void *openFirmwareEntry); void *openFirmwareEntry);
+1 -1
View File
@@ -114,7 +114,7 @@ status_t
PPCOpenFirmware::Init(struct kernel_args *kernelArgs) PPCOpenFirmware::Init(struct kernel_args *kernelArgs)
{ {
return of_init( return of_init(
(int(*)(void*))kernelArgs->platform_args.openfirmware_entry); (intptr_t(*)(void*))kernelArgs->platform_args.openfirmware_entry);
} }
// InitSerialDebug // InitSerialDebug
+36 -1
View File
@@ -3,10 +3,45 @@
** Distributed under the terms of the OpenBeOS License. ** Distributed under the terms of the OpenBeOS License.
*/ */
#define FUNCTION(x) .global x; .type x,@function; x #include <asm_defs.h>
.text .text
/* uint16 __swap_int16(uint16 value)
* r3
*/
FUNCTION(__swap_int16):
rlwinm %r4, %r3, 8, 16, 23 // byte 4 -> byte 3 (clear other bits)
rlwimi %r4, %r3, 24, 24, 31 // byte 3 -> byte 4 (copy into)
mr %r3, %r4 // copy to result register
blr
/* uint32 __swap_int32(uint32 value)
* r3
*/
FUNCTION(__swap_int32):
lwbrx %r4, 0, %r3 // Load and inverse r3 into r4
mr %r3, %r4
blr
/* uint64 __swap_int64(uint64 value)
* r3/r4
*/
FUNCTION(__swap_int64):
lwbrx %r5, 0, %r3
mr %r3, %r5
lwbrx %r5, 0, %r4
mr %r4, %r5 // copy lower 32 bits
blr
/* TODO: The following functions can surely be optimized. A simple optimization
* would be to define macros with the contents of the __swap_int{32,64}
* functions and use those instead of calling the functions.
*/
/* float __swap_float(float value) /* float __swap_float(float value)
* f1 * f1
*/ */