|
;; $Id: macros.inc,v 1.1 2007-09-01 22:44:05 niro Exp $ |
|
1 |
;; ----------------------------------------------------------------------- |
;; ----------------------------------------------------------------------- |
2 |
;; |
;; |
3 |
;; Copyright 1994-2004 H. Peter Anvin - All Rights Reserved |
;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved |
4 |
|
;; Copyright 2009 Intel Corporation; author: H. Peter Anvin |
5 |
;; |
;; |
6 |
;; This program is free software; you can redistribute it and/or modify |
;; This program is free software; you can redistribute it and/or modify |
7 |
;; it under the terms of the GNU General Public License as published by |
;; it under the terms of the GNU General Public License as published by |
13 |
|
|
14 |
;; |
;; |
15 |
;; macros.inc |
;; macros.inc |
16 |
;; |
;; |
17 |
;; Convenient macros |
;; Convenient macros |
18 |
;; |
;; |
19 |
|
|
24 |
; Identify the module we're compiling; the "correct" should be defined |
; Identify the module we're compiling; the "correct" should be defined |
25 |
; in the module itself to 1 |
; in the module itself to 1 |
26 |
; |
; |
27 |
%ifndef IS_SYSLINUX |
%ifdef IS_SYSLINUX |
28 |
%define IS_SYSLINUX 0 |
%define MY_NAME 'SYSLINUX' |
29 |
%endif |
%else |
30 |
%ifndef IS_MDSLINUX |
%define IS_SYSLINUX 0 |
31 |
%define IS_MDSLINUX 0 |
%endif |
32 |
%endif |
%ifdef IS_PXELINUX |
33 |
%ifndef IS_PXELINUX |
%define MY_NAME 'PXELINUX' |
34 |
%define IS_PXELINUX 0 |
%else |
35 |
%endif |
%define IS_PXELINUX 0 |
36 |
%ifndef IS_ISOLINUX |
%endif |
37 |
%define IS_ISOLINUX 0 |
%ifdef IS_ISOLINUX |
38 |
%endif |
%define MY_NAME 'ISOLINUX' |
39 |
%ifndef IS_EXTLINUX |
%else |
40 |
%define IS_EXTLINUX 0 |
%define IS_ISOLINUX 0 |
41 |
|
%endif |
42 |
|
%ifdef IS_EXTLINUX |
43 |
|
%define MY_NAME 'EXTLINUX' |
44 |
|
%else |
45 |
|
%define IS_EXTLINUX 0 |
46 |
%endif |
%endif |
47 |
|
|
48 |
; |
; |
62 |
%endmacro |
%endmacro |
63 |
|
|
64 |
; |
; |
65 |
|
; Align with zero bytes in a progbits segment |
66 |
|
; |
67 |
|
%macro alignz 1.nolist |
68 |
|
times (((%1) - (($-$$) % (%1))) % (%1)) db 0 |
69 |
|
%endmacro |
70 |
|
|
71 |
|
; |
72 |
; Macro to emit an unsigned decimal number as a string |
; Macro to emit an unsigned decimal number as a string |
73 |
; |
; |
74 |
%macro asciidec 1.nolist |
%macro asciidec 1.nolist |
75 |
%ifndef DEPEND ; Not safe for "depend" |
%ifndef DEPEND ; Not safe for "depend" |
76 |
%if %1 >= 1000000000 |
%push asciidec |
77 |
db ((%1/1000000000) % 10) + '0' |
%assign %$v %1 |
78 |
%endif |
%if %$v == 0 |
79 |
%if %1 >= 100000000 |
db '0' |
80 |
db ((%1/100000000) % 10) + '0' |
%else |
81 |
%endif |
%assign %$dcount 0 |
82 |
%if %1 >= 10000000 |
%assign %$n %$v |
83 |
db ((%1/10000000) % 10) + '0' |
%assign %$d 1 |
84 |
%endif |
%rep 20 |
85 |
%if %1 >= 1000000 |
%if %$n != 0 |
86 |
db ((%1/1000000) % 10) + '0' |
%assign %$dcount %$dcount + 1 |
87 |
%endif |
%assign %$n %$n / 10 |
88 |
%if %1 >= 100000 |
%assign %$d %$d * 10 |
89 |
db ((%1/100000) % 10) + '0' |
%endif |
90 |
%endif |
%endrep |
91 |
%if %1 >= 10000 |
%rep %$dcount |
92 |
db ((%1/10000) % 10) + '0' |
%assign %$d %$d / 10 |
93 |
%endif |
db ((%$v / %$d) % 10) + '0' |
94 |
%if %1 >= 1000 |
%endrep |
95 |
db ((%1/1000) % 10) + '0' |
%endif |
96 |
%endif |
%pop |
97 |
%if %1 >= 100 |
%endif |
|
db ((%1/100) % 10) + '0' |
|
|
%endif |
|
|
%if %1 >= 10 |
|
|
db ((%1/10) % 10) + '0' |
|
|
%endif |
|
|
db (%1 % 10) + '0' |
|
|
%endif |
|
98 |
%endmacro |
%endmacro |
99 |
|
|
100 |
; |
; |