Author Topic: Unified Extensible Firmware Interface (UEFI) Example  (Read 2129 times)

jj2007

  • Member
  • *****
  • Posts: 9802
  • Assembler is fun ;-)
    • MasmBasic
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #60 on: October 23, 2019, 12:07:52 AM »
It works, Timo :thumbsup:

Code: [Select]
1750 ms  Uasm64msvcrt, ML 6.15 & 10.0
1500 ms  Uasm64
1400 ms  Uasm64libc
1150 ms  AsmC

johnsa

  • Member
  • ****
  • Posts: 791
    • Uasm
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #61 on: October 24, 2019, 12:01:28 AM »
I get a general failure using this libc version on some of my test pieces

TimoVJL

  • Member
  • ***
  • Posts: 476
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #62 on: October 24, 2019, 02:36:35 AM »
 :sad:
« Last Edit: October 27, 2019, 05:04:16 AM by TimoVJL »
May the source be with you

TimoVJL

  • Member
  • ***
  • Posts: 476
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #63 on: October 25, 2019, 07:04:34 AM »
 :sad:
« Last Edit: October 27, 2019, 05:04:30 AM by TimoVJL »
May the source be with you

AW

  • Member
  • *****
  • Posts: 2442
  • Let's Make ASM Great Again!
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #64 on: October 25, 2019, 08:07:21 AM »
I turned the internal macros into external MACROS (see below) to debug better, but the error is not related to the macros, as I thought initially. I.e, the internal macros are good.

The error will disappear if we uncomment the line 'pConsole         PCONOUT 0' (see below), i.e the origin of the error 'Invalid use of pointer operator' is tracked and makes sense:

Code: [Select]
.x64p
OPTION WIN64:15
OPTION STACKBASE:Rsp
OPTION LITERALS:ON
OPTION ARCH:AVX
OPTION CASEMAP:NONE

RAWINTERFACE MACRO CName:REQ
curClass TEXTEQU <CName>
% __&CName&_size = 0
@CatStr(CName, < RAWSTRUCT >)
ptrDefS TEXTEQU <psr>
ptrDefS CATSTR ptrDefS, <&curClass&>, < TYPEDEF PTR >, <&curClass&>
% ptrDefS
;% echo _ptrDefS= ptrDefS
ENDM

ENDRAWINTERFACE MACRO
curClass ENDS
.data
% _stat&curClass& curClass <>
ENDM

STDFUNC MACRO method:REQ, retType:REQ, protoDef:VARARG
LOCAL sz1, sz2
pDef CATSTR <TYPEDEF PROTO >,<(&retType&) >
;% echo _pedef= pDef
IFNB <protoDef>
pDef CATSTR pDef, <, >, <&protoDef>
ENDIF
sz2 CATSTR <_>, curClass, <_&method>, <Pto>
% &sz2 &pDef
% sz1 typedef PTR &sz2
% method sz1 0
% __&curClass&_size = __&curClass&_size + 8
fnex TEXTEQU <_>
fnex CATSTR fnex, curClass, <_>, <&method&>, < PROTO >, <(&retType&) >

IFNB <&protoDef>
fnex CATSTR fnex, <, >, <&protoDef&>
ELSE
ENDIF
fnex
; % echo _fnex= fnex
ENDM

CHAR16     TYPEDEF WORD
P_CHAR16   TYPEDEF PTR CHAR16

RAWINTERFACE ConOut
STDFUNC OutputString, <voidarg>, pThis:PTR _ConOut, pStr:P_CHAR16
ENDRAWINTERFACE
PCONOUT TYPEDEF PTR ConOut

.data

;pConsole         PCONOUT 0 ; If we uncomment NO error
hexSTR dw 20 DUP (0)


.code

main PROC FRAME pConsoleOut:PCONOUT
pConsole->OutputString(pConsole, &hexSTR)
ret
main ENDP

END

jj2007

  • Member
  • *****
  • Posts: 9802
  • Assembler is fun ;-)
    • MasmBasic
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #65 on: October 27, 2019, 12:02:00 AM »
Works fine but AsmC is a tick faster (1400 vs 1050 ms for 21k lines test case) :thumbsup:

TimoVJL

  • Member
  • ***
  • Posts: 476
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #66 on: October 27, 2019, 12:28:48 AM »
Why: no site interest, so i save site space :sad:
Experts should fix obvious things, so why i bother :undecided:
« Last Edit: October 27, 2019, 05:16:22 AM by TimoVJL »
May the source be with you

johnsa

  • Member
  • ****
  • Posts: 791
    • Uasm
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #67 on: October 27, 2019, 06:50:47 AM »
I've applied Timo's fixes in 2.50 branch now as well and can confirm it solves the bug AW showed last. A proper error is now reporting when pConsole is not defined, and assembly completes as expected when it is defined.

TimoVJL

  • Member
  • ***
  • Posts: 476
Re: Unified Extensible Firmware Interface (UEFI) Example
« Reply #68 on: October 27, 2019, 09:29:25 PM »
gcc and clang compiles it OK :thumbsup:
May the source be with you