mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
cleanup to support incorporated changes
svn path=/trunk/; revision=109
This commit is contained in:
parent
37af92952e
commit
13e75fd710
12 changed files with 782 additions and 663 deletions
|
@ -74,7 +74,7 @@ typedef DISK_GEOMETRY *PDISK_GEOMETRY;
|
|||
#include <internal/i386/io.h>
|
||||
#include <internal/string.h>
|
||||
|
||||
//#define NDEBUG
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#include "ide.h"
|
||||
|
@ -237,7 +237,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||
BOOLEAN WeGotSomeDisks;
|
||||
int ControllerIdx;
|
||||
|
||||
DPRINT("IDE Driver %s\n", VERSION);
|
||||
DbgPrint("IDE Driver %s\n", VERSION);
|
||||
|
||||
// Export other driver entry points...
|
||||
DriverObject->DriverStartIo = IDEStartIo;
|
||||
|
@ -302,7 +302,7 @@ IDECreateController(IN PDRIVER_OBJECT DriverObject,
|
|||
ControllerParams->ControlPortBase))
|
||||
{
|
||||
DPRINT("Could not find controller %d at %04lx\n",
|
||||
ControllerIdx, ControllerParams->ControlPortBase);
|
||||
ControllerIdx, ControllerParams->CommandPortBase);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -967,6 +967,11 @@ IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
|
|||
// Initialize the DPC object here
|
||||
IoInitializeDpcRequest(*DeviceObject, IDEDpcForIsr);
|
||||
|
||||
if (Win32Alias != NULL)
|
||||
{
|
||||
DbgPrint("%s is %s %dMB\n", DeviceName, Win32Alias, (Size + 512) / 1024);
|
||||
}
|
||||
|
||||
return RC;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,14 @@ extern "C" {
|
|||
#define IDE_RESET_BUSY_TIMEOUT 31
|
||||
#define IDE_RESET_DRDY_TIMEOUT 120
|
||||
|
||||
#define IDE_REG_ALT_STATUS 0x0006
|
||||
#define IDE_REG_DEV_CNTRL 0x0006 /* device control register */
|
||||
// Control Block offsets and masks
|
||||
#define IDE_REG_ALT_STATUS 0x0000
|
||||
#define IDE_REG_DEV_CNTRL 0x0000 /* device control register */
|
||||
#define IDE_DC_SRST 0x04 /* drive reset (both drives) */
|
||||
#define IDE_DC_nIEN 0x02 /* IRQ enable (active low) */
|
||||
#define IDE_REG_DRV_ADDR 0x0007
|
||||
#define IDE_REG_DRV_ADDR 0x0001
|
||||
|
||||
// Command Block offsets and masks
|
||||
#define IDE_REG_DATA_PORT 0x0000
|
||||
#define IDE_REG_ERROR 0x0001 /* error register */
|
||||
#define IDE_ER_AMNF 0x01 /* addr mark not found */
|
||||
|
|
|
@ -56,10 +56,17 @@ int process(FILE* in, FILE* out, FILE *out2)
|
|||
nr_args = (char *)strtok(NULL," \t");
|
||||
|
||||
// printf("name %s value %d\n",name,value);
|
||||
#ifdef PARAMETERIZED_LIBS
|
||||
fprintf(out,"GLOBAL _%s@%s\n",name,nr_args);
|
||||
fprintf(out,"GLOBAL _%s@%s\n",name2,nr_args);
|
||||
fprintf(out,"_%s@%s:\n",name,nr_args);
|
||||
fprintf(out,"_%s@%s:\n",name2,nr_args);
|
||||
#else
|
||||
fprintf(out,"GLOBAL _%s\n",name);
|
||||
fprintf(out,"GLOBAL _%s\n",name2);
|
||||
fprintf(out,"_%s:\n",name);
|
||||
fprintf(out,"_%s:\n",name2);
|
||||
#endif
|
||||
fprintf(out,"\tmov\teax,%d\n",value);
|
||||
fprintf(out,"\tlea\tedx,[esp+4]\n");
|
||||
fprintf(out,"\tint\t2Eh\n");
|
||||
|
|
|
@ -208,4 +208,22 @@ NtReplyWaitSendChannel ZwReplyWaitSendChannel 12
|
|||
NtSendWaitReplyChannel ZwSendWaitReplyChannel 16
|
||||
NtSetContextChannel ZwSetContextChannel 4
|
||||
NtYieldExecution ZwYieldExecution 0
|
||||
wcscat Rtlwcscat 8
|
||||
wcschr Rtlwcschr 8
|
||||
wcscmp Rtlwcscmp 8
|
||||
wcscpy Rtlwcscpy 8
|
||||
wcscspn Rtlwcscspn 8
|
||||
wcsicmp Rtlwcsicmp 8
|
||||
wcslen Rtlwcslen 4
|
||||
wcsncat Rtlwcsncat 12
|
||||
wcsncmp Rtlwcsncmp 12
|
||||
wcsncpy Rtlwcsncpy 12
|
||||
wcsnicmp Rtlwcsnicmp 12
|
||||
wcsnlen Rtlwcsnlen 8
|
||||
wcspbrk Rtlwcspbrk 8
|
||||
wcsrchr Rtlwcsrchr 8
|
||||
wcsspn Rtlwcsspn 8
|
||||
wcsstr Rtlwcsstr 8
|
||||
wcstok Rtlwcstok 8
|
||||
wstrlen Rtlwstrlen 4
|
||||
|
||||
|
|
20
reactos/include/ddk/li.h
Normal file
20
reactos/include/ddk/li.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
#ifdef COMPILER_LARGE_INTEGERS
|
||||
|
||||
#define GET_LARGE_INTEGER_HIGH_PART(LargeInteger) ( ( LargeInteger >> 32) )
|
||||
#define GET_LARGE_INTEGER_LOW_PART(LargeInteger) ( (LargeInteger & 0xFFFFFFFF) )
|
||||
#define SET_LARGE_INTEGER_HIGH_PART(LargeInteger,Signed_Long) \
|
||||
( LargeInteger |= ( ((LARGE_INTEGER)Signed_Long) << 32 ) )
|
||||
#define SET_LARGE_INTEGER_LOW_PART(LargeInteger,Unsigned_Long) \
|
||||
( LargeInteger |= Unsigned_Long )
|
||||
|
||||
#else
|
||||
#define GET_LARGE_INTEGER_HIGH_PART(LargeInteger) ( (LargeInteger.HighPart) )
|
||||
#define GET_LARGE_INTEGER_LOW_PART(LargeInteger) ( (LargeInteger.LowPart) )
|
||||
#define SET_LARGE_INTEGER_HIGH_PART(LargeInteger,Signed_Long) \
|
||||
( LargeInteger.HighPart= Signed_Long )
|
||||
#define SET_LARGE_INTEGER_LOW_PART(LargeInteger,Unsigned_Long) \
|
||||
( LargeInteger.LowPart = Unsigned_Long )
|
||||
|
||||
#endif
|
||||
|
|
@ -20,14 +20,14 @@ typedef unsigned short wchar_t;
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
//wchar_t * ___wcstok = NULL;
|
||||
extern wchar_t * ___wcstok;
|
||||
extern wchar_t * wcscpy(wchar_t *,const wchar_t *);
|
||||
extern wchar_t * wcsncpy(wchar_t *,const wchar_t *, __kernel_size_t);
|
||||
extern wchar_t * wcscat(wchar_t *, const wchar_t *);
|
||||
extern wchar_t * wcsncat(wchar_t *, const wchar_t *, __kernel_size_t);
|
||||
extern int wcscmp(const wchar_t *,const wchar_t *);
|
||||
extern int wcsncmp(const wchar_t *,const wchar_t *,__kernel_size_t);
|
||||
wchar_t* wcschr(wchar_t* str, wchar_t ch);
|
||||
wchar_t* wcschr(const wchar_t* str, wchar_t ch);
|
||||
extern wchar_t * wcsrchr(const wchar_t *,wchar_t);
|
||||
extern wchar_t * wcspbrk(const wchar_t *,const wchar_t *);
|
||||
extern wchar_t * wcstok(wchar_t *,const wchar_t *);
|
||||
|
@ -35,12 +35,14 @@ extern wchar_t * wcsstr(const wchar_t *,const wchar_t *);
|
|||
extern size_t wcsnlen(const wchar_t * s, size_t count);
|
||||
extern int wcsicmp(const wchar_t* cs,const wchar_t * ct);
|
||||
extern int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count);
|
||||
extern size_t wcscspn(const wchar_t *, const wchar_t *);
|
||||
extern size_t wcslen(const wchar_t *);
|
||||
extern size_t wcsspn(const wchar_t *, const wchar_t *);
|
||||
|
||||
extern unsigned long wstrlen(PWSTR);
|
||||
WCHAR wtoupper(WCHAR c);
|
||||
WCHAR wtolower(WCHAR c);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,12 +14,7 @@
|
|||
#include <kernel32\thread.h>
|
||||
#include <wstring.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// RJJ: (we dont have it) #include <stdlib.h>
|
||||
|
||||
/* system global and local atom tables */
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
SECTION .text
|
||||
|
||||
BITS 32
|
||||
|
||||
GLOBAL _NtAcceptConnectPort
|
||||
GLOBAL _ZwAcceptConnectPort
|
||||
_NtAcceptConnectPort:
|
||||
|
@ -1893,3 +1895,165 @@ _ZwYieldExecution:
|
|||
int 2Eh
|
||||
ret 0
|
||||
|
||||
GLOBAL _wcscat
|
||||
GLOBAL _Rtlwcscat
|
||||
_wcscat:
|
||||
_Rtlwcscat:
|
||||
mov eax,210
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcschr
|
||||
GLOBAL _Rtlwcschr
|
||||
_wcschr:
|
||||
_Rtlwcschr:
|
||||
mov eax,211
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcscmp
|
||||
GLOBAL _Rtlwcscmp
|
||||
_wcscmp:
|
||||
_Rtlwcscmp:
|
||||
mov eax,212
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcscpy
|
||||
GLOBAL _Rtlwcscpy
|
||||
_wcscpy:
|
||||
_Rtlwcscpy:
|
||||
mov eax,213
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcscspn
|
||||
GLOBAL _Rtlwcscspn
|
||||
_wcscspn:
|
||||
_Rtlwcscspn:
|
||||
mov eax,214
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcsicmp
|
||||
GLOBAL _Rtlwcsicmp
|
||||
_wcsicmp:
|
||||
_Rtlwcsicmp:
|
||||
mov eax,215
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcslen
|
||||
GLOBAL _Rtlwcslen
|
||||
_wcslen:
|
||||
_Rtlwcslen:
|
||||
mov eax,216
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 4
|
||||
|
||||
GLOBAL _wcsncat
|
||||
GLOBAL _Rtlwcsncat
|
||||
_wcsncat:
|
||||
_Rtlwcsncat:
|
||||
mov eax,217
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 12
|
||||
|
||||
GLOBAL _wcsncmp
|
||||
GLOBAL _Rtlwcsncmp
|
||||
_wcsncmp:
|
||||
_Rtlwcsncmp:
|
||||
mov eax,218
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 12
|
||||
|
||||
GLOBAL _wcsncpy
|
||||
GLOBAL _Rtlwcsncpy
|
||||
_wcsncpy:
|
||||
_Rtlwcsncpy:
|
||||
mov eax,219
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 12
|
||||
|
||||
GLOBAL _wcsnicmp
|
||||
GLOBAL _Rtlwcsnicmp
|
||||
_wcsnicmp:
|
||||
_Rtlwcsnicmp:
|
||||
mov eax,220
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 12
|
||||
|
||||
GLOBAL _wcsnlen
|
||||
GLOBAL _Rtlwcsnlen
|
||||
_wcsnlen:
|
||||
_Rtlwcsnlen:
|
||||
mov eax,221
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcspbrk
|
||||
GLOBAL _Rtlwcspbrk
|
||||
_wcspbrk:
|
||||
_Rtlwcspbrk:
|
||||
mov eax,222
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcsrchr
|
||||
GLOBAL _Rtlwcsrchr
|
||||
_wcsrchr:
|
||||
_Rtlwcsrchr:
|
||||
mov eax,223
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcsspn
|
||||
GLOBAL _Rtlwcsspn
|
||||
_wcsspn:
|
||||
_Rtlwcsspn:
|
||||
mov eax,224
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcsstr
|
||||
GLOBAL _Rtlwcsstr
|
||||
_wcsstr:
|
||||
_Rtlwcsstr:
|
||||
mov eax,225
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wcstok
|
||||
GLOBAL _Rtlwcstok
|
||||
_wcstok:
|
||||
_Rtlwcstok:
|
||||
mov eax,226
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 8
|
||||
|
||||
GLOBAL _wstrlen
|
||||
GLOBAL _Rtlwstrlen
|
||||
_wstrlen:
|
||||
_Rtlwstrlen:
|
||||
mov eax,227
|
||||
lea edx,[esp+4]
|
||||
int 2Eh
|
||||
ret 4
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#include <wstring.h>
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
|
|
@ -63,15 +63,14 @@
|
|||
* PURPOSE: Current cursor position
|
||||
*/
|
||||
static unsigned int cursorx=0, cursory=0;
|
||||
|
||||
static unsigned int lines_seen = 0;
|
||||
static unsigned char CharAttribute = 0x17;
|
||||
|
||||
//#define NR_ROWS 25
|
||||
#define NR_ROWS 50
|
||||
#define NR_COLUMNS 80
|
||||
#define VIDMEM_BASE 0xb8000
|
||||
|
||||
|
||||
/*
|
||||
* PURPOSE: Points to the base of text mode video memory
|
||||
*/
|
||||
|
@ -191,7 +190,7 @@ static void putchar(char c)
|
|||
|
||||
default:
|
||||
vidmem[(cursorx * 2) + (cursory * 80 * 2)] = c;
|
||||
vidmem[(cursorx*2) + (cursory*80*2)+1]=0x17;
|
||||
vidmem[(cursorx * 2) + (cursory * 80 * 2) + 1] = CharAttribute;
|
||||
cursorx++;
|
||||
if (cursorx >= NR_COLUMNS)
|
||||
{
|
||||
|
@ -210,7 +209,7 @@ static void putchar(char c)
|
|||
for (i = 0; str[i] != 0; i++)
|
||||
{
|
||||
vidmem[NR_COLUMNS*(NR_ROWS-1)*2+i*2] = str[i];
|
||||
vidmem[NR_COLUMNS*(NR_ROWS-1)*2+i*2+1]=0x37; // 17 for white on blue 37
|
||||
vidmem[NR_COLUMNS*(NR_ROWS-1)*2+i*2+1] = CharAttribute;
|
||||
}
|
||||
|
||||
while (inb_p(0x60)!=0x81);
|
||||
|
@ -220,9 +219,16 @@ static void putchar(char c)
|
|||
|
||||
if (cursory >= NR_ROWS)
|
||||
{
|
||||
memcpy(vidmem,&vidmem[NR_COLUMNS*2],
|
||||
unsigned short *LinePtr;
|
||||
|
||||
memcpy(vidmem,
|
||||
&vidmem[NR_COLUMNS * 2],
|
||||
NR_COLUMNS * (NR_ROWS - 1) * 2);
|
||||
memset(&vidmem[NR_COLUMNS*(NR_ROWS-1)*2],0,NR_COLUMNS*2);
|
||||
LinePtr = (unsigned short *) &vidmem[NR_COLUMNS * (NR_ROWS - 1) * 2];
|
||||
for (i = 0; i < NR_COLUMNS; i++)
|
||||
{
|
||||
LinePtr[i] = CharAttribute << 8;
|
||||
}
|
||||
cursory = NR_ROWS - 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <internal/io.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
//#define NDEBUG
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* Created 22/05/98
|
||||
* 1998/12/04 RJJ Cleaned up and added i386 def checks
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -15,73 +16,54 @@
|
|||
|
||||
#include <internal/debug.h>
|
||||
|
||||
wchar_t * ___wcstok = NULL;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
wchar_t * wcsncat(wchar_t * dest,const wchar_t * src,size_t count)
|
||||
wchar_t *
|
||||
wcscat(wchar_t *dest, const wchar_t *src)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (j=0;dest[j]!=0;j++);
|
||||
for (i=0;i<count;i++)
|
||||
for (j = 0; dest[j] != 0; j++)
|
||||
;
|
||||
for (i = 0; src[i] != 0; i++)
|
||||
{
|
||||
dest[j + i] = src[i];
|
||||
if (src[i] == 0)
|
||||
{
|
||||
return(dest);
|
||||
}
|
||||
}
|
||||
dest[j + i] = 0;
|
||||
return(dest);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
wchar_t * wcsncpy(wchar_t * dest,const wchar_t *src,size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<count;i++)
|
||||
{
|
||||
dest[i] = src[i];
|
||||
if (src[i] == 0)
|
||||
{
|
||||
return(dest);
|
||||
}
|
||||
}
|
||||
dest[i]=0;
|
||||
return(dest);
|
||||
}
|
||||
|
||||
wchar_t* wcsrchr(const wchar_t* str, wchar_t ch)
|
||||
{
|
||||
unsigned int len = 0;
|
||||
while (str[len]!=((wchar_t)0))
|
||||
{
|
||||
len++;
|
||||
}
|
||||
|
||||
for (;len>0;len--)
|
||||
{
|
||||
if (str[len-1]==ch)
|
||||
{
|
||||
return((wchar_t*)&str[len-1]);
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
wchar_t* wcschr(wchar_t* str, wchar_t ch)
|
||||
wchar_t *
|
||||
wcschr(const wchar_t *str, wchar_t ch)
|
||||
{
|
||||
while ((*str) != ((wchar_t) 0))
|
||||
{
|
||||
if ((*str) == ch)
|
||||
{
|
||||
return(str);
|
||||
return str;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return(NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wchar_t * wcscpy(wchar_t * str1,const wchar_t * str2)
|
||||
int
|
||||
wcscmp(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
while (*cs != '\0' && *ct != '\0' && *cs == *ct)
|
||||
{
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
return *cs - *ct;
|
||||
}
|
||||
|
||||
wchar_t *
|
||||
wcscpy(wchar_t *str1, const wchar_t *str2)
|
||||
{
|
||||
while ( (*str1)==(*str2) )
|
||||
{
|
||||
|
@ -95,62 +77,52 @@ wchar_t * wcscpy(wchar_t * str1,const wchar_t * str2)
|
|||
return(wchar_t *)( (*str1) - (*str2) );
|
||||
}
|
||||
|
||||
#ifdef i386
|
||||
|
||||
unsigned long wstrlen(PWSTR s)
|
||||
size_t
|
||||
wcscspn(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
return wcslen(s);
|
||||
}
|
||||
|
||||
#ifndef __MACHINE_STRING_FUNCTIONS
|
||||
|
||||
size_t wcslen(const wchar_t * s)
|
||||
{
|
||||
|
||||
unsigned int len=0;
|
||||
|
||||
while(s[len]!=0) {
|
||||
len++;
|
||||
};
|
||||
return len;
|
||||
}
|
||||
#else
|
||||
size_t wcslen(const wchar_t * s)
|
||||
{
|
||||
register int __res;
|
||||
register wchar_t * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasw\n\t"
|
||||
"notl %0\n\t"
|
||||
"decl %0"
|
||||
:"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"edi");
|
||||
return __res;
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasw\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\tdecl %0"
|
||||
: "=S" (__res)
|
||||
: "a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
: "eax","ecx","edx","edi");
|
||||
|
||||
return __res-cs;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
size_t
|
||||
wcscspn(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline int wcscmp(const wchar_t* cs,const wchar_t * ct)
|
||||
#ifdef i386
|
||||
|
||||
int
|
||||
wcsicmp(const wchar_t *cs,const wchar_t *ct)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tlodsw\n\t"
|
||||
"scasw\n\t"
|
||||
"jne 2f\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"jne 1b\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"jmp 3f\n"
|
||||
"2:\tsbbl %%eax,%%eax\n\t"
|
||||
"orw $1,%%eax\n"
|
||||
"3:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct):"esi","edi");
|
||||
return __res;
|
||||
}
|
||||
|
||||
int wcsicmp(const wchar_t* cs,const wchar_t * ct)
|
||||
{
|
||||
register int __res;
|
||||
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
|
@ -179,148 +151,63 @@ __asm__ __volatile__(
|
|||
"4:\tsbbl %%eax,%%eax\n\t"
|
||||
"orw $1,%%eax\n"
|
||||
"5:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct):"esi","edi");
|
||||
: "=a" (__res)
|
||||
: "S" (cs),"D" (ct)
|
||||
: "esi","edi");
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
wchar_t * wcscat(wchar_t * dest,const wchar_t * src)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repnz\n\t"
|
||||
"scasw\n\t"
|
||||
"decl %1\n"
|
||||
"decl %1\n\t"
|
||||
"1:\tlodsw\n\t"
|
||||
"stosw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"jne 1b"
|
||||
: // no output
|
||||
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"esi","edi","eax","ecx");
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __MACHINE_STRING_FUNCTIONS
|
||||
/*
|
||||
* Include machine specific inline routines
|
||||
*/
|
||||
//#ifndef _I386_STRING_H_
|
||||
//#define _I386_STRING_H_
|
||||
|
||||
/*
|
||||
* On a 486 or Pentium, we are better off not using the
|
||||
* byte string operations. But on a 386 or a PPro the
|
||||
* byte string ops are faster than doing it by hand
|
||||
* (MUCH faster on a Pentium).
|
||||
*
|
||||
* Also, the byte strings actually work correctly. Forget
|
||||
* the i486 routines for now as they may be broken..
|
||||
*/
|
||||
|
||||
#if FIXED_486_STRING && (CPU == 486 || CPU == 586)
|
||||
#include <asm/string-486.h>
|
||||
#else
|
||||
|
||||
/*
|
||||
* This string-include defines all string functions as inline
|
||||
* functions. Use gcc. It also assumes ds=es=data space, this should be
|
||||
* normal. Most of the string-functions are rather heavily hand-optimized,
|
||||
* see especially wcstok,wcsstr,wcs[c]spn. They should work, but are not
|
||||
* very easy to understand. Everything is done entirely within the register
|
||||
* set, making the functions fast and clean. String instructions have been
|
||||
* used through-out, making for "slightly" unclear code :-)
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#define __HAVE_ARCH_WCSCPY
|
||||
extern inline wchar_t * wcscpy(wchar_t * dest,const wchar_t *src)
|
||||
int
|
||||
wcsicmp(const wchar_t *cs,const wchar_t *ct)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tlodsw\n\t"
|
||||
"stosw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"jne 1b"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest):"esi","edi","eax","memory");
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
size_t
|
||||
wcslen(const wchar_t *s)
|
||||
{
|
||||
unsigned int len = 0;
|
||||
|
||||
while (s[len] != 0)
|
||||
{
|
||||
len++;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
wchar_t *
|
||||
wcsncat(wchar_t *dest, const wchar_t *src, size_t count)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (j = 0; dest[j] != 0; j++)
|
||||
;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
dest[j + i] = src[i];
|
||||
if (src[i] == 0)
|
||||
{
|
||||
return dest;
|
||||
}
|
||||
}
|
||||
dest[j + i] = 0;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_WCSNCPY
|
||||
inline wchar_t * wcsncpy(wchar_t * dest,const wchar_t *src,size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tdecl %2\n\t"
|
||||
"js 2f\n\t"
|
||||
"lodsw\n\t"
|
||||
"stosw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"jne 1b\n\t"
|
||||
"rep\n\t"
|
||||
"stosw\n"
|
||||
"2:"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest),"c" (count):"esi","edi","eax","ecx","memory");
|
||||
return dest;
|
||||
}
|
||||
/*
|
||||
#define __HAVE_ARCH_WCSCAT
|
||||
inline wchar_t * wcscat(wchar_t * dest,const wchar_t * src)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repnz\n\t"
|
||||
"scasw\n\t"
|
||||
"decl %1\n"
|
||||
"decl %1\n\t"
|
||||
"1:\tlodsw\n\t"
|
||||
"stosw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"jne 1b"
|
||||
: // no output
|
||||
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"esi","edi","eax","ecx");
|
||||
return dest;
|
||||
}
|
||||
*/
|
||||
#define __HAVE_ARCH_WCSNCAT
|
||||
inline wchar_t * wcsncat(wchar_t * dest,const wchar_t * src,size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repnz\n\t"
|
||||
"scasw\n\t"
|
||||
"decl %1\n\t"
|
||||
"movl %4,%3\n"
|
||||
"decl %1\n\t"
|
||||
"1:\tdecl %3\n\t"
|
||||
"js 2f\n\t"
|
||||
"lodsw\n\t"
|
||||
"stosw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\txorl %2,%2\n\t"
|
||||
"stosw"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count)
|
||||
:"esi","edi","eax","ecx","memory");
|
||||
return dest;
|
||||
}
|
||||
#ifdef i386
|
||||
|
||||
#define __HAVE_ARCH_WCSCMP
|
||||
|
||||
#define __HAVE_ARCH_WCSNCMP
|
||||
inline int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count)
|
||||
int
|
||||
wcsncmp(const wchar_t *cs, const wchar_t *ct, size_t count)
|
||||
{
|
||||
register int __res;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tdecl %3\n\t"
|
||||
|
@ -335,101 +222,131 @@ __asm__ __volatile__(
|
|||
"3:\tsbbl %%eax,%%eax\n\t"
|
||||
"orw $1,%%eax\n"
|
||||
"4:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct),"c" (count):"esi","edi","ecx");
|
||||
: "=a" (__res)
|
||||
: "S" (cs), "D" (ct), "c" (count)
|
||||
: "esi","edi","ecx");
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_WCSCHR
|
||||
inline wchar_t * wcschr(const wchar_t * s, int c)
|
||||
#else
|
||||
|
||||
int
|
||||
wcsncmp(const wchar_t *cs, const wchar_t *ct, size_t count)
|
||||
{
|
||||
register wchar_t * __res;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
wchar_t *
|
||||
wcsncpy(wchar_t *dest, const wchar_t *src, size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
dest[i] = src[i];
|
||||
if (src[i] == 0)
|
||||
{
|
||||
return dest;
|
||||
}
|
||||
}
|
||||
dest[i] = 0;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
#ifdef i386
|
||||
|
||||
int
|
||||
wcsnicmp(const wchar_t *cs,const wchar_t *ct, size_t count)
|
||||
{
|
||||
register int __res;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movw %%eax,%%edx\n"
|
||||
"1:\tlodsw\n\t"
|
||||
"cmpw %%edx,%%eax\n\t"
|
||||
"je 2f\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"cld\n"
|
||||
"1:\t decl %3\n\t"
|
||||
"js 6f\n\t"
|
||||
"movw (%%esi), %%eax\n\t"
|
||||
"movw (%%edi), %%edx \n\t"
|
||||
"cmpw $0x5A, %%eax\n\t"
|
||||
"ja 2f\t\n"
|
||||
"cmpw $0x40, %%eax\t\n"
|
||||
"jbe 2f\t\n"
|
||||
"addw $0x20, %%eax\t\n"
|
||||
"2:\t cmpw $0x5A, %%edx\t\n"
|
||||
"ja 3f\t\n"
|
||||
"cmpw $0x40, %%edx\t\n"
|
||||
"jbe 3f\t\n"
|
||||
"addw $0x20, %%edx\t\n"
|
||||
"3:\t inc %%esi\t\n"
|
||||
"inc %%esi\t\n"
|
||||
"inc %%edi\t\n"
|
||||
"inc %%edi\t\n"
|
||||
"cmpw %%eax, %%edx\t\n"
|
||||
"jne 4f\n\t"
|
||||
"cmpw $00, %%eax\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movl $1,%1\n"
|
||||
"2:\tmovl %1,%0\n\t"
|
||||
"decl %0\n\t"
|
||||
"decl %0\n\t"
|
||||
:"=a" (__res):"S" (s),"0" (c):"esi");
|
||||
"6:xorl %%eax,%%eax\n\t"
|
||||
"jmp 5f\n"
|
||||
"4:\tsbbl %%eax,%%eax\n\t"
|
||||
"orw $1,%%eax\n"
|
||||
"5:"
|
||||
: "=a" (__res)
|
||||
: "S" (cs), "D" (ct), "c" (count)
|
||||
: "esi", "edi", "ecx");
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_WCSRCHR
|
||||
inline wchar_t * wcsrchr(const wchar_t * s, int c)
|
||||
#else
|
||||
|
||||
int
|
||||
wcsnicmp(const wchar_t *cs,const wchar_t *ct, size_t count)
|
||||
{
|
||||
register wchar_t * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movw %%eax,%%edx\n"
|
||||
"1:\tlodsw\n\t"
|
||||
"cmpw %%edx,%%eax\n\t"
|
||||
"jne 2f\n\t"
|
||||
"leal -2(%%esi),%0\n"
|
||||
"2:\ttestw %%eax,%%eax\n\t"
|
||||
"jne 1b"
|
||||
:"=d" (__res):"0" (0),"S" (s),"a" (c):"eax","esi");
|
||||
return __res;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_WCSSPN
|
||||
inline size_t wcsspn(const wchar_t * cs, const wchar_t * ct)
|
||||
{
|
||||
register wchar_t * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasw\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"je 1b\n"
|
||||
"2:\tdecl %0"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
:"eax","ecx","edx","edi");
|
||||
return __res-cs;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define __HAVE_ARCH_WCSCSPN
|
||||
inline size_t wcscspn(const wchar_t * cs, const wchar_t * ct)
|
||||
#ifdef i386
|
||||
|
||||
size_t
|
||||
wcsnlen(const wchar_t *s, size_t count)
|
||||
{
|
||||
register wchar_t * __res;
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasw\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasw\n\t"
|
||||
"movl %1,%0\n\t"
|
||||
"jmp 2f\n"
|
||||
"1:\tcmpw $0,(%0)\n\t"
|
||||
"je 3f\n\t"
|
||||
"incl %0\n"
|
||||
"2:\tdecl %2\n\t"
|
||||
"cmpl $-1,%2\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\tdecl %0"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
:"eax","ecx","edx","edi");
|
||||
return __res-cs;
|
||||
"3:\tsubl %1,%0"
|
||||
: "=a" (__res)
|
||||
: "c" (s), "d" (count)
|
||||
: "edx");
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRPBRK
|
||||
inline wchar_t * wcspbrk(const wchar_t * cs,const wchar_t * ct)
|
||||
#else
|
||||
|
||||
size_t
|
||||
wcsnlen(const wchar_t *s, size_t count)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef i386
|
||||
|
||||
wchar_t *
|
||||
wcspbrk(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
register wchar_t * __res;
|
||||
__asm__ __volatile__(
|
||||
|
@ -452,15 +369,91 @@ __asm__ __volatile__(
|
|||
"jmp 3f\n"
|
||||
"2:\txorl %0,%0\n"
|
||||
"3:"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
: "=S" (__res)
|
||||
: "a" (0), "c" (0xffffffff), "0" (cs), "g" (ct)
|
||||
: "eax", "ecx", "edx", "edi");
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_WCSSTR
|
||||
inline wchar_t * wcsstr(const wchar_t * cs,const wchar_t * ct)
|
||||
#else
|
||||
|
||||
wchar_t *
|
||||
wcspbrk(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
wchar_t *
|
||||
wcsrchr(const wchar_t *str, wchar_t ch)
|
||||
{
|
||||
unsigned int len = 0;
|
||||
while (str[len] != ((wchar_t)0))
|
||||
{
|
||||
len++;
|
||||
}
|
||||
|
||||
for (; len > 0; len--)
|
||||
{
|
||||
if (str[len-1]==ch)
|
||||
{
|
||||
return (wchar_t *) &str[len - 1];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef i386
|
||||
|
||||
size_t
|
||||
wcsspn(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
register wchar_t * __res;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasw\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsw\n\t"
|
||||
"testw %%eax,%%eax\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"je 1b\n"
|
||||
"2:\tdecl %0"
|
||||
: "=S" (__res)
|
||||
: "a" (0), "c" (0xffffffff), "0" (cs), "g" (ct)
|
||||
: "eax", "ecx", "edx", "edi");
|
||||
|
||||
return __res-cs;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
size_t
|
||||
wcsspn(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef i386
|
||||
|
||||
wchar_t *
|
||||
wcsstr(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
register wchar_t * __res;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t" \
|
||||
"movl %4,%%edi\n\t"
|
||||
|
@ -481,35 +474,35 @@ __asm__ __volatile__(
|
|||
"jne 1b\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"2:"
|
||||
:"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
|
||||
: "=a" (__res)
|
||||
: "0" (0), "c" (0xffffffff), "S" (cs), "g" (ct)
|
||||
: "ecx", "edx", "edi", "esi");
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
/*
|
||||
#define __HAVE_ARCH_WCSLEN
|
||||
inline size_t wcslen(const wchar_t * s)
|
||||
#else
|
||||
|
||||
wchar_t *
|
||||
wcsstr(const wchar_t *cs, const wchar_t *ct)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasw\n\t"
|
||||
"notl %0\n\t"
|
||||
"decl %0"
|
||||
:"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"edi");
|
||||
return __res;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
*/
|
||||
#endif
|
||||
|
||||
#define __HAVE_ARCH_WCSTOK
|
||||
|
||||
|
||||
inline wchar_t * wcstok(wchar_t * s,const wchar_t * ct)
|
||||
unsigned long wstrlen(PWSTR s)
|
||||
{
|
||||
return wcslen(s);
|
||||
}
|
||||
|
||||
#ifdef i386
|
||||
|
||||
wchar_t *
|
||||
wcstok(wchar_t * s,const wchar_t * ct)
|
||||
{
|
||||
register wchar_t * __res;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"testl %1,%1\n\t"
|
||||
"jne 1f\n\t"
|
||||
|
@ -574,108 +567,14 @@ __asm__ __volatile__(
|
|||
return __res;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define __HAVE_ARCH_WCSNLEN
|
||||
inline size_t wcsnlen(const wchar_t * s, size_t count)
|
||||
wchar_t *
|
||||
wcstok(wchar_t * s,const wchar_t * ct)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"movl %1,%0\n\t"
|
||||
"jmp 2f\n"
|
||||
"1:\tcmpw $0,(%0)\n\t"
|
||||
"je 3f\n\t"
|
||||
"incl %0\n"
|
||||
"2:\tdecl %2\n\t"
|
||||
"cmpl $-1,%2\n\t"
|
||||
"jne 1b\n"
|
||||
"3:\tsubl %1,%0"
|
||||
:"=a" (__res)
|
||||
:"c" (s),"d" (count)
|
||||
:"edx");
|
||||
return __res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
#define __HAVE_ARCH_WCSICMP
|
||||
inline int wcsicmp(const wchar_t* cs,const wchar_t * ct)
|
||||
{
|
||||
register int __res;
|
||||
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tmovw (%%esi), %%eax\n\t"
|
||||
"movw (%%edi), %%edx \n\t"
|
||||
"cmpw $0x5A, %%eax\n\t"
|
||||
"ja 2f\t\n"
|
||||
"cmpw $0x40, %%eax\t\n"
|
||||
"jbe 2f\t\n"
|
||||
"addw $0x20, %%eax\t\n"
|
||||
"2:\t cmpw $0x5A, %%edx\t\n"
|
||||
"ja 3f\t\n"
|
||||
"cmpw $0x40, %%edx\t\n"
|
||||
"jbe 3f\t\n"
|
||||
"addw $0x20, %%edx\t\n"
|
||||
"3:\t inc %%esi\t\n"
|
||||
"inc %%esi\t\n"
|
||||
"inc %%edi\t\n"
|
||||
"inc %%edi\t\n"
|
||||
"cmpw %%eax, %%edx\t\n"
|
||||
"jne 4f\n\t"
|
||||
"cmpw $00, %%eax\n\t"
|
||||
"jne 1b\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"jmp 5f\n"
|
||||
"4:\tsbbl %%eax,%%eax\n\t"
|
||||
"orw $1,%%eax\n"
|
||||
"5:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct):"esi","edi");
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
*/
|
||||
#define __HAVE_ARCH_WCSNICMP
|
||||
inline int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count)
|
||||
{
|
||||
register int __res;
|
||||
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\t decl %3\n\t"
|
||||
"js 6f\n\t"
|
||||
"movw (%%esi), %%eax\n\t"
|
||||
"movw (%%edi), %%edx \n\t"
|
||||
"cmpw $0x5A, %%eax\n\t"
|
||||
"ja 2f\t\n"
|
||||
"cmpw $0x40, %%eax\t\n"
|
||||
"jbe 2f\t\n"
|
||||
"addw $0x20, %%eax\t\n"
|
||||
"2:\t cmpw $0x5A, %%edx\t\n"
|
||||
"ja 3f\t\n"
|
||||
"cmpw $0x40, %%edx\t\n"
|
||||
"jbe 3f\t\n"
|
||||
"addw $0x20, %%edx\t\n"
|
||||
"3:\t inc %%esi\t\n"
|
||||
"inc %%esi\t\n"
|
||||
"inc %%edi\t\n"
|
||||
"inc %%edi\t\n"
|
||||
"cmpw %%eax, %%edx\t\n"
|
||||
"jne 4f\n\t"
|
||||
"cmpw $00, %%eax\n\t"
|
||||
"jne 1b\n\t"
|
||||
"6:xorl %%eax,%%eax\n\t"
|
||||
"jmp 5f\n"
|
||||
"4:\tsbbl %%eax,%%eax\n\t"
|
||||
"orw $1,%%eax\n"
|
||||
"5:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct), "c" (count):"esi","edi", "ecx");
|
||||
|
||||
|
||||
return __res;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue