From d00e5c38555f91630f45526fa4f8e338bda50a03 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Fri, 15 Jun 2018 00:31:47 +0000 Subject: [PATCH] Update kernel's proc32.inc from fasm source * Resulting kernel.bin did not change. * This file had KolibriOS copyright header which I did not preserve because we use it unchanged as shipped with fasm. git-svn-id: svn://kolibrios.org@7294 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/proc32.inc | 54 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/kernel/trunk/proc32.inc b/kernel/trunk/proc32.inc index e82b292605..de069faa00 100644 --- a/kernel/trunk/proc32.inc +++ b/kernel/trunk/proc32.inc @@ -1,12 +1,3 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -$Revision$ - ; Macroinstructions for defining and calling procedures @@ -64,11 +55,15 @@ macro proc [args] ; define procedure prologue@proc equ prologuedef macro prologuedef procname,flag,parmbytes,localbytes,reglist - { if parmbytes | localbytes + { local loc + loc = (localbytes+3) and (not 3) + parmbase@proc equ ebp+8 + localbase@proc equ ebp-loc + if parmbytes | localbytes push ebp mov ebp, esp if localbytes - sub esp, localbytes + sub esp, loc end if end if irps reg, reglist \{ push reg \} } @@ -80,12 +75,14 @@ macro epiloguedef procname,flag,parmbytes,localbytes,reglist if parmbytes | localbytes leave end if - if (flag and 10000b) | (parmbytes=0) + if flag and 10000b retn else retn parmbytes end if } +close@proc equ + macro define@proc name,statement { local params,flag,regs,parmbytes,localbytes,current if used name @@ -100,24 +97,25 @@ macro define@proc name,statement flag = 10001b \} match =params, params \{ params equ statement flag = 0 \} - virtual at ebp+8 match =uses reglist=,args, params \{ regs equ reglist params equ args \} match =regs =uses reglist, regs params \{ regs equ reglist params equ \} match =regs, regs \{ regs equ \} + match prologue:reglist, prologue@proc: \{ prologue name,flag,parmbytes,localbytes,reglist \} + virtual at parmbase@proc match =,args, params \{ defargs@proc args \} match =args@proc args, args@proc params \{ defargs@proc args \} - parmbytes = $ - (ebp+8) + parmbytes = $-(parmbase@proc) end virtual name # % = parmbytes/4 all@vars equ current = 0 - match prologue:reglist, prologue@proc: \{ prologue name,flag,parmbytes,localbytes,reglist \} macro locals - \{ virtual at ebp-localbytes+current - macro label . \\{ deflocal@proc .,:, \\} + \{ virtual at localbase@proc+current + macro label def \\{ match . type,def> \\\{ deflocal@proc .,label, - \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} - macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2 - end if \} } + match , operand \\{ match epilogue:reglist, epilogue@proc: \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} + macro finish@proc + \{ localbytes = current + match close:reglist, close@proc: \\{ close name,flag,parmbytes,localbytes,reglist \\} + end if \} } macro defargs@proc [arg] { common @@ -172,6 +170,8 @@ macro defargs@proc [arg] common end if } +macro deflocal@proc name,def,[val] { name def val } + macro deflocal@proc name,def,[val] { common match vars, all@vars \{ all@vars equ all@vars, \} @@ -180,7 +180,9 @@ macro deflocal@proc name,def,[val] local ..var,..tmp ..var def val match =?, val \{ ..tmp equ \} - match any =dup (=?), val \{ ..tmp equ \} + match any =?, val \{ ..tmp equ \} + match any (=?), val \{ ..tmp equ \} + match =label, def \{ ..tmp equ \} match tmp : value, ..tmp : val \{ tmp: end virtual initlocal@proc ..var,def value @@ -188,6 +190,8 @@ macro deflocal@proc name,def,[val] common match first rest, ..var, \{ name equ first \} } +struc label type { label . type } + macro initlocal@proc name,def { virtual at name def