当前位置:网站首页>: 0xc0000005: an access conflict occurs when writing position 0x01458000 - to be solved
: 0xc0000005: an access conflict occurs when writing position 0x01458000 - to be solved
2022-07-27 16:07:00 【The heart is like glass】
`#include <stdio.h>
#include <stdio.h>
#define TOTAL 4 // The total number of people
struct {
char name[20];
int num;
char sex;
char profession;
union {
float score;
char course[20];
}sc;
}bodys[TOTAL];
int main()
{
int i; // Enter personnel information
for (i =0;i<TOTAL;i++)
{
printf(“Input info:”);
scanf_s("%s %d %c %c", &(bodys[i].name), &(bodys[i].num), &(bodys[i].sex), &(bodys[i].profession));
if (bodys[i].profession ==‘s’)
{
scanf_s("%f", &(bodys[i].sc.score));
}
else
{
scanf_s("%f", &(bodys[i].sc.course));
}
fflush(stdin);
}
// Output personnel information
printf("\nNam\t\tNum\tSex\tProfession\tScore/Course\n");
for (i =0;i<TOTAL;i++)
{
if (bodys[i].profession ==‘s’)
{
printf("%s\t%d\t%c\t%c\t\t%f\n", bodys[i].name, bodys[i].num, bodys[i].sex, bodys[i].profession, bodys[i].sc.score);
}
else
{
printf("%s\t%d\t%c\t%c\t\t%s\n", bodys[i].name, bodys[i].num, bodys[i].sex, bodys[i].profession, bodys[i].sc.course);
}
}
getchar();
return 0;
}`

page ,132
title memset - set sections of memory all to one byte
;***
;memset.asm - set a section of memory to all one byte
;
; Copyright Microsoft Corporation. All rights reserved.
;
;Purpose:
; contains the memset() routine
;
;*******************************************************************************
.xlist
include vcruntime.inc
.list
.xmm
page
;***
;char memset(dst, value, count) - sets “count” bytes at “dst” to “value”
;
;Purpose:
; Sets the first “count” bytes of the memory starting
; at “dst” to the character value “value”.
;
; Algorithm:
; char *
; memset (dst, value, count)
; char dst;
; char value;
; unsigned int count;
; {
; char start = dst;
;
; while (count–)
; dst++ = value;
; return(start);
; }
;
;Entry:
; char dst - pointer to memory to fill with value
; char value - value to put in dst bytes
; int count - number of bytes of dst to fill
;
;Exit:
; returns dst, with filled bytes
;
;Uses:
;
;Exceptions:
;
;**************************************************************************
CODESEG
extrn __isa_available:dword
extrn __isa_enabled:dword
extrn __favor:dword
public memset
memset proc
dst:ptr byte,
value:byte,
count:dword
OPTION PROLOGUE:NONE, EPILOGUE:NONE
.FPO ( 0, 3, 0, 0, 0, 0 )
mov ecx, [esp + 0ch] ; the number of bytes to be set
movzx eax, byte ptr[esp + 08h] ; the value to be stored
mov edx, edi ; saving non-volatile edi
mov edi, [esp + 04h]; the dest pointer
test ecx, ecx; 0 ?
jz toend; if so, nothing to do
imul eax, 01010101h
cmp ecx, 020h; < 32 bytes use SmallMov
jle SmallMov
cmp ecx, 080h; For copies 32 < length < 128
jl XmmMovSmall
bt __favor, __FAVOR_ENFSTRG
jnc XMMMov; no jump
; Enhanced Fast Strings
rep stosb ; store the values in the destination buffer
mov eax, dword ptr[esp + 04h] ; return the original destination pointer
mov edi, edx ; restoring non-volatile edi
ret
; XMM register usage
XMMMov :
bt __isa_enabled, __ISA_AVAILABLE_SSE2
jnc SmallMov ; if yes, use xmm large block set
movd xmm0, eax
pshufd xmm0, xmm0, 0
add ecx, edi ; ecx points to end of buffer
movups [edi], xmm0
add edi, 16 ; point to next xmmword
and edi, -16 ; align xmmword ptr
sub ecx, edi ; ecx is offset to end of buffer
cmp ecx, 080h
jle XmmMovSmall
align 16
LargeRangeBytes :
movdqa [edi], xmm0
movdqa [edi + 010h], xmm0
movdqa [edi + 020h], xmm0
movdqa [edi + 030h], xmm0
movdqa [edi + 040h], xmm0
movdqa [edi + 050h], xmm0
movdqa [edi + 060h], xmm0
movdqa [edi + 070h], xmm0
lea edi, [edi + 080h]
sub ecx, 080h
test ecx, 0FFFFFF00h
jnz LargeRangeBytes
jmp XmmSmallLoop
; Do not require 16-byte alignment for sizes lesser than 128 bytes when using XMM registers
XmmMovSmall :
bt __isa_enabled, __ISA_AVAILABLE_SSE2
jnc SmallMov ; if yes, use xmm large block set
movd xmm0, eax
pshufd xmm0, xmm0, 0
align 16
XmmSmallLoop :
cmp ecx, 32
jb XMMTrailingBytes
MidRangeBytes :
movdqu [edi], xmm0
movdqu [edi + 010h], xmm0
add edi, 020h
sub ecx, 020h
cmp ecx, 32 ; checking number of 32 byte blocks left
jnb MidRangeBytes
test ecx, 01Fh ; check to see if there are bytes left
jz toend
XMMTrailingBytes:
; Remaining bytes written with two stores that may overlap instead of 1 byte at a time
lea edi, [edi + ecx - 020h]
movdqu [edi], xmm0
movdqu [edi + 010h], xmm0
mov eax, dword ptr [esp + 04h] ; return the original destination pointer
mov edi, edx ; restoring non-volatile edi
ret
; Copying less than or equal to 32 bytes
SmallMov:
test ecx, 03h ; check if there are bytes that can be stored
jz DwordTest
ByteLoop:
mov [edi], al
inc edi
sub ecx, 1
test ecx, 03h
jnz ByteLoop
DwordTest:
test ecx, 04h ; checking if there are dword blocks that can be set
jz QwordTest
mov [edi], eax
add edi, 4
sub ecx, 4
QwordTest:
test ecx, 0FFFFFFF8h
jz toend
align 16
QwordLoop:
mov [edi], eax
mov [edi + 04h], eax
add edi, 8
sub ecx, 8
test ecx, 0FFFFFFF8h
jnz QwordLoop
toend:
mov eax, dword ptr[esp + 04h] ; return the original destination pointer
mov edi, edx ; restore non-volatile edi
ret
memset endp
end
边栏推荐
- Openwrt compilation driver module (write code at any position outside the openwrt source code, and compile independently in a modular manner.Ko)
- 逗号操作符你有用过吗?
- Wechat applet personal number opens traffic master
- [sword finger offer] interview question 52: the first common node of two linked lists - stack, hash table, double pointer
- 禁令之下,安防巨头海康与大华的应对之策!
- C language realizes the conversion between byte stream and hexadecimal string
- Openwrt增加对 sd card 支持
- Join hands with sifive, Galanz will enter the semiconductor field! Exposure of two self-developed chips
- Rare bitwise operators
- keil 采用 makefile 实现编译
猜你喜欢

