Oberon-07:

base address 0x10000 for applications
(parameter "kem" instead "kos")

git-svn-id: svn://kolibrios.org@7209 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Anton Krotov 2018-03-23 22:01:12 +00:00
parent 2644460def
commit bddfb2f439
8 changed files with 92 additions and 40 deletions

View File

@ -17,6 +17,8 @@
"elf" - Linux "elf" - Linux
"kos" - KolibriOS "kos" - KolibriOS
"obj" - KolibriOS DLL "obj" - KolibriOS DLL
"kem" - KolibriOS с адресом загрузки 0x10000 для возможного
исполнения в эмуляторе
3) размер стэка в мегабайтах, необязательный параметр, по умолчанию - 3) размер стэка в мегабайтах, необязательный параметр, по умолчанию -
1 Мб, для ELF игнорируется. Если 2-й параметр = "obj" (KolibriOS DLL), 1 Мб, для ELF игнорируется. Если 2-й параметр = "obj" (KolibriOS DLL),
то 3-й параметр задается шестнадцатиричным числом то 3-й параметр задается шестнадцатиричным числом

View File

@ -17,6 +17,8 @@
"elf" - Linux "elf" - Linux
"kos" - KolibriOS "kos" - KolibriOS
"obj" - KolibriOS DLL "obj" - KolibriOS DLL
"kem" - KolibriOS á  ¤à¥á®¬ § £à㧪¨ 0x10000 ¤«ï ¢®§¬®¦­®£®
¨á¯®«­¥­¨ï ¢ í¬ã«ïâ®à¥
3) à §¬¥à áâíª  ¢ ¬¥£ ¡ ©â å, ­¥®¡ï§ â¥«ì­ë© ¯ à ¬¥âà, ¯® 㬮«ç ­¨î - 3) à §¬¥à áâíª  ¢ ¬¥£ ¡ ©â å, ­¥®¡ï§ â¥«ì­ë© ¯ à ¬¥âà, ¯® 㬮«ç ­¨î -
1 Œ¡, ¤«ï ELF ¨£­®à¨àã¥âáï. …᫨ 2-© ¯ à ¬¥âà = "obj" (KolibriOS DLL), 1 Œ¡, ¤«ï ELF ¨£­®à¨àã¥âáï. …᫨ 2-© ¯ à ¬¥âà = "obj" (KolibriOS DLL),
â® 3-© ¯ à ¬¥âà § ¤ ¥âáï è¥áâ­ ¤æ â¨à¨ç­ë¬ ç¨á«®¬ â® 3-© ¯ à ¬¥âà § ¤ ¥âáï è¥áâ­ ¤æ â¨à¨ç­ë¬ ç¨á«®¬

View File

