setos

拙OS
Log | Files | Refs | LICENSE

commit f273e324237c6f0366dfc40a0c3ff0fa2d3cdf7c
parent 74f74b5ebc22d4699e3645d66dd9b0b9914d4293
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Sun, 31 Mar 2024 07:10:26 +0900

add __attribute__((ms_abi)) and comile option -mabi=sysv.
is it portable?

Diffstat:
M.gitignore | 2+-
MMakefile | 2+-
Mkernel/main.c | 3+--
Muefi/uefi.c | 2+-
Muefi/uefi.h | 2+-
5 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,2 +1,2 @@ -include +edk2 OVMF.fd diff --git a/Makefile b/Makefile @@ -1,5 +1,5 @@ EFI_CFLAGS = -nostdlib -fpic -mno-red-zone -fno-stack-protector -static \ - -fno-builtin -g \ + -fno-builtin -g -mabi=sysv \ -mno-stack-arg-probe -Wall -e EfiMain KERN_CFLAGS = -nostdlib -fpic -mno-red-zone -ffreestanding -Wall -g KERN_LDFLAGS = -e kernel_main -static diff --git a/kernel/main.c b/kernel/main.c @@ -6,8 +6,7 @@ typedef unsigned long long int uint64_t; // Argument order is to interface to the MS-ABI void -kernel_main(void *dummy0, void *dummy1, void *dummy2, - EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) +kernel_main(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) { uint32_t *fb_base = (uint32_t *)gop->Mode->FrameBufferBase; uint32_t hrez = gop->Mode->Info->HorizontalResolution; diff --git a/uefi/uefi.c b/uefi/uefi.c @@ -2,7 +2,7 @@ #include "utils.h" EFI_SYSTEM_TABLE *SystemTable; -EFI_STATUS +EFI_STATUS EFIAPI EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *systab) { // init global variable. diff --git a/uefi/uefi.h b/uefi/uefi.h @@ -2,7 +2,7 @@ #define OUT #define OPTIONAL #define CONST -#define EFIAPI +#define EFIAPI __attribute__((ms_abi)) #define NULL 0L