• Please review our updated Terms and Rules here

PDOS-generic for 68000

kerravon

Experienced Member
Joined
Oct 30, 2021
Messages
162
I'm interested in getting PDOS-generic to run on a 68000 or 68020.

And turning it into a mini-Amiga clone - ie, able to run certain valid Amiga Hunks.

But first I need to turn Linux for the 68k into a "glorified BIOS".

And the way I do that is to create a binary - presumably ELF - that does direct syscalls instead of using glibc.

I have that working for ARM32, ARM64, x86 and x64. And now I need it for the 68k.

Any idea how to do a syscall (trap?) and what the syscall numbers are?

The project is around here:


Thanks. Paul.
 
Hi Paul,

I'm not sure I understand your question, so please forgive me if I end up "in the weeds". The 68000 uses an exception table that must start at address zero. It is $400 in length, and contains vectors to processes that handle system requirements. A large part of that table (vectors 64 - 255) is set aside for user defined vectors. The opcode TRAP #(0-15) invokes the vectors at $80 through $BC. So, is that what you are looking for to implement user syscalls?

Later generations of the 68k provide a register ("VBR" -- vector base register) that allows copies of the vector table at memory locations other than $0. The VBR is set to $0 at power up/reset.

Hope this helps.

Roger
 
I'm not sure I understand your question, so please forgive me if I end up "in the weeds". The 68000 uses an exception table that must start at address zero. It is $400 in length, and contains vectors to processes that handle system requirements. A large part of that table (vectors 64 - 255) is set aside for user defined vectors. The opcode TRAP #(0-15) invokes the vectors at $80 through $BC. So, is that what you are looking for to implement user syscalls?
Hi Roger.

I got the answer (trap #0 - syscall numbers the same as 80386 Linux, and registers used - took a lot of effort to realize that) elsewhere (an Amiga forum), and have already implemented it here:



So I already have a mini-clone operational:

[kerravon@paul-pinebook xxx]$ file pdptest.exe
pdptest.exe: AmigaOS loadseg()ble executable/binary
[kerravon@paul-pinebook xxx]$ file bios.exe
bios.exe: ELF 32-bit MSB executable, Motorola m68k, 68020, version 1 (SYSV), statically linked, stripped
[kerravon@paul-pinebook xxx]$ qemu-m68k ./bios.exe pdptest.exe "abc def"

bios starting
about to execute program with entry point C080202C
welcome to pdptest
main function is at C0802200
allocating 10 bytes
m1 is C0CC7008
allocating 20 bytes
m2 is C0CC8008
stack is around C07FFE50
printing arguments
argc = 3
arg 0 is <UNKNOWN>
arg 1 is <abc>
arg 2 is <def>
return from called program is hex 0
enter command, exit to exit

bios exiting
[kerravon@paul-pinebook xxx]$


[kerravon@paul-pinebook xxx]$ ls -l pdptest.exe bios.exe
-rwxr-xr-x 1 kerravon kerravon 50760 May 30 04:25 bios.exe
-rw-r--r-- 1 kerravon kerravon 24688 May 30 04:22 pdptest.exe
[kerravon@paul-pinebook xxx]$


The big thing I am missing at the moment is public domain (not
copyrighted - those exist) 68000 assembler to do these:

modsi3, mulsi3, udivsi3, umodsi3, divsi3

which is forcing me to use -m68020 in makefile.ami instead of

-m68000 -m68881 (an allowable combination to gccami).


The assembler heart of the mini Amiga clone (it's not really an
emulator - it's a mini-clone), is the 68000 assembler here:


(and corresponding C code and infrastructure elsewhere).


Anyway - an Amiga mini-clone in 51k is similar to my mini-WINE in 60k or similar.

And OS/2 mini-clone - and mini Windows clone on OS/2 etc etc.

It's only recently when looking at options to repeat that on the Atari
that I realized I should be able to do it for the mainframe too.

Lightweight mini-clones for anything on anything (anything with
the same CPU and preferably same function calling convention
otherwise a different technique is required).

BFN. Paul.
 
but the OS is in ROM so not sure if it makes to boot another OS.
The technique I am using these days is to treat the existing OS as a glorified BIOS.

So yes - you can boot another OS within an existing OS.

There are constraints/rules though, if you want it to work.

And if you simply claim that those rules at too onerous, then no - it isn't a clone (not even a mini-clone) at all.

I'm happy to live within the (new) rules though, so it's a "sufficient clone" for my purposes.

Personally I think it is fantastic. But my desires are different from most.
 
Back
Top