From 4e89683483edab17f0ea9595e32aa3af86ae075b Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 14 Mar 1991 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1991-03-14 --- gnot/boot.c | 28 +- gnot/boot.h | 875 +++++++++++++++++++++++++----------------------- gnot/fns.h | 2 + port/devlance.c | 14 +- port/devpipe.c | 6 +- power/fns.h | 3 +- power/l.s | 7 +- power/main.c | 1 + power/trap.c | 10 +- 9 files changed, 509 insertions(+), 437 deletions(-) diff --git a/gnot/boot.c b/gnot/boot.c index f0dd75ff7a1341207dafd99ee238a8351d425f51..1d2dd589890f85b9edf2856d50ead40fed2e23b8 100644 --- a/gnot/boot.c +++ b/gnot/boot.c @@ -7,6 +7,8 @@ char buf[100]; char bootline[64]; char bootdevice; char bootserver[64]; +int format; +int manual; void error(char*); void sendmsg(int, char*); @@ -82,7 +84,7 @@ main(int argc, char *argv[]) bind("#k", "/net/net", MREPL); bind("#k", "/net/dk", MREPL); - if(strchr(bootline, ' ')) + if(manual) execl("/68020/init", "init", "-m", 0); else execl("/68020/init", "init", 0); @@ -198,11 +200,28 @@ void bootparams(void) { int f; + char *cp; + format = 0; + manual = 0; f = open("#e/bootline", OREAD); if(f >= 0){ - read(f, bootline, sizeof bootline); + read(f, bootline, sizeof(bootline)-1); close(f); + cp = bootline; + while(cp = strchr(cp, ' ')){ + if(*++cp != '-') + continue; + while(*cp && *cp!=' ') + switch(*cp++){ + case 'f': + format = 1; + break; + case 'm': + manual = 1; + break; + } + } } f = open("#e/bootdevice", OREAD); if(f >= 0){ @@ -307,7 +326,10 @@ cache(int fd) close(fd); dup(p[0], 1); close(p[0]); - execl("/cfs", "bootcfs", "-s", 0); + if(format) + execl("/cfs", "bootcfs", "-fs", 0); + else + execl("/cfs", "bootcfs", "-s", 0); break; default: close(p[0]); diff --git a/gnot/boot.h b/gnot/boot.h index 956365a90aaa571edc51c0220255edcfe60df420..ae25d8c1caef3f113b3604768be155d39df3c6e0 100644 --- a/gnot/boot.h +++ b/gnot/boot.h @@ -1,7 +1,7 @@ ulong bootcode[]={ 0x000000107, - 0x0000027a8, - 0x0000004dc, + 0x00000281c, + 0x0000004f4, 0x0000001e4, 0x000000000, 0x000002020, @@ -13,484 +13,513 @@ ulong bootcode[]={ 0x000142f2f, 0x00014610c, 0x02f006100, - 0x008284fef, + 0x0089c4fef, 0x0001c4e75, 0x04feffe84, 0x042a7486e, - 0x081b66100, - 0x009fa4878, + 0x081e66100, + 0x00a6e4878, 0x00001486e, - 0x081be6100, - 0x009ee4878, + 0x081ee6100, + 0x00a624878, 0x00001486e, - 0x081c66100, - 0x009e26100, - 0x004306100, - 0x0024e6100, - 0x003542f00, + 0x081f66100, + 0x00a566100, + 0x004266100, + 0x002446100, + 0x0034a2f00, 0x02f400194, - 0x0610004b6, + 0x06100050a, 0x02f2f0194, - 0x0610005b2, + 0x061000606, 0x02f2f0198, - 0x061000668, + 0x0610006bc, 0x02f40019c, - 0x0486e81ce, - 0x061000818, - 0x0486e81dc, - 0x0486e81d6, + 0x0486e81fe, + 0x06100088c, + 0x0486e820c, + 0x0486e8206, 0x0486f00a4, - 0x0610008d8, + 0x06100094c, 0x0487801b6, 0x048780001, 0x0486f00b0, - 0x061000972, + 0x0610009e6, 0x04a8042e7, 0x02f4001b6, 0x044df6c0a, - 0x0486e81e3, - 0x061000716, + 0x0486e8213, + 0x06100078a, 0x0588f2f2f, 0x001b8486e, - 0x081ea486f, + 0x0821a486f, 0x000bc6100, - 0x008a2486f, + 0x00916486f, 0x000c06100, - 0x00914588f, + 0x00988588f, 0x02f00486f, 0x000c42f2f, 0x001c86100, - 0x0096a2f00, + 0x009de2f00, 0x0486f00d0, - 0x0610008fa, + 0x06100096e, 0x0588f221f, 0x0b280670a, - 0x0486e81ed, - 0x0610006d2, + 0x0486e821d, + 0x061000746, 0x0588f2f2f, 0x001cc6100, - 0x0090a486e, - 0x081f9486e, - 0x081f3486f, + 0x0097e486e, + 0x08229486e, + 0x08223486f, 0x000d86100, - 0x008564878, + 0x008ca4878, 0x001b64878, 0x00001486e, - 0x082006100, - 0x008f04a80, + 0x082306100, + 0x009644a80, 0x042e72f40, 0x001ea44df, 0x06c0a486e, - 0x082086100, - 0x00694588f, + 0x082386100, + 0x00708588f, 0x02f2f01ec, - 0x0486e820f, + 0x0486e823f, 0x0486f00f0, - 0x061000820, + 0x061000894, 0x0486f00f4, - 0x061000892, + 0x061000906, 0x0588f2f00, 0x0486f00f8, 0x02f2f01fc, - 0x0610008e8, + 0x06100095c, 0x02f00486f, 0x001046100, - 0x00878588f, + 0x008ec588f, 0x0221fb280, 0x0670a486e, - 0x082126100, - 0x00650588f, + 0x082426100, + 0x006c4588f, 0x02f2f0200, - 0x061000888, + 0x0610008fc, 0x042a7486e, - 0x0821a486e, - 0x082186100, - 0x008684a80, + 0x0824a486e, + 0x082486100, + 0x008dc4a80, 0x06c0a486e, - 0x0821c6100, - 0x0062c588f, - 0x0486e8221, - 0x0610006f0, - 0x0486e822d, - 0x0486e822c, + 0x0824c6100, + 0x006a0588f, + 0x0486e8251, + 0x061000764, + 0x0486e825d, + 0x0486e825c, 0x048780006, - 0x0486e822a, + 0x0486e825a, 0x02f2f0228, - 0x06100086a, + 0x0610008de, 0x04a806c0a, - 0x0486e822e, - 0x0610005fe, + 0x0486e825e, + 0x061000672, 0x0588f486e, - 0x082346100, - 0x006c2486f, + 0x082646100, + 0x00736486f, 0x0012c486e, - 0x0823c6100, - 0x008604a80, + 0x0826c6100, + 0x008d44a80, 0x06c0a486e, - 0x082406100, - 0x005dc588f, + 0x082706100, + 0x00650588f, 0x0486f00c0, 0x0486f0138, - 0x0610016b4, + 0x061001728, 0x048780001, - 0x0486e8245, - 0x061000828, + 0x0486e8275, + 0x06100089c, 0x02f400244, 0x02f2f0130, - 0x0486e824d, + 0x0486e827d, 0x0486f014c, - 0x06100074c, + 0x0610007c0, 0x0486f0150, - 0x0610007be, + 0x061000832, 0x0588f2f00, 0x0486f0154, 0x02f2f0258, - 0x061000814, + 0x061000888, 0x02f2f025c, - 0x0610007d0, - 0x0486e8251, - 0x061000654, - 0x042a7486e, - 0x0825d486e, - 0x0825a6100, - 0x007a842a7, - 0x0486e8269, - 0x0486e8266, - 0x06100079a, - 0x048780020, - 0x0486e8682, - 0x06100073e, - 0x04a806720, + 0x061000844, + 0x0486e8281, + 0x0610006c8, 0x042a7486e, - 0x08282486e, - 0x0827d486e, - 0x082716100, - 0x00716486e, - 0x082966100, - 0x005404fef, - 0x002a04e75, - 0x042a7486e, - 0x08291486e, - 0x082856100, - 0x006fa598f, - 0x060e0598f, - 0x0102e8002, - 0x049c07241, - 0x0b2006700, - 0x000bc7261, - 0x0b2006700, - 0x000b27273, - 0x0b200676a, + 0x0828d486e, + 0x0828a6100, + 0x0081c42a7, + 0x0486e8299, + 0x0486e8296, + 0x06100080e, + 0x04aae801e, + 0x0672042a7, + 0x0486e82b2, + 0x0486e82ad, + 0x0486e82a1, + 0x061000794, + 0x0486e82c6, + 0x0610005be, + 0x04fef0298, + 0x04e7542a7, + 0x0486e82c1, + 0x0486e82b5, + 0x061000778, + 0x0598f60e0, + 0x0598f102e, + 0x0802249c0, + 0x07241b200, + 0x0670000bc, + 0x07261b200, + 0x0670000b2, + 0x07273b200, + 0x0676a4878, + 0x00002486e, + 0x083356100, + 0x007e22f40, + 0x000084aaf, + 0x00008508f, + 0x06c0a486e, + 0x0833c6100, + 0x00568588f, + 0x0486e834b, + 0x02f2f0004, + 0x06100052a, + 0x0486e8356, + 0x02f2f000c, + 0x06100051e, + 0x0610007a4, + 0x04fef0010, + 0x072ffb280, + 0x067204281, + 0x0b280670c, + 0x02f176100, + 0x00776588f, + 0x0588f4e75, + 0x048790000, + 0x0ea606100, + 0x00796588f, + 0x060f260ec, 0x048780002, - 0x0486e8305, - 0x061000764, + 0x0486e8303, + 0x061000778, 0x02f400008, 0x04aaf0008, - 0x0508f6c0a, - 0x0486e830c, - 0x0610004ea, - 0x0588f486e, - 0x0831b2f2f, - 0x000046100, - 0x004ac486e, - 0x083262f2f, - 0x0000c6100, - 0x004a06100, - 0x007264fef, - 0x0001072ff, - 0x0b2806720, - 0x04281b280, - 0x0670c2f17, - 0x0610006f8, - 0x0588f588f, - 0x04e754879, - 0x00000ea60, - 0x061000718, - 0x0588f60f2, - 0x060ec4878, + 0x06c0a486e, + 0x0830f6100, + 0x00500588f, + 0x0486e8323, + 0x02f2f000c, + 0x0610004c2, + 0x0486e832a, + 0x02f2f0014, + 0x0610004b6, + 0x04fef0018, + 0x06000ff7a, + 0x060be4878, 0x00002486e, - 0x082d36100, - 0x006fa2f40, + 0x082d26100, + 0x007362f40, 0x000084aaf, 0x000086c0a, - 0x0486e82df, - 0x061000482, + 0x0486e82de, + 0x0610004be, 0x0588f486e, - 0x082f32f2f, + 0x082f22f2f, 0x0000c6100, - 0x00444486e, - 0x082fa2f2f, + 0x00480486e, + 0x082f82f2f, 0x000146100, - 0x004384fef, + 0x004744fef, 0x000186000, - 0x0ff7a60be, - 0x048780002, - 0x0486e82a2, - 0x0610006b8, - 0x02f400008, - 0x04aaf0008, + 0x0ff384fef, + 0x0fff042af, + 0x000044878, + 0x00002486e, + 0x0836c6100, + 0x006ee4a80, + 0x042e72f40, + 0x0001644df, 0x06c0a486e, - 0x082ae6100, - 0x00440588f, - 0x0486e82c2, - 0x02f2f000c, - 0x061000402, - 0x0486e82c8, - 0x02f2f0014, - 0x0610003f6, - 0x04fef0018, - 0x06000ff38, - 0x04feffff0, - 0x042af0004, + 0x083766100, + 0x00474588f, 0x048780002, - 0x0486e833c, - 0x061000670, + 0x0486e8388, + 0x0610006cc, 0x04a8042e7, - 0x02f400016, + 0x02f40001a, 0x044df6c0a, - 0x0486e8346, - 0x0610003f6, - 0x0588f4878, - 0x00002486e, - 0x083586100, - 0x0064e4a80, - 0x042e72f40, - 0x0001a44df, - 0x06c0a486e, - 0x083616100, - 0x003d4588f, - 0x0486e8562, - 0x0486e8372, - 0x0486e85a2, - 0x061000560, - 0x0486e85a2, - 0x0610005d2, - 0x02f002f40, - 0x00024486e, - 0x085a22f2f, - 0x000306100, - 0x00626b0af, - 0x0002c661e, - 0x0486e8562, - 0x0486e83a5, - 0x061000464, - 0x02f2f003c, - 0x0610005d0, - 0x0202f0044, - 0x04fef0048, - 0x04e757005, - 0x0b0af0030, - 0x0660a486e, - 0x0837d6100, - 0x00374588f, - 0x0486e8562, - 0x0486e8385, - 0x061000434, - 0x02f2f0040, - 0x0610005a0, - 0x02f2f0040, + 0x0486e8391, + 0x061000452, + 0x0588f486e, + 0x085d6486e, + 0x083a2486e, + 0x084f66100, + 0x005de486e, + 0x084f66100, + 0x006502f00, + 0x02f400024, + 0x0486e84f6, + 0x02f2f0030, + 0x0610006a4, + 0x0b0af002c, + 0x0661e486e, + 0x085d6486e, + 0x083d56100, + 0x004e22f2f, + 0x0003c6100, + 0x0064e202f, + 0x000444fef, + 0x000484e75, + 0x07005b0af, + 0x00030660a, + 0x0486e83ad, + 0x0610003f2, + 0x0588f486e, + 0x085d6486e, + 0x083b56100, + 0x004b22f2f, + 0x000406100, + 0x0061e2f2f, + 0x000406100, + 0x0061652af, + 0x000404fef, + 0x0003c6000, + 0x0ff36518f, + 0x042ae801a, + 0x042ae801e, + 0x042a7486e, + 0x083e66100, + 0x0061a4a80, + 0x06d744878, + 0x0003f486e, + 0x0869a2f00, + 0x02f400018, + 0x06100060a, + 0x02f2f0018, + 0x0610005d8, + 0x0207c0000, + 0x066984878, + 0x000202f08, + 0x061000566, + 0x020404a80, + 0x04fef0018, + 0x067405288, + 0x00c10002d, + 0x04feffff0, + 0x066e04a10, + 0x067dc0c10, + 0x0002067d6, + 0x0101849c0, + 0x04fef0018, + 0x07266b200, + 0x06714726d, + 0x0b2006706, + 0x04fefffe8, + 0x060dc7001, + 0x02d40801e, + 0x060f27001, + 0x02d40801a, + 0x060ea42a7, + 0x0486e83f2, 0x061000598, - 0x052af0040, - 0x04fef003c, - 0x06000ff36, - 0x0598f42a7, - 0x0486e83b6, - 0x0610005a4, - 0x04a806d1e, - 0x048780040, - 0x0486e8682, - 0x02f002f40, - 0x000146100, - 0x005942f2f, - 0x000146100, - 0x005624fef, - 0x0001042a7, - 0x0486e83c2, - 0x061000578, 0x04a806d1e, 0x048780001, - 0x0486e8002, + 0x0486e8022, 0x02f002f40, - 0x0001c6100, - 0x005682f2f, - 0x0001c6100, - 0x005364fef, + 0x000206100, + 0x005882f2f, + 0x000206100, + 0x005564fef, 0x0001042a7, - 0x0486e83d0, - 0x06100054c, + 0x0486e8400, + 0x06100056c, 0x04a806d20, 0x048780040, - 0x0486e8562, + 0x0486e85d6, 0x02f002f40, - 0x000246100, - 0x0053c2f2f, - 0x000246100, - 0x0050a4fef, - 0x0002c4e75, - 0x0486e83de, - 0x0486e8562, - 0x0610004bc, + 0x000286100, + 0x0055c2f2f, + 0x000286100, + 0x0052a4fef, + 0x000304e75, + 0x0486e840e, + 0x0486e85d6, + 0x0610004dc, 0x0518f60ea, 0x0598f486e, - 0x083e26100, - 0x003761d7c, - 0x000328606, + 0x084126100, + 0x003961d7c, + 0x00032855a, 0x03d7cffff, - 0x0860a486e, - 0x085a2486e, - 0x086066100, - 0x0051a2f00, + 0x0855e486e, + 0x084f6486e, + 0x0855a6100, + 0x0053a2f00, 0x02f400010, - 0x0486e85a2, + 0x0486e84f6, 0x02f2f001c, - 0x0610004fc, + 0x06100051c, 0x0b0af0018, 0x0670a486e, - 0x083e96100, - 0x00270588f, + 0x084196100, + 0x00290588f, 0x048780064, - 0x0486e85a2, + 0x0486e84f6, 0x02f2f0028, - 0x0610004ca, + 0x0610004ea, 0x022007002, 0x0b0816608, 0x00c2e004f, - 0x085a2677c, + 0x084f6677c, 0x04a8142e7, 0x02f410026, 0x044df6e0e, - 0x0486e83f3, - 0x06100023a, + 0x0486e8423, + 0x06100025a, 0x0222f0028, 0x0588f2f01, - 0x0486e8606, - 0x0486e85a2, - 0x061000cbc, + 0x0486e855a, + 0x0486e84f6, + 0x061000cdc, 0x04a806638, - 0x0102e85a5, + 0x0102e84f9, 0x049c02f00, - 0x0102e85a4, + 0x0102e84f8, 0x049c02f00, - 0x0102e85a3, + 0x0102e84f7, 0x049c02f00, - 0x0102e85a2, + 0x0102e84f6, 0x049c02f00, 0x02f2f0040, - 0x0486e83fc, - 0x0610002c4, - 0x0486e841f, - 0x0610001ee, + 0x0486e842c, + 0x0610002e4, + 0x0486e844f, + 0x06100020e, 0x04fef001c, 0x00c2e0033, - 0x08606670a, - 0x0486e842a, - 0x0610001da, + 0x0855a670a, + 0x0486e845a, + 0x0610001fa, 0x0588f4fef, 0x000344e75, 0x00c2e004b, - 0x085a36600, + 0x084f76600, 0x0ff7c4878, 0x00064486e, - 0x085a22f2f, + 0x084f62f2f, 0x000346100, - 0x004242200, + 0x004442200, 0x04fef000c, 0x06000ff62, 0x0598f486e, - 0x084336100, - 0x002721d7c, - 0x000348606, + 0x084636100, + 0x002921d7c, + 0x00034855a, 0x03d7cffff, - 0x0860a486e, - 0x085a2486e, - 0x086066100, - 0x004162f00, + 0x0855e486e, + 0x084f6486e, + 0x0855a6100, + 0x004362f00, 0x02f400010, - 0x0486e85a2, + 0x0486e84f6, 0x02f2f001c, - 0x0610003f8, + 0x061000418, 0x0b0af0018, 0x0670a486e, - 0x0843e6100, - 0x0016c588f, + 0x0846e6100, + 0x0018c588f, 0x048780064, - 0x0486e85a2, + 0x0486e84f6, 0x02f2f0028, - 0x0610003c6, + 0x0610003e6, 0x02f400024, 0x04aaf0024, 0x06e0a486e, - 0x0844c6100, - 0x00148588f, + 0x0847c6100, + 0x00168588f, 0x02f2f0024, - 0x0486e8606, - 0x0486e85a2, - 0x061000bcc, + 0x0486e855a, + 0x0486e84f6, + 0x061000bec, 0x04a80660a, - 0x0486e8459, - 0x06100012a, + 0x0486e8489, + 0x06100014a, 0x0588f0c2e, - 0x000378606, + 0x00037855a, 0x06618486e, - 0x0860c486e, - 0x084686100, - 0x001e2486e, - 0x0860c6100, - 0x0010c4fef, + 0x08560486e, + 0x084986100, + 0x00202486e, + 0x085606100, + 0x0012c4fef, 0x0000c0c2e, - 0x000358606, + 0x00035855a, 0x0670a486e, - 0x084726100, - 0x000f8588f, + 0x084a26100, + 0x00118588f, 0x04fef0034, 0x04e754fef, 0x0fff042a7, - 0x0486e847f, - 0x061000348, + 0x0486e84af, + 0x061000368, 0x04a806c0a, 0x0202f001c, 0x04fef0018, 0x04e75486e, - 0x084846100, - 0x0019a486f, + 0x084b46100, + 0x001ba486f, 0x0000c6100, - 0x002fa4a80, + 0x0031a4a80, 0x06c0a486e, - 0x0848b6100, - 0x000b8588f, - 0x06100030c, + 0x084bb6100, + 0x000d8588f, + 0x06100032c, 0x04fef0010, 0x072ffb280, - 0x0676c4281, - 0x0b280671c, - 0x02f176100, - 0x002de2f2f, - 0x000186100, - 0x002d6242f, - 0x0000c508f, - 0x020024fef, - 0x000104e75, - 0x02f2f0004, - 0x0610002c0, - 0x042a72f2f, - 0x0001c6100, - 0x002c22f2f, - 0x000206100, - 0x002ae4878, - 0x000012f2f, - 0x000146100, - 0x002ae2f2f, - 0x000186100, - 0x0029a42a7, - 0x0486e84a2, - 0x0486e849a, - 0x0486e8495, - 0x061000214, - 0x0242f0040, + 0x06700008c, + 0x04281b280, + 0x067202f17, + 0x0610002fc, + 0x02f2f0018, + 0x0610002f4, + 0x02f6f000c, + 0x0001c508f, + 0x0202f0014, + 0x04fef0010, + 0x04e752f2f, + 0x000046100, + 0x002da42a7, + 0x02f2f001c, + 0x0610002dc, + 0x02f2f0020, + 0x0610002c8, + 0x048780001, + 0x02f2f0014, + 0x0610002c8, + 0x02f2f0018, + 0x0610002b4, + 0x04aae801a, + 0x0671842a7, + 0x0486e84d2, + 0x0486e84ca, + 0x0486e84c5, + 0x061000228, 0x04fef002c, - 0x060ae486e, - 0x084906134, - 0x0588f60ac, + 0x060aa42a7, + 0x0486e84e3, + 0x0486e84db, + 0x0486e84d6, + 0x061000210, + 0x04fef002c, + 0x06092486e, + 0x084c06134, + 0x0588f6092, 0x0598f2f2f, 0x0000c6100, 0x002402f00, @@ -508,7 +537,7 @@ ulong bootcode[]={ 0x0027c486f, 0x000042f2f, 0x0004c486e, - 0x084a54878, + 0x084e64878, 0x000026100, 0x0011a42a7, 0x061744fef, @@ -516,10 +545,10 @@ ulong bootcode[]={ 0x0598f4281, 0x07021b081, 0x06f1e4ab6, - 0x01d2084de, + 0x01d208616, 0x0660e2daf, 0x000081d20, - 0x084de7001, + 0x086167001, 0x0588f4e75, 0x052817021, 0x0b0816ee2, @@ -529,25 +558,25 @@ ulong bootcode[]={ 0x042827021, 0x0b0826f18, 0x020362d20, - 0x084deb088, + 0x08616b088, 0x0660642b6, - 0x02d2084de, + 0x02d208616, 0x052827021, 0x0b0826ee8, 0x0588f4e75, 0x04aaf0004, 0x0660642a7, 0x0610c588f, - 0x0486e84b6, + 0x0486e8036, 0x06104588f, 0x04e75518f, 0x072204a81, 0x06d222eb6, - 0x01d2084de, + 0x01d208616, 0x04a976712, 0x02f410004, 0x042b61d20, - 0x084de4eb7, + 0x086164eb7, 0x00151222f, 0x000045381, 0x04a816cde, @@ -572,10 +601,10 @@ ulong bootcode[]={ 0x0240042e7, 0x02f40001e, 0x044df6c1a, - 0x052ae8012, + 0x052ae8002, 0x0700ab0ae, - 0x080126e0e, - 0x0486e84ce, + 0x080026e0e, + 0x0486e8026, 0x06100ff70, 0x0242f0020, 0x0588f2002, @@ -598,10 +627,10 @@ ulong bootcode[]={ 0x0240042e7, 0x02f40001e, 0x044df6c1a, - 0x052ae8012, + 0x052ae8002, 0x0700ab0ae, - 0x080126e0e, - 0x0486e84ce, + 0x080026e0e, + 0x0486e8026, 0x06100ff08, 0x0242f0020, 0x0588f2002, @@ -679,7 +708,7 @@ ulong bootcode[]={ 0x006247251, 0x0b0016e00, 0x0061c3036, - 0x00b2080d2, + 0x00b20806a, 0x04efb0000, 0x0200890af, 0x0000c588f, @@ -1071,7 +1100,7 @@ ulong bootcode[]={ 0x06000f9f2, 0x0101149c0, 0x02f00486e, - 0x081166100, + 0x0814e6100, 0x0f7ea4280, 0x04fef000c, 0x04e756000, @@ -1194,7 +1223,7 @@ ulong bootcode[]={ 0x006007251, 0x0b0016e00, 0x005f83036, - 0x00b208112, + 0x00b2080aa, 0x04efb0000, 0x0202f0008, 0x0d0af0010, @@ -1577,7 +1606,7 @@ ulong bootcode[]={ 0x06000fa16, 0x0101149c0, 0x02f00486e, - 0x081246100, + 0x0815c6100, 0x0f0024280, 0x04fef000c, 0x04e756000, @@ -1688,45 +1717,45 @@ ulong bootcode[]={ 0x04e75142f, 0x00007c43c, 0x0007f701e, - 0x0b0ae801a, + 0x0b0ae800e, 0x06e047001, 0x04e75202e, - 0x0801a1202, + 0x0800e1202, 0x049c11d80, - 0x01920801e, - 0x052ae801a, + 0x01920804e, + 0x052ae800e, 0x0120249c1, 0x010361920, - 0x0801e49c0, + 0x0804e49c0, 0x02daf0008, - 0x00d20809e, + 0x00d20816e, 0x042804e75, 0x04fefffe4, 0x0282f002c, 0x0246f0028, 0x02f6e8006, 0x000042eae, - 0x0800a2d6f, + 0x080122d6f, 0x000208006, 0x0202f0024, 0x053802d40, - 0x0800a101a, + 0x08012101a, 0x049c02400, 0x07025b082, 0x067684a82, 0x06628202e, 0x08006b0ae, - 0x0800a6504, + 0x080126504, 0x053ae8006, 0x042360161, 0x08006202e, 0x080062d6f, 0x000048006, - 0x02d57800a, + 0x02d578012, 0x04fef001c, 0x04e75202e, 0x08006b0ae, - 0x0800a640a, + 0x08012640a, 0x01d820161, 0x0800652ae, 0x0800652ae, @@ -1792,9 +1821,9 @@ ulong bootcode[]={ 0x02f490028, 0x02f042f44, 0x000401036, - 0x02920801e, + 0x02920804e, 0x049c02076, - 0x00d20809e, + 0x00d20816e, 0x04e90282f, 0x00040246f, 0x0003c226f, @@ -1952,7 +1981,7 @@ ulong bootcode[]={ 0x0000c6100, 0x0eb7c266f, 0x00010246e, - 0x0800a262f, + 0x08012262f, 0x00014226f, 0x00018206e, 0x080062200, @@ -2029,7 +2058,7 @@ ulong bootcode[]={ 0x04fef0010, 0x04e75202e, 0x08006b0ae, - 0x0800a640c, + 0x08012640c, 0x01dbc0025, 0x001618006, 0x052ae8006, @@ -2548,10 +2577,22 @@ ulong bootcode[]={ 0x000000000, 0x000000000, 0x000000000, + 0x000000007, + 0x000000000, 0x000000000, 0x000000000, 0x000000000, - 0x000000007, + 0x000000000, + 0x07072696e, + 0x074206572, + 0x0726f7273, + 0x000000000, + 0x06e6f6e2d, + 0x07a65726f, + 0x020657869, + 0x074207374, + 0x061747573, + 0x000000000, 0x000000000, 0x000000000, 0x000000000, @@ -2584,44 +2625,6 @@ ulong bootcode[]={ 0x000010000, 0x002000000, 0x000000000, - 0x000003f40, - 0x000003fcc, - 0x000003c68, - 0x00000401e, - 0x000003f6e, - 0x000003f94, - 0x000003fb2, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x000000000, - 0x062616420, - 0x074797065, - 0x03a202564, - 0x00a006261, - 0x064207479, - 0x070653a20, - 0x025640a00, - 0x000000000, 0x006340630, 0x0062c0628, 0x0061205f0, @@ -2654,6 +2657,44 @@ ulong bootcode[]={ 0x0015a0124, 0x000ee00d6, 0x0008c001c, + 0x062616420, + 0x074797065, + 0x03a202564, + 0x00a006261, + 0x064207479, + 0x070653a20, + 0x025640a00, + 0x000000000, + 0x000003fb4, + 0x000004040, + 0x000003cdc, + 0x000004092, + 0x000003fe2, + 0x000004008, + 0x000004026, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, + 0x000000000, 0x023632f63, 0x06f6e7300, 0x023632f63, @@ -2841,21 +2882,17 @@ ulong bootcode[]={ 0x063667300, 0x0626f6f74, 0x063667300, - 0x02d730062, - 0x06f6f743a, - 0x02025733a, - 0x02025730a, - 0x000000000, - 0x06e6f6e2d, - 0x07a65726f, - 0x020657869, - 0x074207374, - 0x061747573, - 0x000000000, - 0x07072696e, - 0x074206572, - 0x0726f7273, - 0x000000000, - 0x00002ca4, + 0x02d667300, + 0x02f636673, + 0x000626f6f, + 0x074636673, + 0x0002d7300, + 0x0626f6f74, + 0x03a202573, + 0x03a202573, + 0x00a000000, + 0x00002d30, + 0x0, + 0x00002d30, 0x0, }; diff --git a/gnot/fns.h b/gnot/fns.h index 7120374b779def7b0ae359b95059aed119a0acbc..d617cb60cefcd7dc4d941ca2e4d1895319cc1238 100644 --- a/gnot/fns.h +++ b/gnot/fns.h @@ -239,3 +239,5 @@ Chan *walk(Chan*, char*, int); #define P_write(sel, addr, val, type) P_oper(sel, *(type *)(PORT+addr) = val) + +#define flushpage(x) if(x) diff --git a/port/devlance.c b/port/devlance.c index dbc4b04e7c3349066bf6d78449c5faa9bec5b290..330e1f9278178c7f0da6522ef027050caf36ae20 100644 --- a/port/devlance.c +++ b/port/devlance.c @@ -802,7 +802,7 @@ lancekproc(void *arg) len = MPus(m->cntflags) - 4; lancedebq('i', p, len);/**/ for(e = &l.e[0]; e < &l.e[Ntypes]; e++){ - if(!canqlock(e)) + if(e->q==0 || t!=e->type || !canqlock(e)) continue; if(e->q && t == e->type) break; @@ -815,18 +815,18 @@ lancekproc(void *arg) */ if(e == &l.e[Ntypes]){ for(e = &l.e[0]; e < &l.e[Ntypes]; e++){ - if(!canqlock(e)) + if(e->q==0 || e->type!=-1 || !canqlock(e)) continue; if(e->q && e->type == -1) break; qunlock(e); } } - if(e!=&l.e[Ntypes] && e->q->next->len<=Streamhi){ - /* - * The lock on e makes sure the queue is still there. - */ - if(!waserror()){ + /* + * The lock on e makes sure the queue is still there. + */ + if(e!=&l.e[Ntypes]){ + if(e->q->next->len<=Streamhi && !waserror()){ bp = allocb(len); memcpy(bp->rptr, (uchar *)p, len); bp->wptr += len; diff --git a/port/devpipe.c b/port/devpipe.c index 956628caffa699a2d66c9836f584206b329732d6..2bb0d21f70a81b3b6e75d09f81c1c86c35eeb855 100644 --- a/port/devpipe.c +++ b/port/devpipe.c @@ -221,8 +221,10 @@ pipeclose(Chan *c) */ if(c->stream){ remote = c->stream->devq->ptr; - if(streamclose(c) <= 0) - streamexit(remote, 0); + if(streamclose(c) <= 0){ + if(remote) + streamexit(remote, 0); + } } /* diff --git a/power/fns.h b/power/fns.h index 4b993fe0238a78e8d5ab2d089c5038c532057fd3..944f39c708d98775b41d250929b0ef132964398f 100644 --- a/power/fns.h +++ b/power/fns.h @@ -61,6 +61,7 @@ void execpc(ulong); void exit(void); int fault(ulong, int); void faultmips(Ureg*, int, int); +ulong fcr31(void); void fdclose(int); Chan* fdtochan(int, int); void firmware(void); @@ -157,7 +158,7 @@ int readnum(ulong, char*, ulong, ulong, int); void ready(Proc*); void qlock(QLock*); void qunlock(QLock*); -void restfpregs(FPsave*); +void restfpregs(FPsave*, ulong); int return0(void*); Proc *runproc(void); void savefpregs(FPsave*); diff --git a/power/l.s b/power/l.s index a9c6011ef39463484be425092b23a947f17f6563..a170898270738e4b8ed228dbcca9961d6fc1f08c 100644 --- a/power/l.s +++ b/power/l.s @@ -447,7 +447,7 @@ TEXT restfpregs(SB), $0 MOVW 0(FP), R1 OR $CU1, R3 MOVW R3, M(STATUS) - MOVW 0x80(R1), R2 + MOVW fpstat+4(FP), R2 NOOP MOVD 0x00(R1), F0 @@ -472,6 +472,11 @@ TEXT restfpregs(SB), $0 MOVW R3, M(STATUS) RET +TEXT fcr31(SB), $0 + + MOVW FCR31, R1 + RET + /* * we avoid using R4, R5, R6, and R7 so gotopc can call us without saving them */ diff --git a/power/main.c b/power/main.c index eeec2678731aa1198e75bc6b28125f54c215aa7d..5dd7ba18f2bbd3892c841bf95bf9e861a2f5e86b 100644 --- a/power/main.c +++ b/power/main.c @@ -252,6 +252,7 @@ userinit(void) k = kmap(p->upage); up = (User*)VA(k); up->p = p; + up->fpsave.fpstatus = initfp.fpstatus; kunmap(k); /* diff --git a/power/trap.c b/power/trap.c index 59ccbb3f5f8935de6962f66ab71705a45246b01a..9d121ff787b28264b716c74e10830747f8cadb32 100644 --- a/power/trap.c +++ b/power/trap.c @@ -121,13 +121,13 @@ trap(Ureg *ur) case CCPU: if(u && u->p && u->p->fpstate == FPinit) { - restfpregs(&initfp); + restfpregs(&initfp, u->fpsave.fpstatus); u->p->fpstate = FPactive; ur->status |= CU1; break; } if(u && u->p && u->p->fpstate == FPinactive) { - restfpregs(&u->fpsave); + restfpregs(&u->fpsave, u->fpsave.fpstatus); u->p->fpstate = FPactive; ur->status |= CU1; break; @@ -166,7 +166,7 @@ trap(Ureg *ur) notify(ur); splhi(); if(user && u && u->p->fpstate == FPinactive) { - restfpregs(&u->fpsave); + restfpregs(&u->fpsave, u->fpsave.fpstatus); u->p->fpstate = FPactive; ur->status |= CU1; } @@ -458,9 +458,11 @@ syscall(Ureg *aur) ur->cause = 15<<2; /* for debugging: system call is undef 15; /* * since the system call interface does not - * guarantee anything about registers, + * guarantee anything about registers, we can + * smash them. but we must save fpstatus. */ if(u->p->fpstate == FPactive) { + u->fpsave.fpstatus = fcr31(); u->p->fpstate = FPinit; ur->status &= ~CU1; }