Network principle (1) - overview of basic principles

Pycharm导入已有的Project

Mapreduce实例(一):WordCount

单机高并发模型设计

微信小程序个人号开通流量主

DRF学习笔记(一):数据序列化

centos yum方式安装mysql

Mapreduce实例(二):求平均值

CAS compares the knowledge exchanged, ABA problems, and the process of lock upgrading
![[sword finger offer] interview question 42: the maximum sum of continuous subarrays -- with 0x80000000 and int_ MIN](/img/01/bbf81cccb47b6351d7265ee4a77c55.png)
[sword finger offer] interview question 42: the maximum sum of continuous subarrays -- with 0x80000000 and int_ MIN
随机推荐
[sword finger offer] interview question 52: the first common node of two linked lists - stack, hash table, double pointer
leetcode25题:K 个一组翻转链表——链表困难题目详解
C语言程序设计(第三版)
Clickhouse 20.x distributed table testing and chproxy deployment (II)
C: What is the return value (revolution) in a function
传音控股披露被华为起诉一事:已立案,涉案金额2000万元
可载100人!马斯克发布史上最强“星际飞船” !最早明年上火星!
It can carry 100 people! Musk releases the strongest "starship" in history! Go to Mars as early as next year!
[regular expression] match the beginning and end
Join hands with sifive, Galanz will enter the semiconductor field! Exposure of two self-developed chips
Mapreduce实例(一):WordCount
43亿欧元现金收购欧司朗宣告失败!ams表示将继续收购
单机高并发模型设计
DRF学习笔记(准备)
leetcode234题-简单方法判断回文链表
[regular expression] matching grouping
mysql设置密码时报错 Your password does not satisfy the current policy requirements(修改·mysql密码策略设置简单密码)
Addition, deletion, query and modification of MySQL table data
centos yum方式安装mysql
A powerful web vulnerability scanning and verification tool (vulmap)