My OS gets stuck switching tasks

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
sed4906h
Posts: 17
Joined: Thu Nov 25, 2021 7:11 pm

Re: My OS gets stuck switching tasks

Post by sed4906h »

https://github.com/SED4906/rotomsos Have a look. Maybe it's just really subtle.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: My OS gets stuck switching tasks

Post by neon »

Hi,

Want to confirm as I dont see this in the code. With pd[1023] as the recursive map, the page directory table can only ever be at 0xfffff000 virtual and page tables can only ever be at 0xffc00000 base. I dont see a way for these macros to build valid addresses to these page tables.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
sed4906h
Posts: 17
Joined: Thu Nov 25, 2021 7:11 pm

Re: My OS gets stuck switching tasks

Post by sed4906h »

When I write to the page directory, the next time I read it, it'll give me back what I wrote as expected, but not for long. The contents of the page directory are getting constantly overwritten with this data (persisting across restarts of QEMU)

Code: Select all

fffff000: 0xb9660bc0 0x001800b0 0x66d23166 0x8966f1f7
fffff010: 0x8d6667d7 0x66ec0556 0x3c60e083 0x88087560
fffff020: 0xf28966d8 0x6616ebee 0xe866f889 0xffff7d58
fffff030: 0x75c08566 0x05e86608 0xebffff97 0x665b66d4
fffff040: 0x665f665e 0x5366cfc3 0x66c38966 0xe866d889
fffff050: 0xffff860c 0x75c08566 0xe1e86608 0xebffff96
fffff060: 0x665b66ea 0x5366cfc3 0x2710bb66 0x64e40000
fffff070: 0x287402a8 0x0032b866 0xe8660000 0xffff85fc
fffff080: 0xea754b66 0xd958ba66 0xb8660000 0x00000035
fffff090: 0x86b4e866 0x8366ffff 0x03ebffc8 0x66c03166
fffff0a0: 0x90c3665b 0x00000000 0x00000000 0x00000000
fffff0b0: 0x00000000 0x00000000 0x00000000 0x00000000
fffff0c0: 0x00000000 0x00000000 0x00000000 0x00000000
fffff0d0: 0x00000000 0x00000000 0x00000000 0x00000000
fffff0e0: 0x00000000 0x00000000 0x00000000 0x00000000
fffff0f0: 0x00000000 0x00000000 0x00000000 0x57665566
fffff100: 0x53665666 0x38ec8366 0x0040b866 0xc08e0000
fffff110: 0x6ca16626 0x66406600 0x1800af3d 0x260d7600
fffff120: 0x660070a0 0x70a22640 0xc0316600 0x0040ba66
fffff130: 0xc28e0000 0x6ca36626 0x26c28e00 0x840040a0
fffff140: 0x661974c0 0x40a22648 0x75c08400 0xd231660f
fffff150: 0x00f0b866 0xe8660000 0xffff82d3 0x30a1662e
fffff160: 0x89666761 0x85662404 0x79840fc0 0x8d666701
fffff170: 0x67122454 0x24048b66 0x8b3fe866 0x8966ffff
fffff180: 0xc08566c7 0x015e850f 0x44c76667 0xdb800424
fffff190: 0x8e670000 0x26042444 0x241e8b66 0xa16626f0
fffff1a0: 0x6667f028 0x08245c89 0x44896667 0x31660c24
fffff1b0: 0x01bd66f6 0x67000000 0x44b60f66 0xc084092c
fffff1c0: 0x31665074 0x443a67d2 0x0f751414 0x1444c667
fffff1d0: 0x88670014 0x660a3444 0x662feb46 0xfa836642
fffff1e0: 0x67e27506 0x4cb60f66 0xba661224 0x00000080
fffff1f0: 0x0852e866 0x83660000 0x087406fd 0x2c7c8067
fffff200: 0x0675000a 0x2444c667 0x4566ff09 0x07fd8366
fffff210: 0x8a67a575 0x66122444 0x2166d0f7 0xb60f66d8
fffff220: 0x80ba66c0 0x66000000 0x000cd3e8 0xd3f76600
fffff230: 0x245c2267 0xb60f6612 0xd23166c3 0x0cbee866
fffff240: 0x8a670000 0x67122444 0x08244488 0x3c5c8a67
fffff250: 0x74db8414 0x0f666721 0x12244cb6 0xc3b60f66
fffff260: 0x66d23166 0x0007dfe8 0x5c886700 0xc6670a34
fffff270: 0x10092444 0x47664666 0x06ff8366 0x8366ce75
fffff280: 0x227e05fe 0x24448a67 0x75c08409 0x0f666726
fffff290: 0x12244cb6 0xb60f6667 0x66093444 0xe866d231
fffff2a0: 0x000007a4 0xc66718eb 0x000a3444 0x74f68566
fffff2b0: 0x3cd1eb0d 0x660774ff 0x44886748 0x66670924
fffff2c0: 0x042444c7 0x0000db80 0x24448e67 0x8b666704
fffff2d0: 0x26082444 0xf024a366 0x448b6667 0x66260c24
fffff2e0: 0xe9f028a3 0x662efe87 0x612c368b 0x74f68566
fffff2f0: 0x8d66676e 0x66122454 0xe866f089 0xffff89bd
fffff300: 0x75c08566 0x5c8a675a 0x8a671324 0x66142444
fffff310: 0x8867d8f7 0x8a672404 0x66122444 0x6707e083
fffff320: 0xc0240c8a 0x836602f9 0x096620e1 0xc0d988c8
fffff330: 0x836603f9 0x096610e1 0xc88366c8 0xbe0f6608
fffff340: 0xe0e866c0 0x66ffffc5 0x66c3b60f 0xffc5d6e8
fffff350: 0x0f6667ff 0x662404b6 0xffc5cae8 0x6692ebff
fffff360: 0x00db80b8 0xc3896600 0x8b26c08e 0x85f0542e
fffff370: 0x52840fed 0x8d666701 0x89660575 0xc0feecf2
fffff380: 0x0143840f 0x9601e866 0x3166ffff 0xf28966ff
fffff390: 0x0f01a8ec 0x66009284 0x8eecea89 0x168a26c3
fffff3a0: 0xfa80f039 0x66e6770f 0x390eb60f 0x886726f0
fffff3b0: 0x00f03c81 0x26426600 0xf0391688 0xcdeb4766
fffff3c0: 0x7977013c 0xa026c38e 0x8966f03c 0x75c984f9
fffff3d0: 0x26c38e65 0xf03c0e8a 0xdd80ba66 0xbe660000
fffff3e0: 0x0000e048 0xc9b60f66 0x028b672e 0xe8b60f66
fffff3f0: 0x840fcd39 0x672e00be 0x6602428b 0x39e8b60f
fffff400: 0xaf840fe9 0x8b672e00 0x0f660442 0xe939e8b6
fffff410: 0x00a0840f 0x08c28366 0x75d63966 0x01b866cb
fffff420: 0x66000000 0x000a85e8 0x26c38e00 0x84f039a0
fffff430: 0xe98d75c0 0x1b3c0091 0x8ae99775 0x3ca02600
fffff440: 0x0f1b3cf0 0x66ff7d85 0x00dca0b8 0xf6316600
fffff450: 0x488d6667 0x89666704 0x672e240c 0x8e04508a
fffff460: 0x0e8a26c3 0xca38f039 0x0f663673 0x6667cab6
fffff470: 0x04244c89 0x67ed3166 0x246c3966 0x8a8e0f04
fffff480: 0x8a672e00 0x8e00054c 0x264566c3 0x3c958a67
fffff490: 0x660000f0 0x66c9be0f 0x66d2b60f 0xd774d139
fffff4a0: 0x08c08366 0x08c68366 0xb0fe8166 0x75000000
fffff4b0: 0xff10e99f 0x840fc085 0x0f66ff63 0xe866c0b7
fffff4c0: 0xffff77f8 0x66ff56e9 0x000026b9 0xd2316600
fffff4d0: 0x448d6667 0xe8661224 0xffff77d1 0x2444c767
fffff4e0: 0x66020036 0x00d068ba 0xb70f6600 0x8d6667d2
fffff4f0: 0x66122444 0xff8b68e8 0xe620b0ff 0xc4836620
fffff500: 0x665b6638 0x665f665e 0x2ec3665d 0xa6868b67
fffff510: 0x660000dc 0x66c0b70f 0xff779fe8 0x8b6667ff
fffff520: 0x672e2404 0x0f66008a 0x4066c0b6 0x66fef4e9
fffff530: 0x66576655 0x66536656 0x670cec83 0x24048966
fffff540: 0x66d78966 0x6667ce89 0x042444c7 0x0000db80
fffff550: 0x24448e67 0x2ca02604 0x448867f0 0x83660a24
fffff560: 0x8366fce0 0x886730c8 0x670b2444 0x24548d66
fffff570: 0x60b8660b 0x66000010 0xff81e3e8 0xc38966ff
fffff580: 0x0fc08566 0x66022285 0xff91b3e8 0x448a67ff
fffff590: 0x66670b24 0x042444c7 0x0000db80 0x24448e67
fffff5a0: 0x2ca22604 0x66c288f0 0x67efe283 0x243c8366
fffff5b0: 0x66067400 0x88dfe083 0x548867c2 0x66670b24
fffff5c0: 0x0b24548d 0x1060b866 0xe8660000 0xffff8190
fffff5d0: 0x66c38966 0x850fc085 0x8966019f 0xfdc166fd
fffff5e0: 0xf8896608 0x4d75c0fe 0x03e8b966 0xba660000
fffff5f0: 0x000000ff 0x048b6667 0x27e86624 0x66ffff9c
fffff600: 0x8566c389 0x70850fc0 0xa0b96601 0x6600000f
fffff610: 0x6667d231 0x6624048b 0xff9b55e8 0xc08566ff
fffff620: 0x0152880f 0x66068867 0x0f0ee583 0x66009585
fffff630: 0x44e9db31 0xff816601 0x000002f2 0x00ae850f
fffff640: 0x00c8b966 0xba660000 0x000000f2 0x048b6667
fffff650: 0xcfe86624 0x66ffff9b 0x8566c389 0x18850fc0
fffff660: 0xf4b96601 0x66000001 0x6667d231 0x6624048b
fffff670: 0xff9afde8 0xc18966ff 0x0fc08566 0x6700f288
fffff680: 0x83660688 0x0f672bf8 0x04244494 0x808d6667
fffff690: 0xffffff55 0x01f88366 0x66c0960f 0xb247e983
fffff6a0: 0xf9836601 0x66107719 0x400001ba 0xead36602
fffff6b0: 0x66d2f766 0x6701e283 0x04244c8a 0x0475c108
fffff6c0: 0x2275d284 0x01f4b966 0x31660000 0x8b6667d2
fffff6d0: 0xe8662404 0xffff9a9a 0x0fc08566 0x67009788
fffff6e0: 0xe9014688 0xc6670093 0xe9000146 0x8966008b
fffff6f0: 0xb60f66f8 0xc8b966d0 0x67000000 0x24048b66
fffff700: 0x9b20e866 0x8966ffff 0xc08566c3 0xc1666b75
fffff710: 0x31660cff 0xc73966c0 0x6667267e 0x6616b60f
fffff720: 0x0000c8b9 0x8b666700 0xe8662404 0xffff9af6
fffff730: 0x66c38966 0x000001b8 0xdb856600 0x39ebd774
fffff740: 0x0fe58366 0x66f50166 0x840fee39 0xb966fee1
fffff750: 0x000001f4 0x67d23166 0x24048b66 0x9a10e866
fffff760: 0x8966ffff 0xc08566c3 0x88670f78 0xeb466606
fffff770: 0xc38966d6 0x896603eb 0xc76667c3 0xdb802404
fffff780: 0x8e670000 0x8a672404 0x260a2444 0x67f02ca2
fffff790: 0x24548d66 0x60b8660a 0x66000010 0xff7fbfe8
fffff7a0: 0xc08566ff 0x89660374 0xd88966c3 0x0cc48366
fffff7b0: 0x5e665b66 0x5d665f66 0x5666c366 0xb8665366
fffff7c0: 0x00000040 0xa026c08e 0x8366003e 0xa2267fe0
fffff7d0: 0xb866003e 0x00001388 0x7e34e866 0x8966ffff
fffff7e0: 0x40be66c3 0x66000000 0xe866d889 0xffff7e70
fffff7f0: 0x74c08566 0xf4ba6620 0x660000d8 0x0000e7b8
fffff800: 0x43e86600 0x66ffff7f 0xff7c45e8 0x80b866ff
fffff810: 0xeb000000 0x26c68e1c 0x003e168a 0x0878d284
fffff820: 0x8f1ae866 0xbfebffff 0x7fe28366 0x3e168826
fffff830: 0x665b6600 0x66c3665e 0xff7df1e8 0xf806e9ff
fffff840: 0x10686690 0xe900007b 0xbfe9db29 0x23686673
fffff850: 0xe900007b 0x2ae9db1d 0x89fc80be 0xd9e6840f
fffff860: 0xbb0f6866 0x0ae90000 0x665566db 0x66566657
fffff870: 0x66526653 0x8a67c389 0x023c1d40 0x0107840f
fffff880: 0xc0840877 0x0082850f 0x033c09eb 0x017c840f
fffff890: 0x6601a4e9 0xe866d889 0xffff78fb 0x85c68966
fffff8a0: 0x97840fc0 0x8d666701 0x8966037e 0x8366ecfa
fffff8b0: 0x67ee80c8 0x671c438a 0x03244488 0x6e8d6667
fffff8c0: 0x75e0a801 0x6617b00a 0xb0eef289 0x6718eb04
fffff8d0: 0x03244c8a 0x6605e9c0 0x000600b8 0xf8d36600
fffff8e0: 0xeef28966 0x6608e8c1 0x67eeea89 0x0324448a
fffff8f0: 0x1fe08366 0xeefa8966 0x568d6667 0x8867ec05
fffff900: 0x66671d43 0xe906568d 0x89660121 0x84e866d8
fffff910: 0x66ffff78 0xc085c789 0x0120840f 0x0040b866
fffff920: 0xc08e0000 0xb70f6667 0x67261443 0x267c408a
fffff930: 0x6c168b66 0xb60f6600 0x8d6667c0 0x66010244
fffff940: 0x1800b0b9 0xd2316600 0x66f1f766 0x6667d589
fffff950: 0xec05578d 0x66c68966 0x3c60e083 0x670d7560
fffff960: 0x661c438a 0x66eefa89 0x77ebf089 0x66e88966
fffff970: 0xff7413e8 0xc08566ff 0x89660574 0x667bebf2
fffff980: 0xff8dbbe8 0x66c7ebff 0xe866d889 0xffff7807
fffff990: 0x85c68966 0xa3840fc0 0x40b86600 0x8e000000
fffff9a0: 0x0f6667c0 0x261443b7 0x7c408a67 0x168b6626
fffff9b0: 0x0f66006c 0x6667c0b6 0x0102448d 0x00b0b966
fffff9c0: 0x31660018 0xf1f766d2 0x67d58966 0x05568d66
fffff9d0: 0xc78966ec 0x117401a8 0xecf28966 0x1c438867
fffff9e0: 0x67f88966 0xeb1d4388 0xe8896647 0x7396e866
fffff9f0: 0x8566ffff 0x660d74c0 0x8366fa89 0x886780ca
fffffa00: 0x2ceb1d53 0x8d36e866 0xbfebffff 0x66d88966
fffffa10: 0xff7782e8 0xc18966ff 0x2074c085 0x518d6667
fffffa20: 0x8867ec05 0x66671d43 0xec06518d 0x1c438867
fffffa30: 0x24638367 0x6705ebfe 0x01244b83 0x5b665866
fffffa40: 0x5f665e66 0xc3665d66 0x2077633c 0xc0b60f66
fffffa50: 0x848b672e 0x00d9c000 0x74c08500 0xb60f660f
fffffa60: 0xb60f66c9 0xb70f66d2 0x8af6e9c0 0x0000c366
fffffa70: 0x00000000 0x817e0000 0x99bd81a5 0xff7e7e81
fffffa80: 0xe7c3ffdb 0xfe6c7eff 0x387cfefe 0x38100010
fffffa90: 0x387cfe7c 0x7c380010 0x7cfefe38 0x10107c38
fffffaa0: 0x7cfe7c38 0x00007c38 0x183c3c18 0xffff0000
fffffab0: 0xe7c3c3e7 0x3c00ffff 0x66424266 0xc3ff003c
fffffac0: 0x99bdbd99 0x070fffc3 0xcccc7d0f 0x663c78cc
fffffad0: 0x183c6666 0x333f187e 0x7030303f 0x637fe0f0
fffffae0: 0x6763637f 0x5a99c0e6 0x3ce7e73c 0xe080995a
fffffaf0: 0xe0f8fef8 0x0e020080 0x0e3efe3e 0x3c180002
fffffb00: 0x7e18187e 0x6666183c 0x00666666 0xdb7f0066
fffffb10: 0x1b1b7bdb 0x633e001b 0x386c6c38 0x000078cc
fffffb20: 0x7e7e0000 0x3c18007e 0x3c7e187e 0x3c18ff18
fffffb30: 0x1818187e 0x18180018 0x3c7e1818 0x18000018
fffffb40: 0x180cfe0c 0x30000000 0x3060fe60 0x00000000
fffffb50: 0xfec0c0c0 0x24000000 0x2466ff66 0x18000000
fffffb60: 0xffff7e3c 0xff000000 0x183c7eff 0x00000000
fffffb70: 0x00000000 0x78300000 0x00303078 0x6c6c0030
fffffb80: 0x0000006c 0x6c6c0000 0x6cfe6cfe 0x7c30006c
fffffb90: 0xf80c78c0 0xc6000030 0x663018cc 0x6c3800c6
fffffba0: 0xccdc7638 0x60600076 0x000000c0 0x30180000
fffffbb0: 0x30606060 0x30600018 0x30181818 0x66000060
fffffbc0: 0x663cff3c 0x30000000 0x3030fc30 0x00000000
fffffbd0: 0x30000000 0x00006030 0x0000fc00 0x00000000
fffffbe0: 0x30000000 0x0c060030 0xc0603018 0xc67c0080
fffffbf0: 0xe6f6dece 0x7030007c 0x30303030 0xcc7800fc
fffffc00: 0xcc60380c 0xcc7800fc 0xcc0c380c 0x3c1c0078
fffffc10: 0x0cfecc6c 0xc0fc001e 0xcc0c0cf8 0x60380078
fffffc20: 0xccccf8c0 0xccfc0078 0x3030180c 0xcc780030
fffffc30: 0xcccc78cc 0xcc780078 0x180c7ccc 0x30000070
fffffc40: 0x30000030 0x30000030 0x30000030 0x30186030
fffffc50: 0x3060c060 0x00000018 0xfc0000fc 0x30600000
fffffc60: 0x30180c18 0xcc780060 0x0030180c 0xc67c0030
fffffc70: 0xc0dedede 0x78300078 0xccfccccc 0x66fc00cc
fffffc80: 0x66667c66 0x663c00fc 0x66c0c0c0 0x6cf8003c
fffffc90: 0x6c666666 0x62fe00f8 0x62687868 0x62fe00fe
fffffca0: 0x60687868 0x663c00f0 0x66cec0c0 0xcccc003e
fffffcb0: 0xccccfccc 0x307800cc 0x30303030 0x0c1e0078
fffffcc0: 0xcccc0c0c 0x66e60078 0x666c786c 0x60f000e6
fffffcd0: 0x66626060 0xeec600fe 0xc6d6fefe 0xe6c600c6
fffffce0: 0xc6cedef6 0x6c3800c6 0x6cc6c6c6 0x66fc0038
fffffcf0: 0x60607c66 0xcc7800f0 0x78dccccc 0x66fc001c
fffffd00: 0x666c7c66 0xcc7800e6 0xcc1c70e0 0xb4fc0078
fffffd10: 0x30303030 0xcccc0078 0xcccccccc 0xcccc00fc
fffffd20: 0x78cccccc 0xc6c60030 0xeefed6c6 0xc6c600c6
fffffd30: 0x6c38386c 0xcccc00c6 0x303078cc 0xc6fe0078
fffffd40: 0x6632188c 0x607800fe 0x60606060 0x60c00078
fffffd50: 0x060c1830 0x18780002 0x18181818 0x38100078
fffffd60: 0x0000c66c 0x00000000 0x00000000 0x3030ff00
fffffd70: 0x00000018 0x00000000 0xcc7c0c78 0x60e00076
fffffd80: 0x66667c60 0x000000dc 0xccc0cc78 0x0c1c0078
fffffd90: 0xcccc7c0c 0x00000076 0xc0fccc78 0x6c380078
fffffda0: 0x6060f060 0x000000f0 0x7ccccc76 0x60e0f80c
fffffdb0: 0x6666766c 0x003000e6 0x30303070 0x000c0078
fffffdc0: 0xcc0c0c0c 0x60e078cc 0x6c786c66 0x307000e6
fffffdd0: 0x30303030 0x00000078 0xd6fefecc 0x000000c6
fffffde0: 0xccccccf8 0x000000cc 0xcccccc78 0x00000078
fffffdf0: 0x7c6666dc 0x0000f060 0x7ccccc76 0x00001e0c
fffffe00: 0x606676dc 0x000000f0 0x0c78c07c 0x301000f8
fffffe10: 0x3430307c 0x00000018 0xcccccccc 0x00000076
fffffe20: 0x78cccccc 0x00000030 0xfefed6c6 0x0000006c
fffffe30: 0x6c386cc6 0x000000c6 0x7ccccccc 0x0000f80c
fffffe40: 0x643098fc 0x301c00fc 0x3030e030 0x1818001c
fffffe50: 0x18180018 0x30e00018 0x30301c30 0xdc7600e0
fffffe60: 0x00000000 0x10000000 0xc6c66c38 0xfc8000fe
fffffe70: 0x97840fb1 0x8c6866d3 0xe90000c6 0x8ab0d4f5
fffffe80: 0x26b070e6 0x8bb071e6 0x71e470e6 0x01e08366
fffffe90: 0x02c88366 0x8cb071e6 0x71e470e6 0x70e68db0
fffffea0: 0xc36671e4 0xfc686690 0xe90000f0 0x5666d438
fffffeb0: 0xba665366 0x0000db80 0x8ed68966 0x168a26c2
fffffec0: 0x0f66f039 0x2966d2b6 0x168826c2 0x3166f039
fffffed0: 0xca3966c9 0xc68e177e 0x9c8a6726 0x00f03c01
fffffee0: 0x88672600 0x00f03c99 0xeb416600 0x665b66e4
fffffef0: 0x00c3665e 0x00000000 0x00000000 0x00000000
ffffff00: 0x56665766 0xc3885366 0x66f63166 0x84fab60f
ffffff10: 0x663674db 0x66c3b60f 0x73f0a30f 0x8b672e28
ffffff20: 0xd9a83684 0x0f660000 0x3166c0b7 0xfa8966c9
ffffff30: 0x862ce866 0xb866ffff 0xfffffffe 0x66f18966
ffffff40: 0x2166c0d3 0xeb4666c3 0x665b66c6 0x665f665e
ffffff50: 0xcf9066c3 0x7b366866 0x16e90000 0x665766d4
ffffff60: 0x66536656 0x8966c189 0x7507a8d3 0xe0c16635
ffffff70: 0x00256608 0x6600ffff 0x00000c0d 0xf8ba6680
ffffff80: 0x6600000c 0xfeba66ef 0xec00000c 0x1278c084
ffffff90: 0x08c18366 0x0cf8be66 0xbf660000 0x00000cfc
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: My OS gets stuck switching tasks

Post by Octocontrabass »

sed4906h wrote:The contents of the page directory are getting constantly overwritten with this data (persisting across restarts of QEMU)
That's SeaBIOS.

In the QEMU monitor, use "info mem", "info tlb", and "info regs" to look for problems. In particular, check to make sure paging is still enabled.
sed4906h
Posts: 17
Joined: Thu Nov 25, 2021 7:11 pm

Re: My OS gets stuck switching tasks

Post by sed4906h »

It was as simple as two characters... "0x"
Never assume GNU Assembler does what you think it does.
It does not, in fact, use $ to mean a hexadecimal value.
That would be too simple.
Post Reply