Re: 64-bit compile? - SOLVED

2007-11-15 Thread Bart Oldeman
On Nov 15, 2007 7:16 AM, Bryan J. Smith [EMAIL PROTECTED] wrote:

 Hence why I wrote a brief blog article here:
 'What is x86-64? Long Mode memory model ...'
 http://thebs413.blogspot.com/2005/10/what-is-x86-64-long-mode-memory-model.html

One thing to correct, otherwise it looks fine:
'Long Mode also offers a 48-bit (256TiB) Flat address model by
using the 16-bit segment register as bits 32-47 to the 32-bit offset
register of bits 0-31. This is the new memory model that programs
and libraries may use.'

No, segment registers are large ignored in long mode! What happens is
that you have 64-bit registers RAX, RBX, RCX etc., and using those you
can address 48-bits (bits 48-63 are not used). In fact there is a 2^47
byte sized positive user address space from 0 to 2^47-1 and a 2^47
sized negative kernel address space from 2^64-2^47 to 2^64-1.

As for segment registers, only fs and gs are used, and each have a
64-bit base address associated to them; the bits of fs and gs
themselves are independent of bits 32-47 of the final address.

 In a nutshell, 48-bit (PAE 52-bit) addressed Long Mode is focused
 on being 32-bit (PAE 36-bit) i486 TLB (i686 PAE) compatible.  But
 there is no reason why it can't support i386 Virtual86 modes either.
 The patch allows Virtual86 programs to run on a Long Mode kernel
 just as fast as they do on i486 or i686 PAE kernels.

Long mode does not support running i386 Virtual86 modes. That's how
the chip works.
In fact the chip has three modes:

real  legacy   long

legacy (what we used to simply call protected mode) has three
submodes: 16-bit protected, 32-bit protected, and Virtual86

long also has three submodes: 16-bit protected, 32-bit protected, and
64-bit protected:  note that V86 is missing!

It is easy to switch between submodes, but harder to switch between
modes; interrupt handling in particular is different.
So the referenced kernel patch needs to shut off long mode, disable
paging, enter legacy mode, re-enable paging, and then enter virtual-86
mode. Everytime an interrupt comes in, it needs to do the reverse --
nothing goes as easy as automatically resetting a flag as with a
legacy mode (32-bit) kernel. Indeed the similarities between 52-bit
and 36-bit PAE make it possible to not having to convert page tables
though.

Hope that clarifies some bits,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-msdos in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


How can I force all files created by any user in dosemu to be 'read and write' enabled for all users?

2007-11-15 Thread Tarquin Adams
Currently when a user creates a file, it is 'read only' for that user's group 
and other users.  Only the creating user has read write permissions.

How can I force all files created by any user in dosemu to be 'read and write' 
enabled for all users or at least for users in the same group as the creator?

Regards,
Tarquin Adams

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.15.32/1131 - Release Date: 14/11/2007 
16:54
 
-
To unsubscribe from this list: send the line unsubscribe linux-msdos in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: How can I force all files created by any user in dosemu to be 'read and write' enabled for all users?

2007-11-15 Thread Frank Cox
On Thu, 15 Nov 2007 10:26:56 -
Tarquin Adams [EMAIL PROTECTED] wrote:

 How can I force all files created by any user in dosemu to be 'read and 
 write' enabled for all users or at least for users in the same group as the 
 creator?

Write a little script to load dosemu from and set a umask value in it.

umask 002
dosemu -I 'keystroke cd temp\rmyfile\r'

This little script sets things up so files written by DOSEMU are r/w for all
users in the same group as the guy who loaded the script.  It then does this in
your DOSEMU window:

cd temp
myfile

Go to directory named c:\temp, run a file called myfile.


-- 
MELVILLE THEATRE ~ Melville Sask ~ http://www.melvilletheatre.com
-
To unsubscribe from this list: send the line unsubscribe linux-msdos in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: documentation for fs redirector

2007-11-15 Thread Rafał Cygnarowski
Hi!

 int21/ah=6c is the one to use for a DOS app. IIRC DJGPP programs use
 this one for straight C programs; otherwise you'd have to call it
 manually.

quotation
INT 2F CU - NETWORK REDIRECTOR (DOS 4.0+) - EXTENDED OPEN/CREATE FILE
AX = 112Eh
SS = DS = DOS DS

[cut]

BUG:this function is not called correctly under some DOS versions
  (at least 5.0 and 6.2):
the file attribute on the stack is not correct if the action
  code is 11h,
the result code in CX is not passed back to the application.
/quotation

and:

quotation
INT 21 - DOS 4.0+ - EXTENDED OPEN/CREATE
AX = 6C00h

[cut]

BUG:this function has bugs (at least in DOS 5.0 and 6.2) when used with
  drives handled via the network redirector (INT 2F/AX=112Eh):
- CX (attribute) is not passed to the redirector if DL=11h,
- CX does not return the status, it is returned unchanged because
  DOS does a PUSH CX/POP CX when calling the redirector.
/quotation

I wanted make workaround for this while I use DOS versions affected by this 
bug. I found CX value on the stack and changed this value so int21 could pop 
it. Unfortunately CX still contains file attribute instead of my replaced 
result. Why? Is my idea completely wrong or I just missed sth? Maybe I should 
use some TSR witch could catch int21 inside DOS and do the thing? - I'm not 
an assembler guru and I really don't know what if and what I can do more...

Regards,
-- 
Rafał Cygnarowski
[EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part.


Re: documentation for fs redirector

2007-11-15 Thread Mike McCarty

Rafał Cygnarowski wrote:

Hi!


int21/ah=6c is the one to use for a DOS app. IIRC DJGPP programs use
this one for straight C programs; otherwise you'd have to call it
manually.


quotation
INT 2F CU - NETWORK REDIRECTOR (DOS 4.0+) - EXTENDED OPEN/CREATE FILE
AX = 112Eh
SS = DS = DOS DS

[cut]

BUG:this function is not called correctly under some DOS versions
  (at least 5.0 and 6.2):
the file attribute on the stack is not correct if the action
  code is 11h,
the result code in CX is not passed back to the application.
/quotation

and:

quotation
INT 21 - DOS 4.0+ - EXTENDED OPEN/CREATE
AX = 6C00h

[cut]

BUG:this function has bugs (at least in DOS 5.0 and 6.2) when used with
  drives handled via the network redirector (INT 2F/AX=112Eh):
- CX (attribute) is not passed to the redirector if DL=11h,
- CX does not return the status, it is returned unchanged because
  DOS does a PUSH CX/POP CX when calling the redirector.
/quotation

I wanted make workaround for this while I use DOS versions affected by this 
bug. I found CX value on the stack and changed this value so int21 could pop 
it. Unfortunately CX still contains file attribute instead of my replaced 
result. Why? Is my idea completely wrong or I just missed sth? Maybe I should 
use some TSR witch could catch int21 inside DOS and do the thing? - I'm not 
an assembler guru and I really don't know what if and what I can do more...


Without actually seeing the defective code from DOS and your
attempted workaround, it's impossible to tell. I am an old hand
at MSDOS and assembler, though not much with the undocumented
I/Fs. However, if you want you can shoot me some code and I'll
have a look. Perhaps we can work this out via e-mail.

A TSR may not be able to do what you want, unless it is rather
smart. CX may be clobbered so far up that there's no way
for you to fix it, except in a DOS version specific manner,
if at all. One possibility is to patch DOS at install. IOW,
find the defective code, and patch over it, possibly jumping
out into your own code in a couple of places. It may not be
possible to fix this w/o clobbering something else that DOS needs,
so the patches might be significant. IOW, you might need to
trap multiple interrupt vectors and save information for more
than one level of DOS, along with flags indicating what was
taking place at the time CX got clobbered, and restore the
values the various levels of DOS need.

Mike
--
p=p=%c%s%c;main(){printf(p,34,p,34);};main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!
-
To unsubscribe from this list: send the line unsubscribe linux-msdos in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: documentation for fs redirector

2007-11-15 Thread Rafał Cygnarowski
Hi!

Dnia czwartek, 15 listopada 2007, Mike McCarty napisał:
 Without actually seeing the defective code from DOS and your
 attempted workaround, it's impossible to tell. I am an old hand
 at MSDOS and assembler, though not much with the undocumented
 I/Fs. However, if you want you can shoot me some code and I'll
 have a look. Perhaps we can work this out via e-mail.

 A TSR may not be able to do what you want, unless it is rather
 smart. CX may be clobbered so far up that there's no way
 for you to fix it, except in a DOS version specific manner,
 if at all. One possibility is to patch DOS at install. IOW,
 find the defective code, and patch over it, possibly jumping
 out into your own code in a couple of places. It may not be
 possible to fix this w/o clobbering something else that DOS needs,
 so the patches might be significant. IOW, you might need to
 trap multiple interrupt vectors and save information for more
 than one level of DOS, along with flags indicating what was
 taking place at the time CX got clobbered, and restore the
 values the various levels of DOS need.

This is fragment of dosemu code called after int2f AX=112E (just before 
quitting):

if (LOW(state-eax) == MULTIPURPOSE_OPEN /* 2E */) {
u_char *stack_ch, *stack_cl;

// original CX value when int21 ah=6c00 is called
u_short in2e_fileattr = sda_ext_attr(sda); 

// normally this should be enought
SETWORD((state-ecx), out2e_result);

// but I try to modify pushed CX on stack
stack_ch = (u_char *) (Addr(state, ss, esp) - (784 + 6));
stack_cl = (u_char *) (Addr(state, ss, esp) - (784 + 7));
if (
((in2e_fileattr  0x00ff) != *stack_cl) 
((in2e_fileattr  0xff00) != *stack_ch)
) {
// sanity check
error(Wrong stack offset for MULTIPURPOSE_OPEN!   

Expected value: 0x%04x. Value on stack 0x%02x%02x\n,
in2e_fileattr, *stack_ch, *stack_cl);
leavedos(1);
}

*stack_ch = (out2e_result  0xFF00)  16;
*stack_cl = out2e_result  0x00FF;
}

I use this program to test if CX was set correctly:

#include stdio.h
#include io.h
#include dos.h
#include conio.h
#include errno.h

#define u_short unsigned int
#define u_char unsigned char

int open2e(u_short openmode, u_short fileattr, u_short fci, char *filename, 
int *respond)
{
int __fd = -1, res;

asm {
mov ax, 0x6c00
mov bx, openmode
mov cx, fileattr
mov dx, fci
mov si, filename
int 0x21
jc blad
}

asm mov res, cx;
asm mov __fd, ax;
*respond = res;
return __fd;

blad:
asm mov errno, ax;

return -1;
}

int main(void)
{
int fd, res;
char *filename = F:\\TEST.TXT;

clrscr();

fd = open2e(0x0042, 0x002a, 0x0001, filename, res);

if (fd == -1) {
perror(open2e);
} else {
printf(2e respond: 0x%04x\n, res);
printf(fd == %d\n, fd);
write(fd, write test, 11);
close(fd);
}

getch();

return 0;
}

If you need more do not hesitate to ask.

Best regards,
-- 
Rafał Cygnarowski
[EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part.