X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: eplmst AT lu DOT erisoft DOT se (Martin Stromberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: DS and ESP Date: 19 Feb 2002 08:25:20 GMT Organization: Ericsson Erisoft AB, Sweden Lines: 26 Message-ID: References: NNTP-Posting-Host: lws256.lu.erisoft.se X-Newsreader: TIN [version 1.2 PL2] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com MarKol (markol4 AT wp DOT pl) wrote: : b) similar problem is about esp (I belive that ss is valid ). : My stub routine assumes that valid program data on stack are : pointed by esp and higher values. Anything below esp is not : important for the program. But I've seen codes like this : (simple but ilustrates problem accessing stack segment below esp, : maybe programmer thought that nothing wrong can happen): : mov [esp-4], eax : shl eax, cl : add [edi], eax : mov eax, [esp-4] : If HW interrupt will be accepted between eax is restored there : are valid program data on the stack below esp. My asm stub uses : user stack below esp, and assumes there is no valid : user data below esp (it uses 8 bytes for ss and esp) That is correct. Unless interrupts are disabled when this code executes it's extremely broken. And it might be broken even if interrupts are disabled (page fault e. g.). Right, MartinS