;
; Max - Test maximum number of parameters
; Copyright © 2016 Pete Batard <pete@akeo.ie> - Public Domain
;

TEST_NAME = "Max"

include 'head.inc'

  MOVIq     R1, 0xDEADBEEFDEADBEEF
  PUSH64    R1
  MOVIq     R1, 0xFFFFFFFFFFFFFFFF
  PUSH64    R1
  MOVIq     R1, 0xEEEEEEEEEEEEEEEE
  PUSH64    R1
  MOVIq     R1, 0xDDDDDDDDDDDDDDDD
  PUSH64    R1
  MOVIq     R1, 0xCCCCCCCCCCCCCCCC
  PUSH64    R1
  MOVIq     R1, 0xBBBBBBBBBBBBBBBB
  PUSH64    R1
  MOVIq     R1, 0xAAAAAAAAAAAAAAAA
  PUSH64    R1
  MOVIq     R1, 0x9999999999999999
  PUSH64    R1
  MOVIq     R1, 0x8888888888888888
  PUSH64    R1
  MOVIq     R1, 0x7777777777777777
  PUSH64    R1
  MOVIq     R1, 0x6666666666666666
  PUSH64    R1
  MOVIq     R1, 0x5555555555555555
  PUSH64    R1
  MOVIq     R1, 0x4444444444444444
  PUSH64    R1
  MOVIq     R1, 0x3333333333333333
  PUSH64    R1
  MOVIq     R1, 0x2222222222222222
  PUSH64    R1
  MOVIq     R1, 0x1111111111111111
  PUSH64    R1
  MOVIq     R1, 0x0000000000000000
  PUSH64    R1
  MOVREL    R1, CustomProtocolInterface
  MOVn      R1, @R1
  CALLEX    @R1(EFI_CUSTOM_PROTOCOL.MaxParams64)
  ; Test ADD operation on R0 while we're at it
  MOVI      R1, 136
  ADD       R0, R1
  CMPI32eq  R7, EFI_SUCCESS
  JMPcc     Failed

  MOVIq     R1, 0xDEADBEEFDEADBEEF
  PUSH64    R1
  MOVIq     R1, 0xFFFFFFFFFFFFFFFF
  PUSH64    R1
  MOVIq     R1, 0xEEEEEEEE
  PUSHn     R1
  MOVIq     R1, 0xDDDDDDDDDDDDDDDD
  PUSH64    R1
  MOVIq     R1, 0xCCCCCCCC
  PUSHn     R1
  MOVIq     R1, 0xBBBBBBBBBBBBBBBB
  PUSH64    R1
  MOVIq     R1, 0xAAAAAAAA
  PUSHn     R1
  MOVIq     R1, 0x9999999999999999
  PUSH64    R1
  MOVIq     R1, 0x88888888
  PUSHn     R1
  MOVIq     R1, 0x7777777777777777
  PUSH64    R1
  MOVIq     R1, 0x66666666
  PUSHn     R1
  MOVIq     R1, 0x5555555555555555
  PUSH64    R1
  MOVIq     R1, 0x44444444
  PUSHn     R1
  MOVIq     R1, 0x3333333333333333
  PUSH64    R1
  MOVIq     R1, 0x22222222
  PUSHn     R1
  MOVIq     R1, 0x1111111111111111
  PUSH64    R1
  MOVIq     R1, 0x00000000
  PUSHn     R1
  MOVREL    R1, CustomProtocolInterface
  MOVn      R1, @R1
  CALLEX    @R1(EFI_CUSTOM_PROTOCOL.MaxParamsMixed)
  MOV       R0, R0(+8,+72)
  CMPI32eq  R7, EFI_SUCCESS
  JMPcc     Failed

  MOVIq     R1, 0xDEADBEEFDEADBEEF
  PUSH64    R1
  MOVIq     R1, 0xFFFFFFFF
  PUSHn     R1
  MOVIq     R1, 0xEEEEEEEE
  PUSHn     R1
  MOVIq     R1, 0xDDDDDDDD
  PUSHn     R1
  MOVIq     R1, 0xCCCCCCCC
  PUSHn     R1
  MOVIq     R1, 0xBBBBBBBB
  PUSHn     R1
  MOVIq     R1, 0xAAAAAAAA
  PUSHn     R1
  MOVIq     R1, 0x99999999
  PUSHn     R1
  MOVIq     R1, 0x88888888
  PUSHn     R1
  MOVIq     R1, 0x77777777
  PUSHn     R1
  MOVIq     R1, 0x66666666
  PUSHn     R1
  MOVIq     R1, 0x55555555
  PUSHn     R1
  MOVIq     R1, 0x44444444
  PUSHn     R1
  MOVIq     R1, 0x33333333
  PUSHn     R1
  MOVIq     R1, 0x22222222
  PUSHn     R1
  MOVIq     R1, 0x11111111
  PUSHn     R1
  MOVIq     R1, 0x00000000
  PUSHn     R1
  MOVREL    R1, CustomProtocolInterface
  MOVn      R1, @R1
  CALLEX    @R1(EFI_CUSTOM_PROTOCOL.MaxParamsNatural)
  MOV       R0, R0(+16,+8)
  CMPI32eq  R7, EFI_SUCCESS
  JMPcc     Failed

include 'tail.inc'
