Changeset 342de62 in mainline


Ignore:
Timestamp:
2005-10-05T19:42:32Z (19 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
49c1f93
Parents:
1084a784
Message:

Last inline functions for IA-32

Location:
arch/ia32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/include/memstr.h

    r1084a784 r342de62  
    2929#ifndef __ia32_MEMSTR_H__
    3030#define __ia32_MEMSTR_H__
    31 
    32 extern void memsetw(__address dst, size_t cnt, __u16 x);
    33 extern void memsetb(__address dst, size_t cnt, __u8 x);
    3431
    3532/** Copy memory
     
    7067
    7168
    72 /** Compare memory
     69/** Compare memory regions for equality
    7370 *
    7471 * Compare a given number of bytes (3rd argument)
    7572 * at memory locations defined by 1st and 2nd argument
    76  * for equality. If memory is equal, returns 0.
     73 * for equality. If bytes are equal function returns 0.
    7774 *
    78  * @param pointer 1
    79  * @param pointer 2
     75 * @param region 1
     76 * @param region 2
    8077 * @param number of bytes
    81  * @return 0 on match or non-zero if different
     78 * @return zero if bytes are equal, non-zero otherwise
    8279 */
    83 static inline int memcmp(const void * mem1, const void * mem2, size_t cnt)
     80static inline int memcmp(__address src, __address dst, size_t cnt)
    8481{
    8582        __u32 d0, d1, d2;
     
    9390                "1:\n"
    9491                : "=a" (ret), "=%S" (d0), "=&D" (d1), "=&c" (d2)
    95                 : "0" (0), "1" (mem1), "2" (mem2), "3" (cnt)
     92                : "0" (0), "1" (src), "2" (dst), "3" (cnt)
    9693        );
    9794       
     
    9996}
    10097
     98/** Fill memory with words
     99 * Fill a given number of words (2nd argument)
     100 * at memory defined by 1st argument with the
     101 * word value defined by 3rd argument.
     102 *
     103 * @param destination
     104 * @param number of words
     105 * @param value to fill
     106 */
     107static inline void memsetw(__address dst, size_t cnt, __u16 x)
     108{
     109        __u32 d0, d1;
     110       
     111        __asm__ __volatile__ (
     112                "rep stosw\n\t"
     113                : "=&D" (d0), "=&c" (d1), "=a" (x)
     114                : "0" (dst), "1" (cnt), "2" (x)
     115                : "memory"
     116        );
     117
     118}
     119
     120/** Fill memory with bytes
     121 * Fill a given number of bytes (2nd argument)
     122 * at memory defined by 1st argument with the
     123 * word value defined by 3rd argument.
     124 *
     125 * @param destination
     126 * @param number of bytes
     127 * @param value to fill
     128 */
     129static inline void memsetb(__address dst, size_t cnt, __u8 x)
     130{
     131        __u32 d0, d1;
     132       
     133        __asm__ __volatile__ (
     134                "rep stosb\n\t"
     135                : "=&D" (d0), "=&c" (d1), "=a" (x)
     136                : "0" (dst), "1" (cnt), "2" (x)
     137                : "memory"
     138        );
     139
     140}
     141
    101142#endif
  • arch/ia32/src/asm.S

    r1084a784 r342de62  
    3838.global enable_l_apic_in_msr
    3939.global interrupt_handlers
    40 .global memsetb
    41 .global memsetw
    4240
    4341## Turn paging on
     
    152150
    153151
    154 ## Fill memory with bytes
    155 #
    156 # Fill a given number of bytes (2nd argument)
    157 # at memory defined by 1st argument with the
    158 # byte value defined by 3rd argument.
    159 #
    160 DST=12
    161 CNT=16
    162 X=20
    163 memsetb:
    164         push %eax
    165         push %edi
    166 
    167         movl CNT(%esp),%ecx
    168         movl DST(%esp),%edi
    169         movl X(%esp),%eax
    170 
    171         rep stosb %al,%es:(%edi)
    172 
    173         pop %edi
    174         pop %eax
    175         ret
    176 
    177 
    178 ## Fill memory with words
    179 #
    180 # Fill a given number of words (2nd argument)
    181 # at memory defined by 1st argument with the
    182 # word value defined by 3rd argument.
    183 #
    184 DST=12
    185 CNT=16
    186 X=20
    187 memsetw:
    188         push %eax
    189         push %edi
    190 
    191         movl CNT(%esp),%ecx
    192         movl DST(%esp),%edi
    193         movl X(%esp),%eax
    194 
    195         rep stosw %ax,%es:(%edi)
    196 
    197         pop %edi
    198         pop %eax
    199 
    200         ret
    201 
    202 
    203152# THIS IS USERSPACE CODE
    204153.global utext
  • arch/ia32/src/ia32.c

    r1084a784 r342de62  
    5151#include <arch/mm/memory_init.h>
    5252
    53 
    5453void arch_pre_mm_init(void)
    5554{
Note: See TracChangeset for help on using the changeset viewer.