📄 plibc.lst
字号:
ARM COMPILER V2.42, plibc 27/03/06 10:45:52 PAGE 1
ARM COMPILER V2.42, COMPILATION OF MODULE plibc
OBJECT MODULE PLACED IN .\obj\plibc.obj
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe src\plibc.c THUMB DEBUG PRINT(.\LST\PLIBC.LST) TABS(4) OBJECT(.\obj\plibc.ob
-j)
stmt level source
1 /*****************************************************************************\
2 * efs - General purpose Embedded Filesystem library *
3 * --------------------- ----------------------------------- *
4 * *
5 * Filename : plibc.c *
6 * Description : This file contains replacements of common c library functions *
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * (c)2004 Lennart Yseboodt *
19 * (c)2004 Michael De Nil *
20 \*****************************************************************************/
21
22 /*****************************************************************************/
23 #include "plibc.h"
24 /*****************************************************************************/
25
26 /* ****************************************************************************
27 * unsigned short strMatch(char* bufa, char*bufb, unsigned long n)
28 * Description: Compares bufa and bufb for a length of n bytes.
29 * Return value: Returns the number of character NOT matching.
30 */
31 euint16 strMatch(eint8* bufa, eint8*bufb,euint32 n)
32 {
33 1 euint32 c;
34 1 euint16 res=0;
35 1 for(c=0;c<n;c++)if(bufa[c]!=bufb[c])res++;
36 1 return(res);
37 1 }
38 /*****************************************************************************/
39
40
41 /* ****************************************************************************
42 * void memCpy(void* psrc, void* pdest, unsigned long size)
43 * Description: Copies the contents of psrc into pdest on a byte per byte basis.
44 * The total number of bytes copies is size.
45 */
46 void memCpy(void* psrc, void* pdest, euint32 size)
47 {
48 1 while(size>0){
49 2 *((eint8*)pdest+size-1)=*((eint8*)psrc+size-1);
50 2 size--;
51 2 }
52 1 }
53 /*****************************************************************************/
54
55 void memClr(void *pdest,euint32 size)
56 {
57 1 while(size>0){
58 2 *(((eint8*)pdest)+size-1)=0x00;
ARM COMPILER V2.42, plibc 27/03/06 10:45:52 PAGE 2
59 2 size--;
60 2 }
61 1 }
62
63 void memSet(void *pdest,euint32 size,euint8 data)
64 {
65 1 while(size>0){
66 2 *(((eint8*)pdest)+size-1)=data;
67 2 size--;
68 2 }
69 1 }
70
71
ARM COMPILER V2.42, plibc 27/03/06 10:45:52 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** PUBLICS:
PUBLIC strMatch?T
PUBLIC memCpy?T
PUBLIC memClr?T
PUBLIC memSet?T
*** CODE SEGMENT '?PR?strMatch?T?plibc':
31: euint16 strMatch(eint8* bufa, eint8*bufb,euint32 n)
00000000 B4F0 PUSH {R4-R7}
00000002 ---- Variable 'n' assigned to Register 'R2' ----
00000002 ---- Variable 'bufb' assigned to Register 'R1' ----
00000002 ---- Variable 'bufa' assigned to Register 'R0' ----
32: {
00000002 ; SCOPE-START
34: euint16 res=0;
00000002 2300 MOV R3,#0x0
00000004 ---- Variable 'res' assigned to Register 'R3' ----
35: for(c=0;c<n;c++)if(bufa[c]!=bufb[c])res++;
00000004 2400 MOV R4,#0x0
00000006 ---- Variable 'c' assigned to Register 'R4' ----
00000006 E00C B L_3 ; T=0x00000022
00000008 L_4:
00000008 1C26 MOV R6,R4 ; c
0000000A 1C0D MOV R5,R1 ; bufb
0000000C 5DAD LDRB R5,[R5,R6]
0000000E 1C2E MOV R6,R5
00000010 1C27 MOV R7,R4 ; c
00000012 1C05 MOV R5,R0 ; bufa
00000014 5DED LDRB R5,[R5,R7]
00000016 42B5 CMP R5,R6
00000018 D002 BEQ L_1 ; T=0x00000020
0000001A 3301 ADD R3,#0x1
0000001C 041B LSL R3,R3,#0x10
0000001E 0C1B LSR R3,R3,#0x10
00000020 L_1:
00000020 3401 ADD R4,#0x1
00000022 L_3:
00000022 1C16 MOV R6,R2 ; n
00000024 1C25 MOV R5,R4 ; c
00000026 42B5 CMP R5,R6 ; c
00000028 D3EE BCC L_4 ; T=0x00000008
36: return(res);
0000002A 1C18 MOV R0,R3 ; res
0000002C 0400 LSL R0,R0,#0x10 ; res
0000002E 0C00 LSR R0,R0,#0x10
00000030 ; SCOPE-END
37: }
00000030 BCF0 POP {R4-R7}
00000032 4770 BX R14
00000034 ENDP ; 'strMatch?T'
*** CODE SEGMENT '?PR?memCpy?T?plibc':
46: void memCpy(void* psrc, void* pdest, euint32 size)
00000000 B430 PUSH {R4-R5}
00000002 ---- Variable 'size' assigned to Register 'R2' ----
00000002 ---- Variable 'pdest' assigned to Register 'R1' ----
00000002 ---- Variable 'psrc' assigned to Register 'R0' ----
48: while(size>0){
00000002 E00A B L_8 ; T=0x0000001A
00000004 L_10:
49: *((eint8*)pdest+size-1)=*((eint8*)psrc+size-1);
00000004 1C14 MOV R4,R2 ; size
00000006 1C03 MOV R3,R0 ; psrc
00000008 191B ADD R3,R4 ; psrc
ARM COMPILER V2.42, plibc 27/03/06 10:45:52 PAGE 4
0000000A 3B01 SUB R3,#0x1
0000000C 781C LDRB R4,[R3,#0x0]
0000000E 1C15 MOV R5,R2 ; size
00000010 1C0B MOV R3,R1 ; pdest
00000012 195B ADD R3,R5 ; pdest
00000014 3B01 SUB R3,#0x1
00000016 701C STRB R4,[R3,#0x0]
50: size--;
00000018 3A01 SUB R2,#0x1
51: }
0000001A L_8:
0000001A 1C13 MOV R3,R2 ; size
0000001C 2B00 CMP R3,#0x0 ; size
0000001E D8F1 BHI L_10 ; T=0x00000004
52: }
00000020 BC30 POP {R4-R5}
00000022 4770 BX R14
00000024 ENDP ; 'memCpy?T'
*** CODE SEGMENT '?PR?memClr?T?plibc':
55: void memClr(void *pdest,euint32 size)
00000000 B410 PUSH {R4}
00000002 ---- Variable 'size' assigned to Register 'R1' ----
00000002 ---- Variable 'pdest' assigned to Register 'R0' ----
57: while(size>0){
00000002 E006 B L_12 ; T=0x00000012
00000004 L_14:
58: *(((eint8*)pdest)+size-1)=0x00;
00000004 2300 MOV R3,#0x0
00000006 1C0C MOV R4,R1 ; size
00000008 1C02 MOV R2,R0 ; pdest
0000000A 1912 ADD R2,R4 ; pdest
0000000C 3A01 SUB R2,#0x1
0000000E 7013 STRB R3,[R2,#0x0]
59: size--;
00000010 3901 SUB R1,#0x1
60: }
00000012 L_12:
00000012 1C0A MOV R2,R1 ; size
00000014 2A00 CMP R2,#0x0 ; size
00000016 D8F5 BHI L_14 ; T=0x00000004
61: }
00000018 BC10 POP {R4}
0000001A 4770 BX R14
0000001C ENDP ; 'memClr?T'
*** CODE SEGMENT '?PR?memSet?T?plibc':
63: void memSet(void *pdest,euint32 size,euint8 data)
00000000 B430 PUSH {R4-R5}
00000002 ---- Variable 'data' assigned to Register 'R2' ----
00000002 ---- Variable 'size' assigned to Register 'R1' ----
00000002 ---- Variable 'pdest' assigned to Register 'R0' ----
65: while(size>0){
00000002 E006 B L_16 ; T=0x00000012
00000004 L_18:
66: *(((eint8*)pdest)+size-1)=data;
00000004 1C14 MOV R4,R2 ; data
00000006 1C0D MOV R5,R1 ; size
00000008 1C03 MOV R3,R0 ; pdest
0000000A 195B ADD R3,R5 ; pdest
0000000C 3B01 SUB R3,#0x1
0000000E 701C STRB R4,[R3,#0x0]
67: size--;
00000010 3901 SUB R1,#0x1
68: }
00000012 L_16:
00000012 1C0B MOV R3,R1 ; size
00000014 2B00 CMP R3,#0x0 ; size
ARM COMPILER V2.42, plibc 27/03/06 10:45:52 PAGE 5
00000016 D8F5 BHI L_18 ; T=0x00000004
69: }
00000018 BC30 POP {R4-R5}
0000001A 4770 BX R14
0000001C ENDP ; 'memSet?T'
Module Information Static
----------------------------------
code size = ------
data size = ------
const size = ------
End of Module Information.
ARM COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -