Deutsch   English   Français   Italiano  
<vq7guv$20520$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: "Paul Edwards" <mutazilah@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: [OSDev] How to switch to long mode in x86 CPUs?
Date: Wed, 5 Mar 2025 05:31:55 +1100
Organization: A noiseless patient Spider
Lines: 95
Message-ID: <vq7guv$20520$1@dont-email.me>
References: <871pvje5yq.fsf@onesoftnet.eu.org> <vprtt6$3jah9$1@dont-email.me> <vpu3m5$3804$1@dont-email.me> <JdFwP.46247$SZca.36276@fx13.iad> <vq14gq$mrnn$1@dont-email.me> <vq208q$re74$1@dont-email.me>
Injection-Date: Tue, 04 Mar 2025 19:32:00 +0100 (CET)
Injection-Info: dont-email.me; posting-host="3ae2290f9c322854d72e270fee36c798";
	logging-data="2102336"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/tnGZNuSG/WOP0UdLI9ZtbWvimM/T2too="
Cancel-Lock: sha1:X9VIaftbn0ojiFUuVPgHMr3FdxQ=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MSMail-Priority: Normal
Bytes: 3087

"bart" <bc@freeuk.com> wrote in message news:vq208q$re74$1@dont-email.me...
> On 02/03/2025 08:22, Paul Edwards wrote:
> > "Scott Lurndal" <scott@slp53.sl.home> wrote in message
> > news:JdFwP.46247$SZca.36276@fx13.iad...
> >> "Paul Edwards" <mutazilah@gmail.com> writes:
> >>> "David Brown" <david.brown@hesbynett.no> wrote in message
> >>> news:vprtt6$3jah9$1@dont-email.me...
> >>>> On 27/02/2025 16:57, Ar Rakin wrote:
> >>>
> >>
> >>> Do you consider the concept of a BIOS (as seen as the IBM PC),
> >>> "legitimate to use"
> >>
> >> In the abstract, possibly.  But the last half century has
> >> shown that BIOS as an I/O abstraction layer was a bad idea
> >> from the start.
> >>
> >>> and do you consider MSDOS (which uses that
> >>> BIOS) to be an operating system?
> >>
> >> No, MSDOS was, is, will always be a simple program loader.
> >
> > Plus manages memory.
>
> How does it do that? I seem to recall that you got 640KB minus whatever
> the resident parts of the OS needed.

Yes - and? Then you need to manage that memory, so you
need a memory manager, which MSDOS provides. It's not
trivial to write/debug one of those either.

I'm not sure what your question is exactly, so I'll include code
to call the interrupt (21H AH=48H) you need to obtain memory.

BFN. Paul.



; void CTYP __allocmem(size_t size, void **ptr);

public __allocmem
ifdef __SZ4__
__allocmem proc uses bx dx ds cx, sz:dword, res:ptr
else
__allocmem proc uses bx dx ds, sz:word, res:ptr
endif

if @DataSize eq 0

; return NULL

mov bx, res
mov word ptr [bx], 0

ret

else

ifdef __SZ4__
mov ax, word ptr sz+2
mov cl, 12
shl ax, cl
mov bx, word ptr sz
else
mov bx,sz
mov ax,0
endif

shr bx,1
shr bx,1
shr bx,1
shr bx,1

add bx,1
add bx,ax

mov ah, 48h
int 21h

jnc allocok
mov ax, 0

allocok:

lds bx, res
mov word ptr [bx], 0
mov word ptr [bx+2], ax

ret

endif

__allocmem endp