@ -1,5 +1,5 @@
(* (*
Copyright 2016, 2017 Anton Krotov Copyright 2016, 2017, 2018 Anton Krotov
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by
@ -247,7 +247,7 @@ BEGIN
res := 0 res := 0
END END
END; END;
IF res # 0 THEN IF (res # 0) & (size <= MAX_SIZE) THEN
zeromem(ASR(size, 2) - 1, res) zeromem(ASR(size, 2) - 1, res)
END END
RETURN res RETURN res
@ -300,7 +300,7 @@ END _DISPOSE;
PROCEDURE ExitProcess* (p1: INTEGER); PROCEDURE ExitProcess* (p1: INTEGER);
BEGIN BEGIN
p1 := sysfunc1(-1) p1 := sysfunc1(-1)
END ExitProcess; END ExitProcess;

View File

@ -35,9 +35,9 @@ TYPE
VAR VAR
con_init : PROCEDURE [stdcall] (wnd_width, wnd_height, scr_width, scr_height, title: INTEGER); con_init : PROCEDURE [stdcall] (wnd_width, wnd_height, scr_width, scr_height, title: INTEGER);
con_exit : PROCEDURE [stdcall] (bCloseWindow: BOOLEAN); con_exit : PROCEDURE [stdcall] (bCloseWindow: BOOLEAN);
con_write_asciiz : PROCEDURE [stdcall] (string: INTEGER); con_write_asciiz : PROCEDURE [stdcall] (string: INTEGER);
fsize, sec*, dsec*: INTEGER; fsize, sec*, dsec*: INTEGER;
@ -107,8 +107,8 @@ BEGIN
Time(sec, dsec); Time(sec, dsec);
Lib := API.sysfunc3(68, 19, sys.ADR("/rd/1/lib/console.obj")); Lib := API.sysfunc3(68, 19, sys.ADR("/rd/1/lib/console.obj"));
IF Lib # 0 THEN IF Lib # 0 THEN
GetProc(sys.ADR(con_init), "con_init"); GetProc(sys.ADR(con_init), "con_init");
GetProc(sys.ADR(con_exit), "con_exit"); GetProc(sys.ADR(con_exit), "con_exit");
GetProc(sys.ADR(con_write_asciiz), "con_write_asciiz"); GetProc(sys.ADR(con_write_asciiz), "con_write_asciiz");
IF con_init # NIL THEN IF con_init # NIL THEN
con_init(-1, -1, -1, -1, sys.ADR("Oberon-07/11 for KolibriOS")) con_init(-1, -1, -1, -1, sys.ADR("Oberon-07/11 for KolibriOS"))
@ -124,17 +124,27 @@ BEGIN
API.ExitProcess(0) API.ExitProcess(0)
END ExitProcess; END ExitProcess;
PROCEDURE AppAdr(): INTEGER;
VAR
buf: ARRAY 1024 OF CHAR;
a: INTEGER;
BEGIN
a := API.sysfunc3(9, sys.ADR(buf), -1);
sys.GET(sys.ADR(buf) + 22, a)
RETURN a
END AppAdr;
PROCEDURE GetCommandLine*(): INTEGER; PROCEDURE GetCommandLine*(): INTEGER;
VAR param: INTEGER; VAR param: INTEGER;
BEGIN BEGIN
sys.GET(28, param) sys.GET(28 + AppAdr(), param)
RETURN param RETURN param
END GetCommandLine; END GetCommandLine;
PROCEDURE GetName*(): INTEGER; PROCEDURE GetName*(): INTEGER;
VAR name: INTEGER; VAR name: INTEGER;
BEGIN BEGIN
sys.GET(32, name) sys.GET(32 + AppAdr(), name)
RETURN name RETURN name
END GetName; END GetName;

View File

@ -1,5 +1,5 @@
(* (*
Copyright 2016 Anton Krotov Copyright 2016, 2018 Anton Krotov
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by
@ -187,17 +187,27 @@ BEGIN
RETURN ptr RETURN ptr
END realloc; END realloc;
PROCEDURE AppAdr(): INTEGER;
VAR
buf: ARRAY 1024 OF CHAR;
a: INTEGER;
BEGIN
a := sysfunc3(9, sys.ADR(buf), -1);
sys.GET(sys.ADR(buf) + 22, a)
RETURN a
END AppAdr;
PROCEDURE GetCommandLine*(): INTEGER; PROCEDURE GetCommandLine*(): INTEGER;
VAR param: INTEGER; VAR param: INTEGER;
BEGIN BEGIN
sys.GET(28, param) sys.GET(28 + AppAdr(), param)
RETURN param RETURN param
END GetCommandLine; END GetCommandLine;
PROCEDURE GetName*(): INTEGER; PROCEDURE GetName*(): INTEGER;
VAR name: INTEGER; VAR name: INTEGER;
BEGIN BEGIN
sys.GET(32, name) sys.GET(32 + AppAdr(), name)
RETURN name RETURN name
END GetName; END GetName;

View File

@ -1,5 +1,5 @@
(* (*
Copyright 2016, 2017 Anton Krotov Copyright 2016, 2017, 2018 Anton Krotov
This file is part of Compiler. This file is part of Compiler.
@ -289,6 +289,10 @@ BEGIN
IntType(e1.T, coord); IntType(e1.T, coord);
Load(e1); Load(e1);
IF e.T.Len = 0 THEN IF e.T.Len = 0 THEN
IF e1.eType = eCONST THEN
idx := FLOOR(e1.Value);
Assert(idx >= 0, coord, 159)
END;
BaseT := DECL.OpenBase(e.T); BaseT := DECL.OpenBase(e.T);
X86.PushConst(BaseT.Size); X86.PushConst(BaseT.Size);
X86.OpenIdx(DECL.Dim(e.T)) X86.OpenIdx(DECL.Dim(e.T))
@ -866,6 +870,9 @@ BEGIN
X86.DropFpu(param.T.tType = TLONGREAL) X86.DropFpu(param.T.tType = TLONGREAL)
END; END;
IF (e1.T.tType = TSTRING) & (param.T.tType = TARRAY) THEN IF (e1.T.tType = TSTRING) & (param.T.tType = TARRAY) THEN
IF param.T.Len > X86.maxstrlen THEN
X86.set_maxstrlen(param.T.Len)
END;
s := DECL.GetString(e1.Value); s := DECL.GetString(e1.Value);
IF s.Len = 1 THEN IF s.Len = 1 THEN
X86.Mono(s.Number) X86.Mono(s.Number)
@ -1885,7 +1892,11 @@ BEGIN
END; END;
UTILS.Split(SelfName, SelfPath, CName, CExt); UTILS.Split(SelfName, SelfPath, CName, CExt);
temp := Name; temp := Name;
IF UTILS.streq(system, "obj") THEN IF UTILS.streq(system, "kem") THEN
X86.setkem;
platform := 4;
UTILS.concat(temp, ".kex")
ELSIF UTILS.streq(system, "obj") THEN
platform := 6; platform := 6;
UTILS.concat(temp, ".obj") UTILS.concat(temp, ".obj")
ELSIF UTILS.streq(system, "elf") THEN ELSIF UTILS.streq(system, "elf") THEN
@ -1924,6 +1935,7 @@ BEGIN
UTILS.concat(SelfPath, "Windows32") UTILS.concat(SelfPath, "Windows32")
END; END;
UTILS.concat(SelfPath, UTILS.Slash); UTILS.concat(SelfPath, UTILS.Slash);
X86.set_maxstrlen(0);
X86.Init(platform); X86.Init(platform);
X86.Prolog(temp); X86.Prolog(temp);
DECL.Program(SelfPath, Path, Name, Ext, platform IN {1, 2, 3}, OpSeq, Expr, AssComp, sttypes); DECL.Program(SelfPath, Path, Name, Ext, platform IN {1, 2, 3}, OpSeq, Expr, AssComp, sttypes);

View File

@ -1,5 +1,5 @@
(* (*
Copyright 2016, 2017 Anton Krotov Copyright 2016, 2017, 2018 Anton Krotov
This file is part of Compiler. This file is part of Compiler.
@ -119,7 +119,7 @@ TYPE
reloc: ARRAY 1024 OF sys.CARD16 reloc: ARRAY 1024 OF sys.CARD16
END; END;
VAR asmlist: UTILS.LIST; start: ASMLINE; dll, con, gui, kos, elf, obj: BOOLEAN; VAR asmlist: UTILS.LIST; start: ASMLINE; dll, con, gui, kos, elf, obj, kem: BOOLEAN;
Lcount, reccount, topstk: INTEGER; recarray: ARRAY 2048 OF INTEGER; current*: ASMLINE; Lcount, reccount, topstk: INTEGER; recarray: ARRAY 2048 OF INTEGER; current*: ASMLINE;
callstk: ARRAY 1024, 2 OF ASMLINE; OutFile: UTILS.STRING; callstk: ARRAY 1024, 2 OF ASMLINE; OutFile: UTILS.STRING;
Code: ARRAY 4000000 OF CHAR; ccount: INTEGER; Data: ARRAY 1000000 OF CHAR; dcount: INTEGER; Code: ARRAY 4000000 OF CHAR; ccount: INTEGER; Data: ARRAY 1000000 OF CHAR; dcount: INTEGER;
@ -128,6 +128,12 @@ VAR asmlist: UTILS.LIST; start: ASMLINE; dll, con, gui, kos, elf, obj: BOOLEAN;
RtlProc: ARRAY 20 OF INTEGER; OutFilePos: INTEGER; RelocSection: SECTION; RtlProc: ARRAY 20 OF INTEGER; OutFilePos: INTEGER; RelocSection: SECTION;
fpu*: INTEGER; isfpu: BOOLEAN; maxfpu: INTEGER; fpucmd: ASMLINE; fpu*: INTEGER; isfpu: BOOLEAN; maxfpu: INTEGER; fpucmd: ASMLINE;
kosexp: ARRAY 65536 OF RECORD Name: SCAN.NODE; Adr, NameLabel: INTEGER END; kosexpcount: INTEGER; kosexp: ARRAY 65536 OF RECORD Name: SCAN.NODE; Adr, NameLabel: INTEGER END; kosexpcount: INTEGER;
maxstrlen*: INTEGER;
PROCEDURE set_maxstrlen* (value: INTEGER);
BEGIN
maxstrlen := value
END set_maxstrlen;
PROCEDURE AddRtlProc*(idx, proc: INTEGER); PROCEDURE AddRtlProc*(idx, proc: INTEGER);
BEGIN BEGIN
@ -567,7 +573,7 @@ BEGIN
NEW(nov); NEW(nov);
UTILS.MemErr(nov = NIL); UTILS.MemErr(nov = NIL);
UTILS.Push(asmlist, nov); UTILS.Push(asmlist, nov);
current := nov; current := nov
END Init; END Init;
PROCEDURE datastr(str: UTILS.STRING); PROCEDURE datastr(str: UTILS.STRING);
@ -1556,10 +1562,10 @@ BEGIN
IF ~obj THEN IF ~obj THEN
Header.menuet01 := "MENUET01"; Header.menuet01 := "MENUET01";
Header.ver := 1; Header.ver := 1;
Header.start := sys.SIZE(KOSHEADER); Header.start := sys.SIZE(KOSHEADER) + ORD(kem) * 65536;
Header.size := Align(size, 4) + datasize; Header.size := Align(size, 4) + datasize;
Header.mem := Header.size + stk + gsize + strsize * 2 + 1000H; Header.mem := Header.size + stk + gsize + strsize * 2 + 1000H;
Header.sp := Header.size + gsize + stk; Header.sp := Header.size + gsize + stk;// + ORD(kem) * 65536;
Header.param := Header.sp; Header.param := Header.sp;
Header.path := Header.param + strsize; Header.path := Header.param + strsize;
@ -1768,7 +1774,7 @@ BEGIN
ELSIF con OR gui THEN ELSIF con OR gui THEN
LoadAdr := 400000H LoadAdr := 400000H
ELSIF kos OR obj THEN ELSIF kos OR obj THEN
LoadAdr := sys.SIZE(KOSHEADER) LoadAdr := sys.SIZE(KOSHEADER) + ORD(kem & kos) * 65536
ELSIF elf THEN ELSIF elf THEN
LoadAdr := 134514420 + 1024; LoadAdr := 134514420 + 1024;
INC(gsize, 1024) INC(gsize, 1024)
@ -1926,6 +1932,9 @@ PROCEDURE Epilog*(gsize: INTEGER; FName: ARRAY OF CHAR; stk: INTEGER);
VAR i, glob: INTEGER; VAR i, glob: INTEGER;
BEGIN BEGIN
glob := 0; glob := 0;
IF gsize < maxstrlen THEN
gsize := maxstrlen
END;
gsize := Align(gsize, 4) + 4; gsize := Align(gsize, 4) + 4;
COPY(FName, OutFile); COPY(FName, OutFile);
Labels[RTABLE] := -dcount; Labels[RTABLE] := -dcount;
@ -1985,4 +1994,11 @@ BEGIN
FixLabels(FName, stk, gsize, glob) FixLabels(FName, stk, gsize, glob)
END Epilog; END Epilog;
PROCEDURE setkem*;
BEGIN
kem := TRUE
END setkem;
BEGIN
kem := FALSE
END X86. END X86.