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 <revol@free.fr>
This commit is contained in:
Ynoga 2019-12-03 08:43:16 +00:00 committed by Adrien Destugues
parent 4236826da6
commit 09b40d1634
15 changed files with 92 additions and 106 deletions

View File

@ -1618,9 +1618,10 @@ actions BuildCDBootPPCImage1 bind MAPS
# Extras (readme files, etc)
cp $(>[4]) $(HAIKU_OUTPUT_DIR)/cd/
xorriso -as mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg \
-V $(VOLID) -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/boot -prep-boot \
boot/haikuloader.xcf -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd
xorriso -as mkisofs -v -hfsplus \
-hfs-bless $(HAIKU_OUTPUT_DIR)/cd/boot \
-prep-boot-part $(HAIKU_OUTPUT_DIR)/cd/boot/haikuloader.xcf \
-r -J -o $(<) $(HAIKU_OUTPUT_DIR)/cd
$(RM) -r $(HAIKU_OUTPUT_DIR)/cd
}

View File

@ -16,7 +16,7 @@ local extras = README.html ;
if $(TARGET_ARCH) = ppc {
local elfloader = boot_loader_openfirmware ;
local coffloader = boot_loader_openfirmware_coff ;
local coffloader = haiku_loader.openfirmware ;
# OpenFirmware / Mac boot support files:
# CHRP script

View File

@ -3,16 +3,16 @@ RemotePackageRepository HaikuPorts
: https://eu.hpkg.haiku-os.org/haikuports/master/build-packages
:
# architecture "any" packages
be_book-2008_10_26-2
ca_root_certificates-2018_01_17-2
gnu_efi_kernel-3.0.8-1
be_book-2008_10_26-3
ca_root_certificates-2019_01_23-1
gnu_efi_kernel-3.0.10-1
timgmsoundfont-fixed-5
noto-20170920-3
wqy_microhei-0.2.0~beta-4
:
# repository architecture packages
# primary architecture (ppc)
bash-4.4.012-1
bash-4.4.023-1
coreutils-8.22-1
curl-7.40.0-1
curl_devel-7.40.0-1
@ -23,8 +23,8 @@ RemotePackageRepository HaikuPorts
mawk-1.3.4-1
ncurses6-6.0-1
ncurses6_devel-6.0-1
gcc_syslibs-5.4.0_2016_06_04-1
gcc_syslibs_devel-5.4.0_2016_06_04-1
gcc_syslibs_devel-8.3.0_2019_05_24-1
gcc_syslibs-8.3.0_2019_05_24-1
icu-57.1-2
icu_devel-57.1-2
libsolv-0.3.0_haiku_2014_12_22-1
@ -32,78 +32,25 @@ RemotePackageRepository HaikuPorts
zlib-1.2.11-1
zlib_devel-1.2.11-1
:
# source packages
autoconf
automake
# source package
bash
# bepdf
binutils
bison
bzip2
cdrtools
cmake
coreutils
ctags
curl
cvs
doxygen
expat
# ffmpeg
flex
freetype
gcc
gettext
git
glu
gperf
grep
groff
haikuwebkit
htmldoc
icu
jam
jpeg
keymapswitcher
libedit
libiconv
# libogg
libpcre
libpng
libsolv
# libtheora
libtool
# libvorbis
# libvpx
libxml2
m4
make
man
mercurial
mesa
mkdepend
nano
ncurses6
neon
openssh
openssl
p7zip
pe
perl
pkgconfig
python
readline
scons
sed
# speex
sqlite
subversion
tar
texi2html
texinfo
vision
wpa_supplicant
yasm
xz_utils
zlib
:
# debuginfo packages

View File

@ -3,6 +3,7 @@ BootstrapPackageRepository HaikuPortsCross
:
# architecture "any" packages
haikuporter-0-1
noto-20170202-7
:
# repository architecture packages (stage 0)
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
:
# repository architecture packages (stage 1)
bash_bootstrap-4.4.012-1
binutils_bootstrap-2.26.1_2016_02_29-1
bison_bootstrap-3.0.4-5
bash_bootstrap-4.4.023-1
binutils_bootstrap-2.28.1_2017_08_05-1
bison_bootstrap-3.0.5-1
coreutils_bootstrap-8.22-1
curl_bootstrap-7.40.0-1
curl_bootstrap_devel-7.40.0-1

View File

@ -2,8 +2,8 @@
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef SYSTEM_ARCH_X86_ASM_DEFS_H
#define SYSTEM_ARCH_X86_ASM_DEFS_H
#ifndef SYSTEM_ARCH_PPC_ASM_DEFS_H
#define SYSTEM_ARCH_PPC_ASM_DEFS_H
#define SYMBOL(name) .global name; name
@ -13,5 +13,5 @@
#define FUNCTION_END(name) 1: .size name, 1b - name
#endif /* SYSTEM_ARCH_X86_ASM_DEFS_H */
#endif /* SYSTEM_ARCH_PPC_ASM_DEFS_H */

View File

@ -30,7 +30,7 @@ status_t
ppc_openfirmware_pci_controller_init(void)
{
char path[256];
int cookie = 0;
intptr_t cookie = 0;
while (of_get_next_device(&cookie, 0, "pci", path, sizeof(path))
== B_OK) {
dprintf("ppc_openfirmware_pci_controller_init(): pci device node: %s\n", path);

View File

@ -65,6 +65,8 @@
|| defined(__sparc__) || defined(__riscv64__) \
|| defined(__aarch64__) || defined(__arm64__)
#define CACHE_LINE_SIZE 64
#elif defined(__powerpc__)
#define CACHE_LINE_SIZE 128
#else
#error Need definition of CACHE_LINE_SIZE for this arch!
#endif

View File

@ -1,33 +1,30 @@
SubDir HAIKU_TOP src system boot arch ppc ;
{
local defines = _BOOT_MODE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;
}
local kernelLibArchObjects =
<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)>memset.o
;
BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
debug_uart_8250.cpp
arch_uart_8250.cpp
arch_elf.cpp
: # additional flags
:
$(kernelArchObjects)
$(kernelLibArchObjects)
;
local platform ;
for platform in [ MultiBootSubDirSetup openfirmware ] {
on $(platform) {
DEFINES += _BOOT_MODE ;
SEARCH on [ FGristFiles arch_elf.cpp arch_uart_8250.cpp ]
= [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_KERNEL_ARCH) ] ;
BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] :
debug_uart_8250.cpp
#arch_uart_8250.cpp
arch_elf.cpp
: # additional flags
:
$(kernelArchObjects)
$(kernelLibArchObjects)
;
SEARCH on [ FGristFiles debug_uart_8250.cpp ]
= [ FDirName $(HAIKU_TOP) src system kernel arch generic ] ;
SEARCH on [ FGristFiles arch_elf.cpp arch_uart_8250.cpp ]
= [ 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 ] ;
}
}

