From abff64f38c988a5350cbeb243896c0ee30401058 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 5 Oct 2025 09:46:50 +0200 Subject: feat: launch: reworking launch program. feat: boot: Use NB prefix instead of CB. feat: kernel: Use more portable types. Signed-off-by: Amlal El Mahrouss --- dev/boot/src/HEL/ARM64/BootCB.S | 40 ---------------------------------------- dev/boot/src/HEL/ARM64/BootNB.S | 40 ++++++++++++++++++++++++++++++++++++++++ dev/boot/src/HEL/POWER/BootCB.S | 34 ---------------------------------- dev/boot/src/HEL/POWER/BootNB.S | 34 ++++++++++++++++++++++++++++++++++ dev/kernel/NeKit/Defines.h | 14 +++++++------- dev/launch/LaunchKit/LaunchKit.h | 4 ++-- dev/launch/src/LaunchSrv.cc | 2 +- 7 files changed, 84 insertions(+), 84 deletions(-) delete mode 100644 dev/boot/src/HEL/ARM64/BootCB.S create mode 100644 dev/boot/src/HEL/ARM64/BootNB.S delete mode 100644 dev/boot/src/HEL/POWER/BootCB.S create mode 100644 dev/boot/src/HEL/POWER/BootNB.S (limited to 'dev') diff --git a/dev/boot/src/HEL/ARM64/BootCB.S b/dev/boot/src/HEL/ARM64/BootCB.S deleted file mode 100644 index d52c1dcf..00000000 --- a/dev/boot/src/HEL/ARM64/BootCB.S +++ /dev/null @@ -1,40 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. - -------------------------------------------- */ - -#ifdef __NE_NEBOOT__ - -.section .boot_hdr -.align 4 - -/* BootZ boot header begin */ - -boot_hdr_mag: - .ascii "CB" -boot_hdr_name: - // it has to match ten bytes. - .asciz "bootz\0\0\0" -boot_hdr_ver: - .word 0x101 -boot_hdr_proc: - .long bootloader_start - -/* BootZ boot header end */ - -.extern bootloader_main -.extern bootloader_stack - -.globl bootloader_start -bootloader_start: - adr x0, bootloader_stack - ldr x1, =bootloader_start - sub x0, x0, x1 - ldr x0, [x0] - mov sp, x0 - - bl bootloader_main - ret - -#endif // __NE_NEBOOT__ \ No newline at end of file diff --git a/dev/boot/src/HEL/ARM64/BootNB.S b/dev/boot/src/HEL/ARM64/BootNB.S new file mode 100644 index 00000000..d52c1dcf --- /dev/null +++ b/dev/boot/src/HEL/ARM64/BootNB.S @@ -0,0 +1,40 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#ifdef __NE_NEBOOT__ + +.section .boot_hdr +.align 4 + +/* BootZ boot header begin */ + +boot_hdr_mag: + .ascii "CB" +boot_hdr_name: + // it has to match ten bytes. + .asciz "bootz\0\0\0" +boot_hdr_ver: + .word 0x101 +boot_hdr_proc: + .long bootloader_start + +/* BootZ boot header end */ + +.extern bootloader_main +.extern bootloader_stack + +.globl bootloader_start +bootloader_start: + adr x0, bootloader_stack + ldr x1, =bootloader_start + sub x0, x0, x1 + ldr x0, [x0] + mov sp, x0 + + bl bootloader_main + ret + +#endif // __NE_NEBOOT__ \ No newline at end of file diff --git a/dev/boot/src/HEL/POWER/BootCB.S b/dev/boot/src/HEL/POWER/BootCB.S deleted file mode 100644 index 3887ff10..00000000 --- a/dev/boot/src/HEL/POWER/BootCB.S +++ /dev/null @@ -1,34 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. - -------------------------------------------- */ - -.section .boot_hdr -.align 4 - -/* BootZ boot header begin */ - -boot_hdr_mag: - .ascii "CB" -boot_hdr_name: - // it has to match ten bytes. - .asciz "bootz\0\0\0" -boot_hdr_ver: - .word 0x101 -boot_hdr_proc: - .long bootloader_start - -/* BootZ boot header end */ - -.extern bootloader_main -.extern bootloader_stack - -.globl bootloader_start -bootloader_start: - mflr 4 /* real address of .Laddr */ - lwz 0,(bootloader_stack-bootloader_start)(4) /* stack address location */ - mr 1,0 /* use user defined stack */ - - bl bootloader_main - blr diff --git a/dev/boot/src/HEL/POWER/BootNB.S b/dev/boot/src/HEL/POWER/BootNB.S new file mode 100644 index 00000000..3887ff10 --- /dev/null +++ b/dev/boot/src/HEL/POWER/BootNB.S @@ -0,0 +1,34 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +.section .boot_hdr +.align 4 + +/* BootZ boot header begin */ + +boot_hdr_mag: + .ascii "CB" +boot_hdr_name: + // it has to match ten bytes. + .asciz "bootz\0\0\0" +boot_hdr_ver: + .word 0x101 +boot_hdr_proc: + .long bootloader_start + +/* BootZ boot header end */ + +.extern bootloader_main +.extern bootloader_stack + +.globl bootloader_start +bootloader_start: + mflr 4 /* real address of .Laddr */ + lwz 0,(bootloader_stack-bootloader_start)(4) /* stack address location */ + mr 1,0 /* use user defined stack */ + + bl bootloader_main + blr diff --git a/dev/kernel/NeKit/Defines.h b/dev/kernel/NeKit/Defines.h index 27f4f127..c5f02e0a 100644 --- a/dev/kernel/NeKit/Defines.h +++ b/dev/kernel/NeKit/Defines.h @@ -35,13 +35,13 @@ using nullPtr = decltype(nullptr); using NullPtr = decltype(nullptr); using Int = int; -using Int32 = int; -using UShort = unsigned short; -using UInt16 = unsigned short; +using Int32 = __INT32_TYPE__; +using UShort = __UINT16_TYPE__; +using UInt16 = __UINT16_TYPE__; using Short = short; using Int16 = short; -using UInt = unsigned int; -using UInt32 = unsigned int; +using UInt = __UINT32_TYPE__; +using UInt32 = __UINT32_TYPE__; using Long = __INT64_TYPE__; using Int64 = __INT64_TYPE__; using ULong = __UINT64_TYPE__; @@ -49,8 +49,8 @@ using UInt64 = __UINT64_TYPE__; using Boolean = bool; using Bool = bool; using Char = char; -using UChar = unsigned char; -using UInt8 = unsigned char; +using UChar = __UINT8_TYPE__; +using UInt8 = __UINT8_TYPE__; using SSize = Int64; using SSizeT = Int64; diff --git a/dev/launch/LaunchKit/LaunchKit.h b/dev/launch/LaunchKit/LaunchKit.h index 2fa9607b..2efa7806 100644 --- a/dev/launch/LaunchKit/LaunchKit.h +++ b/dev/launch/LaunchKit/LaunchKit.h @@ -15,6 +15,6 @@ #define NELAUNCH_WARN(MSG) PrintOut(nullptr, "WARN: [LAUNCH] %s\n", MSG) namespace Launch { -using LaunchHandle = VoidPtr; -using KernelStatus = SInt32; +using LaunchAny = VoidPtr; +using LaunchStatus = SInt32; } // namespace Launch diff --git a/dev/launch/src/LaunchSrv.cc b/dev/launch/src/LaunchSrv.cc index f5c9ee3c..b79fedf5 100644 --- a/dev/launch/src/LaunchSrv.cc +++ b/dev/launch/src/LaunchSrv.cc @@ -11,7 +11,7 @@ extern "C" SInt32 nelaunch_startup_fn(Void) { /// @todo Start LaunchServices.fwrk services, make the launcher manageable too (via mgmt.launch) - NELAUNCH_INFO("Starting NeKernel services..."); + NELAUNCH_INFO("Registering NeKernel Launcher..."); return kErrorSuccess; } -- cgit v1.2.3