View File

@ -36,6 +36,7 @@ for platform in [ MultiBootSubDirSetup ] {
case "ppc" :
{
DEFINES +=
BOOT_SUPPORT_ELF32 #How to deal with PPC970 ?
BOOT_SUPPORT_PARTITION_AMIGA
BOOT_SUPPORT_PARTITION_APPLE

View File

@ -1,6 +1,6 @@
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 ;
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ]
[ FDirName kernel boot platform $(HAIKU_KERNEL_PLATFORM) ]

View File

@ -45,7 +45,7 @@ boot_arch_cpu_init(void)
}
char cpuPath[256];
int cookie = 0;
intptr_t cookie = 0;
int cpuCount = 0;
while (of_get_next_device(&cookie, cpus, "cpu", cpuPath,
sizeof(cpuPath)) == B_OK) {
@ -88,9 +88,9 @@ boot_arch_cpu_init(void)
gKernelArgs.arch_args.bus_frequency = busFrequency;
gKernelArgs.arch_args.time_base_frequency = timeBaseFrequency;
TRACE((" CPU clock frequency: %ld\n", clockFrequency));
TRACE((" bus clock frequency: %ld\n", busFrequency));
TRACE((" time base frequency: %ld\n", timeBaseFrequency));
TRACE((" CPU clock frequency: %" B_PRId32 "\n", clockFrequency));
TRACE((" bus clock frequency: %" B_PRId32 "\n", busFrequency));
TRACE((" time base frequency: %" B_PRId32 "\n", timeBaseFrequency));
}
cpuCount++;

View File

@ -574,7 +574,7 @@ map_callback(struct of_arguments *args)
void *virtualAddress = (void *)args->Argument(1);
int length = args->Argument(2);
int mode = args->Argument(3);
int &error = args->ReturnValue(0);
intptr_t &error = args->ReturnValue(0);
// insert range in physical allocated if needed
@ -618,9 +618,9 @@ static int
translate_callback(struct of_arguments *args)
{
addr_t virtualAddress = (addr_t)args->Argument(0);
int &error = args->ReturnValue(0);
int &physicalAddress = args->ReturnValue(1);
int &mode = args->ReturnValue(2);
intptr_t &error = args->ReturnValue(0);
intptr_t &physicalAddress = args->ReturnValue(1);
intptr_t &mode = args->ReturnValue(2);
// Find page table entry for this address

View File

@ -5,11 +5,13 @@
* Distributed under the terms of the MIT License.
*/
#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,
void *openFirmwareEntry);

View File

@ -114,7 +114,7 @@ status_t
PPCOpenFirmware::Init(struct kernel_args *kernelArgs)
{
return of_init(
(int(*)(void*))kernelArgs->platform_args.openfirmware_entry);
(intptr_t(*)(void*))kernelArgs->platform_args.openfirmware_entry);
}
// InitSerialDebug

View File

@ -3,10 +3,45 @@
** Distributed under the terms of the OpenBeOS License.
*/
#define FUNCTION(x) .global x; .type x,@function; x
#include <asm_defs.h>
.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)
* f1
*/